<p>This document describes the cheat sheet content file structure as a series of
DTD fragments (<a href="cheatSheetContentFileSpec.exsd">machine readable XML schema</a>).</p>
<p>A cheat sheet consists of a series of items (steps) which must be completed in order. Items can be divided into subitems and can launch commands or actions which will perform some of the steps for the user.</p>
The root element of a cheatsheet.
The title of this cheat sheet. The title will be displayed at the head of the cheat sheet view when the cheat sheet is opened.
The <intro> element is used to define the introductory text to be displayed when the cheat sheet is opened.
The optional help context id of the documentation for this cheat sheet. If supplied, context help for the given fully-qualified context id is shown to the user (typically in a small pop-up window) when they clicks the introduction's help link. If this attribute is supplied, the <b>href</b> attribute should not be supplied (<b>href</b> will be ignored if both are present).
The optional help document describing this cheat sheet. If supplied, this help document is shown to the user (typically in a help browser shown in a separate window) when they clicks the introduction's help link. If this attribute is supplied, the <b>contextId</b> attribute should not be supplied (<b>href</b> will be ignored if both are present).
The <description> element holds the description of a cheat sheet or of
a cheat sheet item. The description consists of text interspersed with <a href="../../../org.eclipse.platform.doc.isv/guide/forms_controls_text_markup.htm">form text markup</a>. The cheat sheet automatically formats and lays out the text to
make it show up reasonably in the UI. Hyperlinks are expressed using <b><a href="URL">text</a></b>, where URL is a valid URL to an external web site or a CheatSheet URL that represents a CheatSheat action. All cheat sheet URLs have the following form: http://org.eclipse.ui.cheatsheet/<action name>?param1=value1&param2=value2 and will be processed by the cheat sheet framework.
<br>
The following predefined actions are included in the cheat sheet framework:
<p style="margin-left:15px;">
<b>showView</b> - activates view with given view id<br>
<i>id</i> - a view id<br>
<br>
<b>execute</b> - executes the specified command. See the <code>serialize()</code> method on <code>org.eclipse.core.command.ParameterizedCommand</code> for details of the command serialization format. Since 3.2.<br>
<i>command</i> - a serialized <code>ParameterizedCommand</code><br>
</p>
Within the text, balanced <b><b></b>...<b></b></b>
tags cause the enclosed text to be rendered in a bold font, and the <b><br/></b>
element can be used to force a line break. These are the only formatting tags
supported at this time (however, others may be added in the future). Certain
characters in the text have special significance for XML parsers; in particular,
to write "<", ">", "&", "'", and
""" (quotation mark) instead write "&lt;",
"&gt;", "&amp;", "&apos;", and "&quot;"
respectively. Whitespace (spaces and line breaks) is treated as a word
separator; adjacent spaces and line breaks are treated as single unit and
rendered as a single space or a line break. Whitespace immediately after the
<<b>description</b>> and <<b>br/</b>> tags is ignored, as is
whitespace immediately before the <<b>/description</b>> tag.
<p>Each <item> element describes one top-level step in a cheat sheet. An
<item> may contain <subitem> elements.
<p>The org.eclipse.ui.cheatsheets.cheatSheetItemExtension allows additional
custom controls for the item to be displayed in the UI. Contributions to this
extension point declare the names of additional, string-valued attributes that
may appear on <item> elements.</p>
<p>Simple items have a description and an optional action or command. In the typical
presentation, the titles of cheat sheet items are shown to the user most of the
time. An item's description is only shown while the step is in the process of
being executed. The presence of an <action>, <command> or <perform-when>)element is associated with a button that the user can press to perform
the step's action or command. If no action or command is present, the step is one that the user must
carry out manually and then overtly indicate that they have successfully
completed the step.</p>
<p>Steps may be broken down into sub-steps as specified by the <subitem> subelements. Unlike items, which the user must follow in strict sequence, the
sub-items of a given item can be performed in any order. All sub-items within an
item have to be attempted (or skipped) before progressing to the next item.
(Which means actions that must be performed in a required sequence cannot be
represented as sub-items.)</p>
<p>A <conditional-subitem> subelement allow a step to tailor the
presentation of a sub-step based on cheat sheet variables whose values are
acquired in earlier steps. A <repeated-subitem> subelement allows a step
to include a set of similar sub-steps. Again, the exact set of sub-steps may be
based on cheat sheet variables whose value are acquired in earlier steps.</p>
The title of this step.
if "true" means this step involves opening a modal dialog. This is a hint to the system that it should allow the user to continue using the cheat sheet while in the modal dialog. This attribute will only affect dialogs launched from a command or action.
if "true" means that the whole step can be skipped; the UI generally shows a button that the user can press to indicate that they are skipping this step
The optional help context id of the documentation for this cheat sheet step. If supplied, context help for the given fully-qualified context id is shown to the user (typically in a small pop-up window) when they clicks the step's help link. If this attribute is supplied, the <b>href</b> attribute should not be supplied (<b>href</b> will be ignored if both are present).
The optional help document describing this cheat sheet step. If supplied, this help document is shown to the user (typically in a help browser shown in a separate window) when they clicks the step's help link. If this attribute is supplied, the <b>contextId</b> attribute should not be supplied (<b>href</b> will be ignored if both are present).
<p>Each <subitem> element describes a sub-step in a cheat sheet. A <subitem>
carries a simple text label, but has neither a lengthy description nor further
sub-items.
<p>Sub-items may have an optional action or command. The presence of an <action>,
<command> or
<perform-when> element is associated with a button that the
user can press to perform the sub-step's action or command. If no action or
command is present, the
sub-step is one that the user must carry out manually and then overtly indicate
that they have successfully completed the step.</p>
<p>Unlike items, which must be followed in strict sequence, the sub-items of a
given item can be performed in any order. All sub-items within an item have to
be completed or skipped before progressing to the next item. (Which means
actions that must be performed in a required sequence should not be represented
as sub-items.)</p>
<p>Since version 3.4 a description has been allowed in a subitem in place of the label attribute, which allows for formatting tags to be used.</p>
The title of the cheat sheet sub-item. If the string
contains substring occurrences of the form "${<i>var</i>}", they
are considered references to cheat sheet variables. All such occurrences in
the string value will be replaced by the value of the corresponding variable
in the context of the execution of the cheat sheet, or the empty string for
variables that are unbound. The values of the variables are as of the
beginning of the execution of the main step (when the <item> element
is elaborated), rather than when the individual sub-step are run.
A subitem may have either a label or a description element but not both. A description element may contain the formating tags such as <b>, </b> or <br/>.
if "true" this sub-step can be
skipped. The UI generally shows a button that the user can press to indicate
that they are skipping this sub-step.
Indicates this subitem is to be used if and only if the
value of the condition attribute of the containing <conditional-subitem>
element matches this string value. This attribute is ignored if the <subitem>
element is not a child of a <conditional-subitem> element.
<p>Each <conditional-subitem> element describes a single sub-step whose
form can differ based on a condition known at the time the item is expanded.
<p>The <b>condition</b> attribute on the <conditional-subitem> element
provides a string value (invariably this value comes from a cheat sheet
variable). Each of the <subitem> children must carry a <b>when</b>
attribute with a distinct string value. When the item is expanded, the
<conditional-subitem> element is replaced by the <subitem> element
with the matching value. It is considered an error if there is no <subitem>
element with a matching value.</p>
<p>For example, if the cheat sheet variable named "v1" has the value
"b" when the following item is expanded</p>
<pre><item ...>
<conditional-subitem condition="${v1}">
<subitem when="a" label="Step for A." />
<subitem when="b" label="Step for B." />
</conditional-subitem>
</item></pre>
then the second sub-item is selected and the item expands to something
equivalent to
<pre><item ...>
<subitem label="Step for B."/>
</item></pre>
Arbitrary string value used to select which child <subitem>
will be used. If the attribute string has the form "${<i>var</i>}",
it is considered a reference to a cheat sheet variable <i>var</i>, and value
of the condition will be the value of the variable for the cheat sheet at
the start of execution of the containing <item> element (or the empty
string if the variable is unbound at that time).
<p>Each <repeated-subitem> element describes a sub-item that expands into
0, 1, or more similar sub-steps.
<p>The <b>values</b> attribute provides a list of comma-separated strings; the
<subitem> child provide the template. When the item is expanded, the
<repeated-subitem> element is replaced by copies of the <subitem>
element with occurrences of the variable "this" replaced by the
corresponding string value.</p>
<p>For example, if the cheat sheet variable named "v1" has the value
"1,b,three" when the following item is expanded</p>
<pre><item ...>
<repeated-subitem values="${v1}">
<subitem label="Step ${this}.">
<action class="com.xyz.myaction" pluginId="com.xyz" param1="${this}"/>
</subitem>
</repeated-subitem>
</item></pre>
then the item expands to something equivalent to:
<pre><item ...>
<subitem label="Step 1.">
<action class="com.xyz.myaction" pluginId="com.xyz" param1="1"/>
</subitem>
<subitem label="Step b.">
<action class="com.xyz.myaction" pluginId="com.xyz" param1="b"/>
</subitem>
<subitem label="Step three.">
<action class="com.xyz.myaction" pluginId="com.xyz" param1="three"/>
</subitem>
</item></pre>
A string containing a comma-separated list of values. If
the attribute string has the form "${<i>var</i>}", it is
considered a reference to a cheat sheet variable <i>var</i>, and value of
the condition will be the value of the variable for the cheat sheet at the
start of execution of the containing <item> element (or the empty
string if the variable is unbound at that time).
Each <action> element describes an action in a cheat sheet.
The fully-qualified name of the Java class implementing <code>org.eclipse.jface.action.IAction</code>.
If this action also implements <code>org.eclipse.ui.cheatsheets.ICheatSheetAction</code>
it will be invoked via its run(String[],ICheatSheetManager) method and be
passed the cheat sheet manager and action parameters. The pluginId attribute
must be present whenever this attribute is present. It is strongly
recommended that actions intended to be invoked from cheat sheets should
report success/fail outcome if running the action might fail (perhaps
because the user cancels the action from its dialog). (See
org.eclipse.jface.action.Action.notifyResult(boolean) for details.)
The id of the plug-in which contains the Java class of
the action class. This attribute must be present.
For action classes that also implement <code>org.eclipse.ui.cheatsheets.ICheatSheetAction</code>,
the string values of attributes <b>param1</b>,
<b>param2</b> up to <b>param9</b> are passed to the action when it is
invoked. You can pass up to 9 parameters to a cheat sheet action , etc. The parameters supplied must start with parameter 1
and be contiguous; that is, it is illegal to specify <b>param2</b> without <b>param1</b>
also being present. If the attribute string has the form "${<i>var</i>}",
it is considered a reference to a cheat sheet variable <i>var</i>, and value
of the condition will be the value of the variable for the cheat sheet at
the start of execution of the containing <item> element (or the empty
string if the variable is unbound at that time).
If "true" indicates this step (or sub-step)
requires the user to manually confirm that the action has been completed.
Indicates this action is to be used if and only if the value
of the condition attribute of the containing <perform-when> element
matches this string value. This attribute is ignored if the <action>
element is not a child of a <perform-when> element.
if "true" this item or subitem can only be completed by performing this action (it may still be skipped if skip="true"). If "false" two buttons will be created, one to perform the task and one to mark it as complete, either will complete this step or substep.
A comma separated list of parameters which are translatable. Any parameters not in the list are considered non-translatable. While this attribute is optional it is strongly recommended that it be provided for any cheat sheat which may end up being translated. If this attribute is not specified it means that there is no translation hint.
<br>
Examples:
<br>
<code>translate = "param2, param3"</code> means translate param2 and param3 only.
<br>
<code>translate = ""</code> means do not translate any parameters for this action.
<p>Each <command> element describes an command in a cheat sheet.
<p>Below is an example of an item with a command which opens a dialog box and
stores the result in the cheat sheet variable "result".</p>
<pre><item title="View Selection">
<description>Select a view which will be opened in the next step.</description>
<command returns = "result"
serialization="org.eclipse.ui.dialogs.openMessageDialog(title=Select View,buttonLabel0=Package Explorer,message=Select a view ,buttonLabel1=Search View)"/>
<onCompletion> Selected the ${result}. </onCompletion>
</item></pre>
A serialized
<a href="../api/org/eclipse/core/commands/ParameterizedCommand.html">
ParameterizedCommand</a>, which is a string containing the command name
and parameters. See the
<a href="../api/org/eclipse/core/commands/ParameterizedCommand.html#serialize()">
ParameterizedCommand.serialize()</a> method for full details on this format.
An optional attribute which specifies the name of a cheat
sheet variable which will be used to store the return value of the command.
This allows a command to set a cheat sheet variable which is used in
a later <perform-when>, <conditional-subitem> or <repeated-subitem>.
if "true" indicates that this step (or sub-step)
requires the user to manually confirm that the command has been completed.
Indicates this command is to be used if and only if the value
of the condition attribute of the containing <perform-when> element
matches this string value. This attribute is ignored if the <command>
element is not a child of a <perform-when> element.
if "true" this item or subitem can only be completed by performing this command (it may still be skipped if skip="true"). If "false" two buttons will be created, one to perform the task and one to mark it as complete, either will complete this step or substep.
A comma separated list of parameters which are translatable. Any parameters not in the list are considered non-translatable. While this attribute is optional it is strongly recommended that it be provided for any cheat sheat which may end up being translated. If this attribute is not specified it means that there is no translation hint.
<br>
Examples:
<br>
<code>translate = "param2, param3"</code> means translate param2 and param3 only.
<br>
<code>translate = ""</code> means do not translate any parameters for this command.
Contains text which will be displayed when
an item is completed. This is particularly useful in the final step of the cheat
sheet to acknowledge completion of the entire task. The description consists of text interspersed with <a href="../../../org.eclipse.platform.doc.isv/guide/forms_controls_text_markup.htm">form text markup</a> following the same rules as for a <description> element.
<onCompletion> elements may also contain references to cheat sheet variables of
the form "${<i>var</i>}", which will be expanded using the actual value of
the cheat sheet variable <i>var</i> at the time this step was completed.
<p>Each <perform-when> element describes an action in a cheat sheet.
<p>The <b>condition</b> attribute on the <conditional-subitem> element
provides a string value (invariably this value comes from a cheat sheet
variable). Each of the <subitem> children must carry a <b>when</b>
attribute with a distinct string value. When the item is expanded, the
<conditional-subitem> element is replaced by the <subitem> element
with the matching value. It is considered an error if there is no <subitem>
element with a matching value.</p>
<p>For example, if the cheat sheet variable named "v1" has the value
"b" when the following item is expanded</p>
<pre><item ...>
<subitem label="Main step">
<perform-when condition="${v1}">
<action when="a" class="com.xyz.action1" pluginId="com.xyz" />
<action when="b" class="com.xyz.action2" pluginId="com.xyz" />
<command when="c" serialization="org.eclipse.search.ui.views.SearchView"/>
</perform-when>
</subitem>
</item>
</pre>
then the second action is selected and the item expands to something equivalent
to
<pre><item ...>
<subitem label="Main step">
<action class="com.xyz.action2" pluginId="com.xyz" />
</subitem>
</item>
</pre>
Arbitrary string value used to select which child
<action> or <command> will be performed. If the attribute string has the form
"${<i>var</i>}", it is considered a reference to a cheat sheet
variable <i>var</i>, and value of the condition will be the value of the
variable for the cheat sheet at the start of execution of the containing
<item> element (or the empty string if the variable is unbound at that
time).
3.2
<p>The following is an example of a simple cheat sheet content file which
demonstrates the use of commands, perform-when and conditional subitems.</p>
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<cheatsheet title="Sample Cheat Sheet">
<intro>
<description>A cheat sheet which demonstrates the use of perform-when and conditional subitems</description>
</intro>
<item title="View Selection">
<description>Select a view which will be opened in the following steps.</description>
<command returns = "result"
serialization="org.eclipse.ui.dialogs.openMessageDialog(title=Select View,buttonLabel0=Package Explorer,message=Select a view ,buttonLabel1=Search View)"/>
<onCompletion> Selected the ${result}. </onCompletion>
</item>
<item title="Close Views">
<description>Close the search view and package explorer if open</description>
</item>
<item title="Open the view from a perform when item" skip = "true">
<description>Uses perform when to open the view seleted previously.</description>
<perform-when condition = "${result}">
<command when = "Package Explorer"
serialization="org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.jdt.ui.PackageExplorer)"/>
<command when = "Search View"
serialization="org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.search.ui.views.SearchView)"/>
</perform-when>
</item>
<item title="Close Views">
<description>Close the search view and package explorer if open</description>
</item>
<item title="Open the view from a perform when subitem">
<description>Uses perform when to open the view seleted previously.</description>
<subitem label="Perform when subitem" skip = "true">
<perform-when condition = "${result}">
<command when = "Package Explorer"
serialization="org.eclipse.jdt.ui.PackageExplorer"/>
<command when = "Search View"
serialization="org.eclipse.search.ui.views.SearchView"/>
</perform-when>
</subitem>
</item>
<item title="Close Views">
<description>Close the search view and package explorer if open</description>
</item>
<item title="Open the view from a conditional subitem">
<description>Uses perform when to open the view seleted previously.</description>
<conditional-subitem condition="${result}">
<subitem when="Package Explorer" label="Open package explorer.">
<command serialization = "org.eclipse.jdt.ui.PackageExplorer"/>
</subitem>
<subitem when="Search View" label="Open Search View">
<command serialization = "org.eclipse.search.ui.views.SearchView"/>
</subitem>
</conditional-subitem>
</item>
</cheatsheet>
</pre>
Copyright (c) 2004, 2007 IBM Corporation and others.<br>
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0 which accompanies
this distribution, and is available at <a href="https://www.eclipse.org/legal/epl-2.0">https://www.eclipse.org/legal/epl-v20.html</a>/
SPDX-License-Identifier: EPL-2.0