Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 34444 Details for
Bug 123921
document list of commands for use from UA document contexts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
update to draft document (ver 0.6)
EmbeddingCommands.html (text/html), 29.18 KB, created by
Christopher Daly
on 2006-02-09 15:15:26 EST
(
hide
)
Description:
update to draft document (ver 0.6)
Filename:
MIME Type:
Creator:
Christopher Daly
Created:
2006-02-09 15:15:26 EST
Size:
29.18 KB
patch
obsolete
><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ><html> ><head> > <meta content="text/html; charset=ISO-8859-1" > http-equiv="content-type"> > <title>Embedding Commands as Links</title> ></head> ><body> ><h1>Embedding Commands as Links</h1> >by Chris Daly (cjdaly@us.ibm.com)<br> >version 0.6 (9-Feb-2006)<br> ><br> ><br> >This document is meant to serve as a guide to authors of Help, >Cheatsheets, Intro and possibly other document types who would benefit >from the ability to embed commands in their documents as links. >The centerpiece of this document is a catalog of commands that are >thought to be useful in embedded document contexts. This document >is associated with <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=123921">bug 123921</a>.<br> ><br> ><h2>Background</h2> >A <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=120523">recent >enhancement</a> to the command framework allows commands and their >parameter values to be serialized as strings and later deserialized and >executed. This allows serialized commands to be embedded in >documents and visualized as links such that activating the link has the >effect of executing the embedded command.<br> ><br> ><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=121709">Another >enhancement</a> introduces the notion of typed command >parameters. Previously, parameter values were expressed as >strings throughout the lifecycle of command parameterization and >execution. Now command parameters can declare a type and the >parameter values can be handled as objects instead of strings. >This allows:<br> ><ul> > <li>object parameter values to be handled correctly by the >serialization/deserialization mechanism described above</li> > <li>multiple handlers of a command to convert string to object >parameter values in a consistent way</li> > <li>tooling to search for commands that operate on certain types of >objects</li> ></ul> >This work was done with the goal of allowing commands to be embedded as >links in the various types of User Assistance documents: Help, >Cheatsheets and Intro. The functionality may also be useful in >other contexts.<br> ><br> >Two additional things are required for the ability to embed commands in >documents to become a useful and used feature. First, we must >have a reasonably large "catalog" of commands that do >interesting/useful things when embedded in documents. Second, >each type of document must specify how commands may be embedded and its >supporting code must present the commands in some way that allows them >to be invoked by users (such as a clickable link). These topics >are explored in detail below.<br> ><br> ><h2>An Example<br> ></h2> >Below is an HTML document that represents a Help topic. The >JavaScript <span style="font-family: monospace;">executeCommand</span> >function takes a serialized command as its argument and executes the >command when the link is clicked. The serialized command text is >highlighted.<span style="font-style: italic;"></span><br> ><br> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span > style="font-family: monospace;"><!DOCTYPE HTML PUBLIC "-//W3C//DTD >HTML 4.0 Transitional//EN"><HTML></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"><HEAD></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"><TITLE></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;">Help Link Test</span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"></TITLE></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"><script >language="JavaScript" src="../../org.eclipse.help/livehelp.js"> ></script></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"></HEAD></span><br > style="font-family: monospace;"> > <br style="font-family: monospace;"> > <span style="font-family: monospace;"><body></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"><p>Execute command >link to</span><br style="font-family: monospace;"> > <span style="font-family: monospace;"><a >href='javascript:executeCommand(</span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> >"<span style="background-color: rgb(255, 153, 102);">org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.ui.views.TaskList)</span>")'></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> show >Tasks view</a>.</p></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"></body></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"></HTML></span><br> > </td> > </tr> > </tbody> ></table> ><br> ><br> ><h2>Catalog of Commands</h2> >What follows is a catalog of commands that may be useful in embedded >document scenarios. Some of these are available today and some >are not yet committed (indicated with [proposed] below). The >format of the tables below is:<br> ><br> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Command >Name</span> - brief description and mention of parameters<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">command.id(param.id=value)</span> >« <span style="font-style: italic;">example demonstrating usage</span><br> > </div> > </td> > </tr> > </tbody> ></table> ><br> >Please refer to the JavaDoc for <span style="font-family: monospace;">ParameterizedCommand.serialize()</span> >for a description of the command serialization format.<br> ><br> ><h3>General Workbench <small><small>(see bugs <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125632">125632</a>, ><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=126651">126651</a>)</small></small><br> ></h3> ><small> </small><small> </small> ><table style="text-align: left; width: 876px; height: 296px;" border="1" > cellpadding="2" cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Show >Perspective</span> - without parameters, opens a >dialog with list of perspectives<br> > </td> > </tr> > <tr style="font-family: monospace;"> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;">org.eclipse.ui.perspectives.showPerspective</div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Show >Perspective</span> - parameter >indicates perspective id<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><small><span > style="font-family: monospace;">org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.ui.resourcePerspective)</span> > </small></div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Show >View</span> - without parameters, opens a dialog with >list of views<br> > </td> > </tr> > <tr style="font-family: monospace;"> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;">org.eclipse.ui.views.showView</div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Show >View</span> - parameter indicates >view id</td> > </tr> > <tr style="font-family: monospace;"> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;">org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.ui.views.TaskList)</div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Window >Preferences</span> - parameter indicates which preference page (no >parameter means open the main page)<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.team.ui.TextPreferences)</span><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">New >Wizard</span> - parameter indicates id of wizard to launch (no >parameter opens chooser dialog)<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.newWizard(newWizardId=org.eclipse.pde.ui.NewProjectWizard)</span><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Import >Wizard</span> - parameter indicates id of wizard to launch (no >parameter opens chooser dialog)</td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><small><span > style="font-family: monospace;">org.eclipse.ui.file.import(importWizardId=org.eclipse.debug.internal.ui.importexport.breakpoints.WizardImportBreakpoints)</span></small><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Export >Wizard</span> - parameter indicates id of wizard to launch (no >parameter opens chooser dialog)</td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.file.export(exportWizardId=org.eclipse.jdt.internal.ui.jarpackager.JarPackageWizard)</span><br> > </div> > </td> > </tr> > </tbody> ></table> ><br> ><h3>Workspace <small><small>(see bug <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=126079">126079</a>)</small></small></h3> >Note: the examples below require resources to open/show. Simply >create a >new plugin called <span style="font-family: monospace;">org.test</span> >to try these examples. ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >File</span> - open a file given its path >as parameter, no parameter opens a dialog to help find a file<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.navigate.openResource(filePath=/org.test/build.properties)</span><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Show >Resource in Navigator</span> - show in Navigator view given >resource path as parameter</td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.navigate.showResourceByPath(resourcePath=/org.test/src/org)</span><br> > </div> > </td> > </tr> > </tbody> ></table> ><br> ><h3>User Assistance <small><small>(see bugs <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=123040">123040</a>, ><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125908">125908</a>, ><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=127031">127031</a>)</small></small><br> ></h3> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Display >Help</span> - without parameters, opens the help system<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.help.displayHelp</span><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Display >Help</span> - parameter indicates help topic href<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.help.displayHelp(href=/org.eclipse.platform.doc.user/gettingStarted/qs-02a.htm)</span><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >Cheatsheet by Id</span> - parameter indicates id of cheatsheet<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.cheatsheets.openCheatSheet(cheatSheetId=org.eclipse.jdt.helloworld)</span><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >Cheatsheet by URL</span> - parameter for URL to load cheatsheed >(additional parameters to give cheatsheet a name and id)<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><small><span > style="font-family: monospace;">org.eclipse.ui.cheatsheets.openCheatSheetURL(cheatSheetId=my.cheatsheet.id,name=Foo,url=file://some/file/cheatsheet.xml)</span></small><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >Intro Content</span> - no parameters, just opens the welcome front page<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.help.showIntro</span><br> > </div> > </td> > </tr> > </tbody> ></table> ><br> ><h3>Java <small><small>(see bug <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=123198">123198</a>)</small></small><br> ></h3> >Note: the examples below work on a class named <span > style="font-family: monospace;">Activator</span> in a plugin called <span > style="font-family: monospace;">org.test</span>. Simply create a >new plugin called <span style="font-family: monospace;">org.test</span> >to try these examples.<br> ><br> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >JavaElement in Editor</span> - parameter encodes handle identifier of >java element<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><small><span > style="font-family: monospace;">org.eclipse.jdt.ui.commands.openElementInEditor(elementRef=org.test/org.test.Activator)</span></small><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Show >JavaElement in Package Explorer View</span> - parameter encodes handle >identifier of java element</td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><small><span > style="font-family: monospace;">org.eclipse.jdt.ui.commands.showElementInPackageView(elementRef=org.test/org.test.Activator)</span></small><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Show >JavaElement in Type Hierarchy View</span> - parameter encodes handle >identifier of java element</td> > </tr> > <tr style="font-family: monospace;"> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><small>org.eclipse.jdt.ui.commands.showElementInTypeHierarchyView(elementRef=org.test/org.test.Activator)<br> > </small></div> > </td> > </tr> > </tbody> ></table> ><br> ><h3>Run/Debug</h3> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >Run Configuration Dialog</span> - no parameters<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.debug.ui.commands.OpenRunConfigurations</span><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >Debug Configuration Dialog</span> - no parameters<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.debug.ui.commands.OpenDebugConfigurations</span><br> > </div> > </td> > </tr> > </tbody> ></table> ><br> ><h3>Update Manager <small><small>(see bug <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125071">125071</a>)</small></small><br> ></h3> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >Manage Configuration Dialog</span> - opens the dialog for managing >product configuration (no parameters)<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.update.manageConfiguration</span><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >Install/Update Feature Dialog</span> - opens the dialog for installing >and updating features (no parameters)<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.update.findAndInstallUpdates</span><br> > </div> > </td> > </tr> > </tbody> ></table> ><br> ><h3>Browser <small><small>(see bug <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125795">125795</a>)</small></small><br> ></h3> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >URL in Browser</span> - parameters for URL, browserId, window name and >tooltip<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.browser.openBrowser(url=http://www.google.com)</span><br> > </div> > </td> > </tr> > </tbody> ></table> ><br> ><h3>Dialogs <small><small>(see bug <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=126993">126993</a>)</small></small></h3> >Note: these commands are in org.eclipse.ui.cheatsheets. They >could eventually be moved up to org.eclipse.ui.workbench.<br> ><table style="text-align: left; width: 100%;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >Input Dialog</span> - parameters for title, message, .... This >command returns the value typed by the user.<br> > </td> > </tr> > <tr> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><span > style="font-family: monospace;">org.eclipse.ui.dialogs.openInputDialog(title=MyMessage,message=Hello,initialValue=World)</span><br> > </div> > </td> > </tr> > <tr> > <td style="vertical-align: top;"><span style="font-weight: bold;">Open >Message Dialog</span> - parameters for title, message, button labels, >.... This command returns the label string of the clicked button.<br> > </td> > </tr> > <tr style="font-family: monospace;"> > <td style="vertical-align: top;"> > <div style="margin-left: 40px;"><small>org.eclipse.ui.dialogs.openMessageDialog(title=Hi,message=msg,buttonLabel0=YES,buttonLabel1=no,buttonLabel2=maYbe,defaultIndex=2,imageType=1)<br> > </small></div> > </td> > </tr> > </tbody> ></table> ><br> ><h2>Command Embedding Contexts</h2> ><h3>Help <small><small>(see bug <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=122726">122726</a>)</small></small><br> ></h3> >The example above shows how to embed commands in Help.<br> ><br> ><h3>Cheatsheets</h3> >Here's an example that shows how to embed commands in a Cheatsheet:<br> ><br> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span > style="font-family: monospace;"><?xml version="1.0" >encoding="UTF-8"?></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"><cheatsheet >title="Example of Commands"></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> <intro></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> ><description>A cheat sheet which tests command >support</description></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> </intro></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> <item title="Step >1"></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> ><description>This is a step with a command which shows the search >view.</description></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> ><command serialization="<span > style="background-color: rgb(255, 153, 102);">org.eclipse.search.ui.views.SearchView</span>"/> > </span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> </item></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> <item title="Step >2"></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> ><description>This is a step with a command and parameters, shows >package explorer.</description></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> ><command serialization="<span > style="background-color: rgb(255, 153, 102);">org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.jdt.ui.PackageExplorer)</span>"/></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> </item></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"></cheatsheet></span><br> > </td> > </tr> > </tbody> ></table> ><br> >Note also that bug <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125420">125420</a> >proposes an enhancement to declare command return types and bug <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125545">125545</a> >describes how return values can be captured to use later in >cheatsheets. The basic idea is to use the <span > style="font-family: monospace;">returns</span> attribute to identify >what key to use when storing the return value in the >ICheatSheetManager. Below is an example:<br> ><br> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span > style="font-family: monospace;"><?xml version="1.0" >encoding="UTF-8"?></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"><cheatsheet >title="Example of Commands 2"></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> <intro></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> ><description>Another cheat sheet which tests command >support</description></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> </intro></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> <item title="Step >1"></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> ><description>This is a step with a command which shows an input >dialog.</description></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> ><command<br> > <span > style="background-color: rgb(255, 153, 102);">returns="MyData"</span><br> > serialization="</span><span > style="font-family: monospace;">org.eclipse.ui.dialogs.openInputDialog(title=Hello,message=Input >Data</span><span style="font-family: monospace;">)"/><br> > <onCompletion><br> > Input value was ${MyData}<br> > </onCompletion><br > style="font-family: monospace;"> > </span> <span style="font-family: monospace;"> ></item></span><span style="font-family: monospace;"></span><span > style="font-family: monospace;"></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"></cheatsheet></span></td> > </tr> > </tbody> ></table> ><br> >In the above example a call to the <span > style="font-family: monospace;">ICheatSheetManager.setData(...)</span> >method will be made after the command completes with "MyData" as the <span > style="font-family: monospace;">key</span> parameter and the command >return value as the <span style="font-family: monospace;">data</span> >parameter. If the command declares a return type than the value >converter will be used to convert the object returned to a >string. Otherwise, if the command returns a string it will be >stored as-is and if the command doesn't return a string the return >value will be ignored.<br> ><br> ><h3>Intro <small><small>(see bugs <a > href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=124060">124060</a>, ><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=124076">124076</a>, ><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=124573">124573</a>)</small></small><br> ></h3> >Here's an example that shows how to embed commands in Intro content:<br> ><br> ><table style="width: 100%; text-align: left;" border="1" cellpadding="2" > cellspacing="2"> > <tbody> > <tr> > <td style="vertical-align: top;"><span > style="font-family: monospace;"><?xml version="1.0" >encoding="UTF-8" ?></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"><introContent></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> <!-- Extension to >the SDK What's New Page. --></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> <extensionContent >path="news/page-content/noteworthy-links/pdeAnchor"></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> <link >label="Test News1"</span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> >url="http://org.eclipse.ui.intro/execute?command=<span > style="background-color: rgb(255, 153, 102);">org.eclipse.ui.views.showView()</span>&amp;standby=true"</span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> >id="pde-noteworthy" style-id="noteworthy-link"></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> ><text>This is a test</text></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> ></link></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> <link >label="Test News2"</span><br style="font-family: monospace;"> > <span style="font-family: monospace;">url="http://org.eclipse.ui.intro/execute?command=<span > style="background-color: rgb(255, 153, 102);">org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId%3dorg.eclipse.jdt.ui.PackageExplorer)</span>&amp;standby=true"</span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> >id="pde-noteworthy" style-id="noteworthy-link"></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> ><text>This is another test</text></span><br > style="font-family: monospace;"> > <span style="font-family: monospace;"> ></link></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"> ></extensionContent></span><br style="font-family: monospace;"> > <span style="font-family: monospace;"></introContent></span><br> > </td> > </tr> > </tbody> ></table> ><br> ></body> ></html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Embedding Commands as Links</title> </head> <body> <h1>Embedding Commands as Links</h1> by Chris Daly (cjdaly@us.ibm.com)<br> version 0.6 (9-Feb-2006)<br> <br> <br> This document is meant to serve as a guide to authors of Help, Cheatsheets, Intro and possibly other document types who would benefit from the ability to embed commands in their documents as links. The centerpiece of this document is a catalog of commands that are thought to be useful in embedded document contexts. This document is associated with <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=123921">bug 123921</a>.<br> <br> <h2>Background</h2> A <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=120523">recent enhancement</a> to the command framework allows commands and their parameter values to be serialized as strings and later deserialized and executed. This allows serialized commands to be embedded in documents and visualized as links such that activating the link has the effect of executing the embedded command.<br> <br> <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=121709">Another enhancement</a> introduces the notion of typed command parameters. Previously, parameter values were expressed as strings throughout the lifecycle of command parameterization and execution. Now command parameters can declare a type and the parameter values can be handled as objects instead of strings. This allows:<br> <ul> <li>object parameter values to be handled correctly by the serialization/deserialization mechanism described above</li> <li>multiple handlers of a command to convert string to object parameter values in a consistent way</li> <li>tooling to search for commands that operate on certain types of objects</li> </ul> This work was done with the goal of allowing commands to be embedded as links in the various types of User Assistance documents: Help, Cheatsheets and Intro. The functionality may also be useful in other contexts.<br> <br> Two additional things are required for the ability to embed commands in documents to become a useful and used feature. First, we must have a reasonably large "catalog" of commands that do interesting/useful things when embedded in documents. Second, each type of document must specify how commands may be embedded and its supporting code must present the commands in some way that allows them to be invoked by users (such as a clickable link). These topics are explored in detail below.<br> <br> <h2>An Example<br> </h2> Below is an HTML document that represents a Help topic. The JavaScript <span style="font-family: monospace;">executeCommand</span> function takes a serialized command as its argument and executes the command when the link is clicked. The serialized command text is highlighted.<span style="font-style: italic;"></span><br> <br> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-family: monospace;"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML></span><br style="font-family: monospace;"> <span style="font-family: monospace;"><HEAD></span><br style="font-family: monospace;"> <span style="font-family: monospace;"><TITLE></span><br style="font-family: monospace;"> <span style="font-family: monospace;">Help Link Test</span><br style="font-family: monospace;"> <span style="font-family: monospace;"></TITLE></span><br style="font-family: monospace;"> <span style="font-family: monospace;"><script language="JavaScript" src="../../org.eclipse.help/livehelp.js"> </script></span><br style="font-family: monospace;"> <span style="font-family: monospace;"></HEAD></span><br style="font-family: monospace;"> <br style="font-family: monospace;"> <span style="font-family: monospace;"><body></span><br style="font-family: monospace;"> <span style="font-family: monospace;"><p>Execute command link to</span><br style="font-family: monospace;"> <span style="font-family: monospace;"><a href='javascript:executeCommand(</span><br style="font-family: monospace;"> <span style="font-family: monospace;"> "<span style="background-color: rgb(255, 153, 102);">org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.ui.views.TaskList)</span>")'></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> show Tasks view</a>.</p></span><br style="font-family: monospace;"> <span style="font-family: monospace;"></body></span><br style="font-family: monospace;"> <span style="font-family: monospace;"></HTML></span><br> </td> </tr> </tbody> </table> <br> <br> <h2>Catalog of Commands</h2> What follows is a catalog of commands that may be useful in embedded document scenarios. Some of these are available today and some are not yet committed (indicated with [proposed] below). The format of the tables below is:<br> <br> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Command Name</span> - brief description and mention of parameters<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">command.id(param.id=value)</span> « <span style="font-style: italic;">example demonstrating usage</span><br> </div> </td> </tr> </tbody> </table> <br> Please refer to the JavaDoc for <span style="font-family: monospace;">ParameterizedCommand.serialize()</span> for a description of the command serialization format.<br> <br> <h3>General Workbench <small><small>(see bugs <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125632">125632</a>, <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=126651">126651</a>)</small></small><br> </h3> <small> </small><small> </small> <table style="text-align: left; width: 876px; height: 296px;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Show Perspective</span> - without parameters, opens a dialog with list of perspectives<br> </td> </tr> <tr style="font-family: monospace;"> <td style="vertical-align: top;"> <div style="margin-left: 40px;">org.eclipse.ui.perspectives.showPerspective</div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Show Perspective</span> - parameter indicates perspective id<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><small><span style="font-family: monospace;">org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.ui.resourcePerspective)</span> </small></div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Show View</span> - without parameters, opens a dialog with list of views<br> </td> </tr> <tr style="font-family: monospace;"> <td style="vertical-align: top;"> <div style="margin-left: 40px;">org.eclipse.ui.views.showView</div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Show View</span> - parameter indicates view id</td> </tr> <tr style="font-family: monospace;"> <td style="vertical-align: top;"> <div style="margin-left: 40px;">org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.ui.views.TaskList)</div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Window Preferences</span> - parameter indicates which preference page (no parameter means open the main page)<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.team.ui.TextPreferences)</span><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">New Wizard</span> - parameter indicates id of wizard to launch (no parameter opens chooser dialog)<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.newWizard(newWizardId=org.eclipse.pde.ui.NewProjectWizard)</span><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Import Wizard</span> - parameter indicates id of wizard to launch (no parameter opens chooser dialog)</td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><small><span style="font-family: monospace;">org.eclipse.ui.file.import(importWizardId=org.eclipse.debug.internal.ui.importexport.breakpoints.WizardImportBreakpoints)</span></small><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Export Wizard</span> - parameter indicates id of wizard to launch (no parameter opens chooser dialog)</td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.file.export(exportWizardId=org.eclipse.jdt.internal.ui.jarpackager.JarPackageWizard)</span><br> </div> </td> </tr> </tbody> </table> <br> <h3>Workspace <small><small>(see bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=126079">126079</a>)</small></small></h3> Note: the examples below require resources to open/show. Simply create a new plugin called <span style="font-family: monospace;">org.test</span> to try these examples. <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open File</span> - open a file given its path as parameter, no parameter opens a dialog to help find a file<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.navigate.openResource(filePath=/org.test/build.properties)</span><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Show Resource in Navigator</span> - show in Navigator view given resource path as parameter</td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.navigate.showResourceByPath(resourcePath=/org.test/src/org)</span><br> </div> </td> </tr> </tbody> </table> <br> <h3>User Assistance <small><small>(see bugs <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=123040">123040</a>, <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125908">125908</a>, <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=127031">127031</a>)</small></small><br> </h3> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Display Help</span> - without parameters, opens the help system<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.help.displayHelp</span><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Display Help</span> - parameter indicates help topic href<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.help.displayHelp(href=/org.eclipse.platform.doc.user/gettingStarted/qs-02a.htm)</span><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open Cheatsheet by Id</span> - parameter indicates id of cheatsheet<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.cheatsheets.openCheatSheet(cheatSheetId=org.eclipse.jdt.helloworld)</span><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open Cheatsheet by URL</span> - parameter for URL to load cheatsheed (additional parameters to give cheatsheet a name and id)<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><small><span style="font-family: monospace;">org.eclipse.ui.cheatsheets.openCheatSheetURL(cheatSheetId=my.cheatsheet.id,name=Foo,url=file://some/file/cheatsheet.xml)</span></small><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open Intro Content</span> - no parameters, just opens the welcome front page<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.help.showIntro</span><br> </div> </td> </tr> </tbody> </table> <br> <h3>Java <small><small>(see bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=123198">123198</a>)</small></small><br> </h3> Note: the examples below work on a class named <span style="font-family: monospace;">Activator</span> in a plugin called <span style="font-family: monospace;">org.test</span>. Simply create a new plugin called <span style="font-family: monospace;">org.test</span> to try these examples.<br> <br> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open JavaElement in Editor</span> - parameter encodes handle identifier of java element<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><small><span style="font-family: monospace;">org.eclipse.jdt.ui.commands.openElementInEditor(elementRef=org.test/org.test.Activator)</span></small><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Show JavaElement in Package Explorer View</span> - parameter encodes handle identifier of java element</td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><small><span style="font-family: monospace;">org.eclipse.jdt.ui.commands.showElementInPackageView(elementRef=org.test/org.test.Activator)</span></small><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Show JavaElement in Type Hierarchy View</span> - parameter encodes handle identifier of java element</td> </tr> <tr style="font-family: monospace;"> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><small>org.eclipse.jdt.ui.commands.showElementInTypeHierarchyView(elementRef=org.test/org.test.Activator)<br> </small></div> </td> </tr> </tbody> </table> <br> <h3>Run/Debug</h3> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open Run Configuration Dialog</span> - no parameters<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.debug.ui.commands.OpenRunConfigurations</span><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open Debug Configuration Dialog</span> - no parameters<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.debug.ui.commands.OpenDebugConfigurations</span><br> </div> </td> </tr> </tbody> </table> <br> <h3>Update Manager <small><small>(see bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125071">125071</a>)</small></small><br> </h3> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open Manage Configuration Dialog</span> - opens the dialog for managing product configuration (no parameters)<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.update.manageConfiguration</span><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open Install/Update Feature Dialog</span> - opens the dialog for installing and updating features (no parameters)<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.update.findAndInstallUpdates</span><br> </div> </td> </tr> </tbody> </table> <br> <h3>Browser <small><small>(see bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125795">125795</a>)</small></small><br> </h3> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open URL in Browser</span> - parameters for URL, browserId, window name and tooltip<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.browser.openBrowser(url=http://www.google.com)</span><br> </div> </td> </tr> </tbody> </table> <br> <h3>Dialogs <small><small>(see bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=126993">126993</a>)</small></small></h3> Note: these commands are in org.eclipse.ui.cheatsheets. They could eventually be moved up to org.eclipse.ui.workbench.<br> <table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open Input Dialog</span> - parameters for title, message, .... This command returns the value typed by the user.<br> </td> </tr> <tr> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><span style="font-family: monospace;">org.eclipse.ui.dialogs.openInputDialog(title=MyMessage,message=Hello,initialValue=World)</span><br> </div> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">Open Message Dialog</span> - parameters for title, message, button labels, .... This command returns the label string of the clicked button.<br> </td> </tr> <tr style="font-family: monospace;"> <td style="vertical-align: top;"> <div style="margin-left: 40px;"><small>org.eclipse.ui.dialogs.openMessageDialog(title=Hi,message=msg,buttonLabel0=YES,buttonLabel1=no,buttonLabel2=maYbe,defaultIndex=2,imageType=1)<br> </small></div> </td> </tr> </tbody> </table> <br> <h2>Command Embedding Contexts</h2> <h3>Help <small><small>(see bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=122726">122726</a>)</small></small><br> </h3> The example above shows how to embed commands in Help.<br> <br> <h3>Cheatsheets</h3> Here's an example that shows how to embed commands in a Cheatsheet:<br> <br> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-family: monospace;"><?xml version="1.0" encoding="UTF-8"?></span><br style="font-family: monospace;"> <span style="font-family: monospace;"><cheatsheet title="Example of Commands"></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <intro></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <description>A cheat sheet which tests command support</description></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> </intro></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <item title="Step 1"></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <description>This is a step with a command which shows the search view.</description></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <command serialization="<span style="background-color: rgb(255, 153, 102);">org.eclipse.search.ui.views.SearchView</span>"/> </span><br style="font-family: monospace;"> <span style="font-family: monospace;"> </item></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <item title="Step 2"></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <description>This is a step with a command and parameters, shows package explorer.</description></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <command serialization="<span style="background-color: rgb(255, 153, 102);">org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.jdt.ui.PackageExplorer)</span>"/></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> </item></span><br style="font-family: monospace;"> <span style="font-family: monospace;"></cheatsheet></span><br> </td> </tr> </tbody> </table> <br> Note also that bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125420">125420</a> proposes an enhancement to declare command return types and bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=125545">125545</a> describes how return values can be captured to use later in cheatsheets. The basic idea is to use the <span style="font-family: monospace;">returns</span> attribute to identify what key to use when storing the return value in the ICheatSheetManager. Below is an example:<br> <br> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-family: monospace;"><?xml version="1.0" encoding="UTF-8"?></span><br style="font-family: monospace;"> <span style="font-family: monospace;"><cheatsheet title="Example of Commands 2"></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <intro></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <description>Another cheat sheet which tests command support</description></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> </intro></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <item title="Step 1"></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <description>This is a step with a command which shows an input dialog.</description></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <command<br> <span style="background-color: rgb(255, 153, 102);">returns="MyData"</span><br> serialization="</span><span style="font-family: monospace;">org.eclipse.ui.dialogs.openInputDialog(title=Hello,message=Input Data</span><span style="font-family: monospace;">)"/><br> <onCompletion><br> Input value was ${MyData}<br> </onCompletion><br style="font-family: monospace;"> </span> <span style="font-family: monospace;"> </item></span><span style="font-family: monospace;"></span><span style="font-family: monospace;"></span><br style="font-family: monospace;"> <span style="font-family: monospace;"></cheatsheet></span></td> </tr> </tbody> </table> <br> In the above example a call to the <span style="font-family: monospace;">ICheatSheetManager.setData(...)</span> method will be made after the command completes with "MyData" as the <span style="font-family: monospace;">key</span> parameter and the command return value as the <span style="font-family: monospace;">data</span> parameter. If the command declares a return type than the value converter will be used to convert the object returned to a string. Otherwise, if the command returns a string it will be stored as-is and if the command doesn't return a string the return value will be ignored.<br> <br> <h3>Intro <small><small>(see bugs <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=124060">124060</a>, <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=124076">124076</a>, <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=124573">124573</a>)</small></small><br> </h3> Here's an example that shows how to embed commands in Intro content:<br> <br> <table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><span style="font-family: monospace;"><?xml version="1.0" encoding="UTF-8" ?></span><br style="font-family: monospace;"> <span style="font-family: monospace;"><introContent></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <!-- Extension to the SDK What's New Page. --></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <extensionContent path="news/page-content/noteworthy-links/pdeAnchor"></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <link label="Test News1"</span><br style="font-family: monospace;"> <span style="font-family: monospace;"> url="http://org.eclipse.ui.intro/execute?command=<span style="background-color: rgb(255, 153, 102);">org.eclipse.ui.views.showView()</span>&amp;standby=true"</span><br style="font-family: monospace;"> <span style="font-family: monospace;"> id="pde-noteworthy" style-id="noteworthy-link"></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <text>This is a test</text></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> </link></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <link label="Test News2"</span><br style="font-family: monospace;"> <span style="font-family: monospace;">url="http://org.eclipse.ui.intro/execute?command=<span style="background-color: rgb(255, 153, 102);">org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId%3dorg.eclipse.jdt.ui.PackageExplorer)</span>&amp;standby=true"</span><br style="font-family: monospace;"> <span style="font-family: monospace;"> id="pde-noteworthy" style-id="noteworthy-link"></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> <text>This is another test</text></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> </link></span><br style="font-family: monospace;"> <span style="font-family: monospace;"> </extensionContent></span><br style="font-family: monospace;"> <span style="font-family: monospace;"></introContent></span><br> </td> </tr> </tbody> </table> <br> </body> </html>
View Attachment As Raw
Actions:
View
Attachments on
bug 123921
:
33044
|
33132
|
33685
|
33881
|
34409
| 34444 |
34981
|
35216