Jump to: navigation, search

Difference between revisions of "Table of WTP IDs"

(Introduction)
(Menus)
 
(22 intermediate revisions by 5 users not shown)
Line 2: Line 2:
 
There are a vast number of ids that are used within the WTP.  Every command, content-type, action, menu, etc has an id that is associated with it.  This page will try to keep up to date with the various ids, where they can be found, and what they correspond too.
 
There are a vast number of ids that are used within the WTP.  Every command, content-type, action, menu, etc has an id that is associated with it.  This page will try to keep up to date with the various ids, where they can be found, and what they correspond too.
  
It is important to document the usage of the ids, especially when they relate to menus, toolbars, commands, and popus as the org.eclipse.ui.menus extension point allows for other plugins to contribute to menus based off the ids that are published.  Commands are also referenced by id, and are implemented based on handlers.
+
It is important to document the usage of the ids, especially when they relate to menus, toolbars, commands, and popups as the org.eclipse.ui.menus extension point allows for other plugins to contribute to menus based off the ids that are published.  Commands are also referenced by id, and are implemented based on handlers.
  
Eclipse 3.3 introduced the org.eclipse.ui.menus extension point, this is to eventually replace the 4 contribution points that exist currently for creating menus.  A detailed mapping can be found at [[Menus_Extension_Mapping]].  Paul Webb has created a good overview of the new org.eclipse.ui.menus extension point in his [http://richclientplatform.blogspot.com/2007/07/new-menu-contribution-extension.html blog].
+
Eclipse 3.3 introduced the org.eclipse.ui.menus extension point, this is to eventually replace the 4 contribution points that exist currently for creating menus.  A detailed mapping can be found at [[Menus Extension Mapping]].  Paul Webster has created a good overview of the new org.eclipse.ui.menus extension point in his [http://richclientplatform.blogspot.com/2007/07/new-menu-contribution-extension.html blog].
  
The [[Platform_Command_Framework]] contains information on how to debug handlers and commands that aren't working.
+
The [[Platform Command Framework]] contains information on how to debug handlers and commands that aren't working.
  
==Menus==
+
== Menus ==
The org.eclipse.ui.menus extension point allows for the definition of menus that other plugins can contribute too.  See [[Menu_Contributions]] and [http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench_cmd.htm Basic Workbench Extensions using Commands] for more information specifically for working with org.eclipse.ui.menus, org.eclipse.ui.commands, and org.eclipse.ui.handlers ([[Platform_Command_Framework]]).
+
  
In addition, controlling when a menu or command is available can be implemented with [[Command_Core_Expressions]].
+
The org.eclipse.ui.menus extension point allows for the definition of menus that other plugins can contribute too. See [[Menu Contributions]] and [http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench_cmd.htm Basic Workbench Extensions using Commands] for more information specifically for working with org.eclipse.ui.menus, org.eclipse.ui.commands, and org.eclipse.ui.handlers ([[Platform Command Framework]]).  
  
<table border="1">
+
In addition, controlling when a menu or command is available can be implemented with [[Command Core Expressions]].  
<tr>
+
  <td><b>Id</b></td>
+
  <td><b>Name</b></td>
+
  <td><b>Location</b></td>
+
  <td><b>Type</b></td>
+
  <td><b>Description</b></td>
+
</tr>
+
<tr>
+
  <td>sourceMenuId</td>
+
  <td>Source</td>
+
  <td>SSE.ui/plugin.xml</td>
+
  <td>Main Menu</td>
+
  <td>A general source main menu that can be contributed to from other plugins.</td>
+
</tr>
+
</table>
+
  
==Commands==
+
{| border="1"
 +
|+ Common Eclipse Menu Ids
 +
|-
 +
| '''Id'''
 +
| '''Name'''
 +
| '''Location'''
 +
| '''Type'''
 +
| '''Description'''
 +
|-
 +
| file
 +
| File
 +
| platform
 +
| Main Menu
 +
| Standard platform File Menu
 +
|-
 +
| edit
 +
| Edit
 +
| platform
 +
| Main Menu
 +
| Standard Edit Menu
 +
|-
 +
| navigate
 +
| Navigate
 +
| platform
 +
| Main Menu
 +
| Navigation Menu
 +
|-
 +
| project
 +
| Project
 +
| platform
 +
| Main Menu
 +
| Project Menu
 +
|-
 +
| window
 +
| Window
 +
| platform
 +
| Main Menu
 +
| Standard Window Menu
 +
|-
 +
| help
 +
| Help
 +
| platform
 +
| Main Menu
 +
| Standard Help Menu
 +
|-
 +
| org.eclipse.search.menu
 +
| Search
 +
| platform
 +
| Main Menu
 +
| Standard search menu
 +
|}
  
Commands are implemented and tied to menus using handlers.  They can also be tied to actionSets and have action Delgates.   If implemented using handlers, a command may have zero to many handlers, but only zero to one may be active at any given point in time.  Handlers can be specified using either the org.eclipse.ui.handlers extension point or programtically.
+
<br>
 +
 
 +
{| border="1"
 +
|+ Structured Text Editor Menu Ids
 +
|-
 +
| '''Id'''
 +
| '''Name'''
 +
| '''Location'''
 +
| '''Type'''
 +
| '''Description'''
 +
|-
 +
| sourceMenuId
 +
| Source
 +
| sse.ui/plugin.xml
 +
| Main Menu
 +
| A general source main menu that can be contributed to from other plug-ins.
 +
|-
 +
| org.eclipse.wst.sse.ui.StructuredTextEditor.EditorContext
 +
| N/A
 +
| sse.ui.StructuredTextEditor
 +
| Popup Menu
 +
| The popup menu for all source editors
 +
|-
 +
| sourcePopupMenuId
 +
| Source
 +
| sse.ui.StructuredTextEditor
 +
| Popup Menu
 +
| The Source submenu within the popup menu for all source editors that can be contributed to from other plug-ins.
 +
|-
 +
| refactorPopupMenuId
 +
| Refactor
 +
| sse.ui.StructuredTextEditor
 +
| Popup Menu
 +
| The Refactor submenu within the popup menu for all source editors that can be contributed to from other plug-ins.
 +
|-
 +
| sourceMenuId
 +
| Source
 +
| SSE.ui/plugin.xml
 +
| Popup Menu
 +
| A Source submenu that can appear within a popup menu for all files in the Navigator/Project Explorer.
 +
|-
 +
| refactorMenuId
 +
| Refactor
 +
| SSE.ui/plugin.xml
 +
| Main Menu
 +
| A general refactor main menu that can be contributed to from other plug-ins.
 +
|-
 +
| org.eclipse.wst.xml.ui.editor
 +
| Editor Menu
 +
| XML.ui.XMLMultiPageEditorPart
 +
| Popup Menu
 +
| The editor menu for the design page of the XML Editor.
 +
|-
 +
| generateMenuId
 +
| Generate
 +
| XML.ui/plugin.xml
 +
| Popup Menu
 +
| A Generate submenu that can appear within a popup menu for all files in the Navigator/Project Explorer.
 +
|}
 +
 
 +
A list of additional Structured Text Editor menu Ids and the format of the ids can be found on the [http://www.eclipse.org/webtools/wst/components/sse/overview.html Structured Source Editing Component] page.
 +
 
 +
==Commands==
 +
Commands are implemented and tied to menus using handlers.  They can also be tied to actionSets and have actionDelegates. If implemented using handlers, a command may have zero to many handlers, but only zero to one may be active at any given point in time.  Handlers can be specified using either the org.eclipse.ui.handlers extension point or programmatically.
  
 
<table border="1">
 
<table border="1">
Line 127: Line 224:
 
   <td>SSE.ui/plugin.xml</td>
 
   <td>SSE.ui/plugin.xml</td>
 
   <td>Find Occurrences</td>
 
   <td>Find Occurrences</td>
 +
</tr>
 +
 +
<tr>
 +
  <td>org.eclipse.wst.sse.ui.goto.matching.bracket</td>
 +
  <td>org.eclipse.ui.category.edit</td>
 +
  <td>Navigate</td>
 +
  <td>SSE.ui/plugin.xml</td>
 +
  <td>Go To Matching Bracket</td>
 +
</tr>
 +
<tr>
 +
  <td>org.eclipse.wst.xml.ui.nextSibling</td>
 +
  <td>org.eclipse.ui.category.edit</td>
 +
  <td>Navigate</td>
 +
  <td>XML.ui/plugin.xml</td>
 +
  <td>Go To Next Sibling</td>
 +
</tr>
 +
<tr>
 +
  <td>org.eclipse.wst.xml.ui.previousSibling</td>
 +
  <td>org.eclipse.ui.category.edit</td>
 +
  <td>Navigate</td>
 +
  <td>XML.ui/plugin.xml</td>
 +
  <td>Go To Previous Sibling</td>
 +
</tr>
 +
<tr>
 +
  <td>org.eclipse.wst.xml.ui.gotoMatchingTag</td>
 +
  <td>org.eclipse.ui.category.edit</td>
 +
  <td>Navigate</td>
 +
  <td>XML.ui/plugin.xml</td>
 +
  <td>Go To Matching Tag</td>
 +
</tr>
 +
<tr>
 +
  <td>org.eclipse.jst.jsp.ui.refactor.rename</td>
 +
  <td>org.eclipse.ui.category.edit</td>
 +
  <td>Refactor</td>
 +
  <td>JSP.ui/plugin.xml</td>
 +
  <td>Rename a Java Element</td>
 +
</tr>
 +
<tr>
 +
  <td>org.eclipse.jst.jsp.ui.refactor.move</td>
 +
  <td>org.eclipse.ui.category.edit</td>
 +
  <td>Refactor</td>
 +
  <td>JSP.ui/plugin.xml</td>
 +
  <td>Move a Java Element to another package</td>
 
</tr>
 
</tr>
 
</table>
 
</table>
 +
 +
==Context IDs==
 +
 +
Used to indicate when particular contexts are active.
 +
 +
Each context is defined by the extension point org.eclipse.ui.contexts.
 +
 +
<table border="1">
 +
<tr>
 +
  <td><b>Id</b></td>
 +
  <td><b>Name</b></td>
 +
  <td><b>Location</b></td>
 +
  <td><b>Type</b></td>
 +
  <td><b>Description</b></td>
 +
</tr>
 +
<tr>
 +
  <td>org.eclipse.wst.sse.ui.structuredTextEditorScope</td>
 +
  <td>Editing in Structured Text Editors</td>
 +
  <td>SSE.ui/plugin.xml</td>
 +
  <td>Context</td>
 +
  <td>Context for when the Structured Text Editor is being used as one of the editors.  Commands should use this to determine when they are active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.core.runtime.xml</td>
 +
<td>Editing XML Source</td>
 +
<td>XML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>Context for when the XML Source editor is being used.  Commands should use this when the XML-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.xml.navigation</td>
 +
<td>XML Source Navigation</td>
 +
<td>XML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>This context should be used to determine when XML-contributed Navigation commands should be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.xml.cleanup</td>
 +
<td>XML Source Cleanup</td>
 +
<td>XML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>This context should be used to determine when the XML-contributed Cleanup handler should be active or enabled.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.xml.comments</td>
 +
<td>XML Source Comments</td>
 +
<td>XML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>This context should be used to determine when the XML-contributed Comment commands should be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.xml.selection</td>
 +
<td>XML Source Selection</td>
 +
<td>XML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>This context should be used to determine when the XML-contributed Selection handlers should be active or enabled.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.xml.dependencies</td>
 +
<td>XML Source Dependencies</td>
 +
<td>XML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>This context should be used to determine when the XML-contributed Dependency commands should be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.xml.grammar</td>
 +
<td>XML Source Grammar</td>
 +
<td>XML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>This context should be used to determine when the XML-contributed Grammar Constraints commands should be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.xml.expand</td>
 +
<td>XML Source Expand/Collapse</td>
 +
<td>XML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>This context should be used to determine when the XML-contributed Expand/Collapse commands should be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.xml.occurrences</td>
 +
<td>XML Source Occurrences</td>
 +
<td>XML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>This context should be used to determine when the XML-contributed Find Occurrences handler should be active or enabled.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.html.core.htmlsource</td>
 +
<td>Editing HTML Source</td>
 +
<td>HTML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>Context for when the HTML Source editor is being used.  Commands should use this when the HTML-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.html.occurrences</td>
 +
<td>HTML Source Occurrences</td>
 +
<td>HTML.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>This context should be used to determine when the HTML-contributed Find Occurrences handler should be active or enabled.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope</td>
 +
<td>Editing JSP Source</td>
 +
<td>JSP.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>Context for when the JSP Source editor is being used.  Commands should use this when the JSP-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.jst.jsp.core.jspsource</td>
 +
<td>Editing JSP Source</td>
 +
<td>JSP.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>Context for when the JSP Source editor is being used.  Commands should use this when the JSP-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
<tr>
 +
<td>org.eclipse.wst.css.core.csssource</td>
 +
<td>Editing CSS Source</td>
 +
<td>CSS.ui/plugin.xml</td>
 +
<td>Context</td>
 +
<td>Context for when the CSS Source editor is being used.  Commands should use this when the CSS-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.</td>
 +
</tr>
 +
</table>
 +
 +
=Bugs=
 +
 +
The following outstanding issues need to be addressed to allow complete conversion to the new org.eclipse.ui.menus extension point:
 +
 +
{{bug|213385}} - The search menu in the platform uses actionSets which aren't extensible by the org.eclipse.ui.menus extension.
 +
 +
=Core Command Expressions=
 +
Commands, Handlers, and Menu contributions are all driven by Core Command Expressions.  These allow for control of when a particular command is available in a menu, when it is active, and when it is enabled.  The following are some brief examples for controlling when commands are made available based on the type of variable involved.
 +
 +
==activeContexts==
 +
The activeContexts variable returns a list of all the activeContextsIDs
 +
 +
<source lang="xml">
 +
<menuContribution locationURI="menu:sourceMenuId?after=additions">
 +
  <command commandId="org.eclipse.wst.xml.ui.command1" id="Test" style="push">
 +
      <visibleWhen checkEnabled="false">
 +
        <with variable="activeContexts">
 +
            <iterate operator="or">
 +
                <equals value="org.eclipse.wst.sse.ui.structuredTextEditorScope"/>
 +
            </iterate>
 +
        </with>
 +
      </visibleWhen>
 +
  </command>
 +
</menuContribution>
 +
</source>
 +
 +
This will only enable the command, when the '''org.eclipse.wst.sse.ui.structuredTextEditorScope''' is one of the active contexts.  Otherwise, the command will not be shown in the menu.
 +
 +
==Activating Contexts==
 +
The activeContexts variable is responsible for controlling when many of the commands are available, active, or enabled.  Just defining the context using the org.eclipse.ui.contexts, however, is not enough.
 +
Each context must be activated for the editor using the <code>provisionalDefinition</code> of the extension point org.eclipse.wst.sse.ui.editorConfiguration.  For more information on the editor configuration extension point, please refer to the document [http://www.eclipse.org/webtools/wst/components/sse/designs/EditorConfiguration.html here].  The <code>type</code> attribute will be "activecontexts", and the
 +
<code>target</code> attribute should be the content type id of the editor for which the contexts are being activated.
 +
 +
The final attribute that needs to be defined is <code>value</code>.  This attribute is a comma-separated list of contexts that should be activated for the editor.  Through this attribute, the editor is also able to inherit handlers defined
 +
by other editors.  The example below is the "activecontexts" definition for the HTML editor where contexts like <b>org.eclipse.wst.xml.navigation</b> are declared to enable XML navigation handlers like Go To Next Sibling
 +
without the HTML editor having to define its own handler for the command.
 +
 +
<b>Note:</b> Declaring contexts that activate different handlers for the same command can result in undesired behavior.
 +
 +
<source lang="xml">
 +
<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
 +
...
 +
<provisionalDefinition
 +
type="activecontexts"
 +
value="org.eclipse.wst.html.core.htmlsource, org.eclipse.wst.html.occurrences, org.eclipse.core.runtime.xml, org.eclipse.wst.xml.navigation, org.eclipse.wst.xml.comments, org.eclipse.wst.xml.selection"
 +
target="org.eclipse.wst.html.core.htmlsource" />
 +
...
 +
</extension>
 +
</source>
 +
 +
=Migration Notes=
 +
Here are some migration tips and notes if you contributed to source editor menus prior to WTP 3.0 M6.
 +
 +
<table border="1">
 +
<caption>Source Editor Menu Paths</caption>
 +
<tr>
 +
  <td><b>Old Menu Path</b></td>
 +
  <td><b>New Menu Path</b></td>
 +
  <td><b>Additional Notes</b></td>
 +
</tr>
 +
<tr>
 +
  <td>generateXMLArtifacts/xml</td>
 +
  <td>generateMenuId/GenerateXML</td>
 +
  <td>GenerateXML is currently the id of a command inside the Generate menu. This may be changed later so that a separator id is used instead of a command id.</td>
 +
</tr>
 +
<tr>
 +
  <td>source/sourceGroup</td>
 +
  <td>sourceMenuId/sourceFormat</td>
 +
  <td>sourceFormat is currently the id of a command inside the Source menu. This may be changed later so that a separator id is used instead of a command id.</td>
 +
</tr>
 +
</table>
 +
 +
[[Category:Eclipse Web Tools Platform Project]]
 +
[[Category:IDs]]

Latest revision as of 15:59, 18 October 2010

Introduction

There are a vast number of ids that are used within the WTP. Every command, content-type, action, menu, etc has an id that is associated with it. This page will try to keep up to date with the various ids, where they can be found, and what they correspond too.

It is important to document the usage of the ids, especially when they relate to menus, toolbars, commands, and popups as the org.eclipse.ui.menus extension point allows for other plugins to contribute to menus based off the ids that are published. Commands are also referenced by id, and are implemented based on handlers.

Eclipse 3.3 introduced the org.eclipse.ui.menus extension point, this is to eventually replace the 4 contribution points that exist currently for creating menus. A detailed mapping can be found at Menus Extension Mapping. Paul Webster has created a good overview of the new org.eclipse.ui.menus extension point in his blog.

The Platform Command Framework contains information on how to debug handlers and commands that aren't working.

Menus

The org.eclipse.ui.menus extension point allows for the definition of menus that other plugins can contribute too. See Menu Contributions and Basic Workbench Extensions using Commands for more information specifically for working with org.eclipse.ui.menus, org.eclipse.ui.commands, and org.eclipse.ui.handlers (Platform Command Framework).

In addition, controlling when a menu or command is available can be implemented with Command Core Expressions.

Common Eclipse Menu Ids
Id Name Location Type Description
file File platform Main Menu Standard platform File Menu
edit Edit platform Main Menu Standard Edit Menu
navigate Navigate platform Main Menu Navigation Menu
project Project platform Main Menu Project Menu
window Window platform Main Menu Standard Window Menu
help Help platform Main Menu Standard Help Menu
org.eclipse.search.menu Search platform Main Menu Standard search menu


Structured Text Editor Menu Ids
Id Name Location Type Description
sourceMenuId Source sse.ui/plugin.xml Main Menu A general source main menu that can be contributed to from other plug-ins.
org.eclipse.wst.sse.ui.StructuredTextEditor.EditorContext N/A sse.ui.StructuredTextEditor Popup Menu The popup menu for all source editors
sourcePopupMenuId Source sse.ui.StructuredTextEditor Popup Menu The Source submenu within the popup menu for all source editors that can be contributed to from other plug-ins.
refactorPopupMenuId Refactor sse.ui.StructuredTextEditor Popup Menu The Refactor submenu within the popup menu for all source editors that can be contributed to from other plug-ins.
sourceMenuId Source SSE.ui/plugin.xml Popup Menu A Source submenu that can appear within a popup menu for all files in the Navigator/Project Explorer.
refactorMenuId Refactor SSE.ui/plugin.xml Main Menu A general refactor main menu that can be contributed to from other plug-ins.
org.eclipse.wst.xml.ui.editor Editor Menu XML.ui.XMLMultiPageEditorPart Popup Menu The editor menu for the design page of the XML Editor.
generateMenuId Generate XML.ui/plugin.xml Popup Menu A Generate submenu that can appear within a popup menu for all files in the Navigator/Project Explorer.

A list of additional Structured Text Editor menu Ids and the format of the ids can be found on the Structured Source Editing Component page.

Commands

Commands are implemented and tied to menus using handlers. They can also be tied to actionSets and have actionDelegates. If implemented using handlers, a command may have zero to many handlers, but only zero to one may be active at any given point in time. Handlers can be specified using either the org.eclipse.ui.handlers extension point or programmatically.

Id Category Id Menu/Toolbar Location Description
org.eclipse.wst.sse.ui.structure.select.enclosing org.eclipse.ui.category.edit Edit SSE.ui/plugin.xml Select Enclosing
org.eclipse.wst.sse.ui.structure.select.next org.eclipse.ui.category.edit Edit SSE.ui/plugin.xml Select Next
org.eclipse.wst.sse.ui.structure.select.previous org.eclipse.ui.category.edit Edit SSE.ui/plugin.xml Select Previous
org.eclipse.wst.sse.ui.structure.select.last org.eclipse.ui.category.edit Edit SSE.ui/plugin.xml Select Last
org.eclipse.wst.sse.ui.toggle.comment org.eclipse.ui.category.edit Source SSE.ui/plugin.xml Toggle Comment
org.eclipse.wst.sse.ui.add.block.comment org.eclipse.ui.category.edit Source SSE.ui/plugin.xml Add Block Comment
org.eclipse.wst.sse.ui.remove.block.comment org.eclipse.ui.category.edit Source SSE.ui/plugin.xml Remove Block Comment
org.eclipse.wst.sse.ui.cleanup.document org.eclipse.ui.category.edit Source SSE.ui/plugin.xml Cleanup Document
org.eclipse.wst.sse.ui.format.document org.eclipse.ui.category.edit Source SSE.ui/plugin.xml Format Document
org.eclipse.wst.sse.ui.format.active.elements org.eclipse.ui.category.edit Source SSE.ui/plugin.xml Format Active Elements
org.eclipse.wst.sse.ui.open.file.from.source org.eclipse.ui.category.edit Navigate SSE.ui/plugin.xml Open File From Source
org.eclipse.wst.sse.ui.search.find.occurrences org.eclipse.ui.category.edit Source SSE.ui/plugin.xml Find Occurrences
org.eclipse.wst.sse.ui.goto.matching.bracket org.eclipse.ui.category.edit Navigate SSE.ui/plugin.xml Go To Matching Bracket
org.eclipse.wst.xml.ui.nextSibling org.eclipse.ui.category.edit Navigate XML.ui/plugin.xml Go To Next Sibling
org.eclipse.wst.xml.ui.previousSibling org.eclipse.ui.category.edit Navigate XML.ui/plugin.xml Go To Previous Sibling
org.eclipse.wst.xml.ui.gotoMatchingTag org.eclipse.ui.category.edit Navigate XML.ui/plugin.xml Go To Matching Tag
org.eclipse.jst.jsp.ui.refactor.rename org.eclipse.ui.category.edit Refactor JSP.ui/plugin.xml Rename a Java Element
org.eclipse.jst.jsp.ui.refactor.move org.eclipse.ui.category.edit Refactor JSP.ui/plugin.xml Move a Java Element to another package

Context IDs

Used to indicate when particular contexts are active.

Each context is defined by the extension point org.eclipse.ui.contexts.

Id Name Location Type Description
org.eclipse.wst.sse.ui.structuredTextEditorScope Editing in Structured Text Editors SSE.ui/plugin.xml Context Context for when the Structured Text Editor is being used as one of the editors. Commands should use this to determine when they are active, enabled, and/or visible on a menu or toolbar.
org.eclipse.core.runtime.xml Editing XML Source XML.ui/plugin.xml Context Context for when the XML Source editor is being used. Commands should use this when the XML-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.
org.eclipse.wst.xml.navigation XML Source Navigation XML.ui/plugin.xml Context This context should be used to determine when XML-contributed Navigation commands should be active, enabled, and/or visible on a menu or toolbar.
org.eclipse.wst.xml.cleanup XML Source Cleanup XML.ui/plugin.xml Context This context should be used to determine when the XML-contributed Cleanup handler should be active or enabled.
org.eclipse.wst.xml.comments XML Source Comments XML.ui/plugin.xml Context This context should be used to determine when the XML-contributed Comment commands should be active, enabled, and/or visible on a menu or toolbar.
org.eclipse.wst.xml.selection XML Source Selection XML.ui/plugin.xml Context This context should be used to determine when the XML-contributed Selection handlers should be active or enabled.
org.eclipse.wst.xml.dependencies XML Source Dependencies XML.ui/plugin.xml Context This context should be used to determine when the XML-contributed Dependency commands should be active, enabled, and/or visible on a menu or toolbar.
org.eclipse.wst.xml.grammar XML Source Grammar XML.ui/plugin.xml Context This context should be used to determine when the XML-contributed Grammar Constraints commands should be active, enabled, and/or visible on a menu or toolbar.
org.eclipse.wst.xml.expand XML Source Expand/Collapse XML.ui/plugin.xml Context This context should be used to determine when the XML-contributed Expand/Collapse commands should be active, enabled, and/or visible on a menu or toolbar.
org.eclipse.wst.xml.occurrences XML Source Occurrences XML.ui/plugin.xml Context This context should be used to determine when the XML-contributed Find Occurrences handler should be active or enabled.
org.eclipse.wst.html.core.htmlsource Editing HTML Source HTML.ui/plugin.xml Context Context for when the HTML Source editor is being used. Commands should use this when the HTML-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.
org.eclipse.wst.html.occurrences HTML Source Occurrences HTML.ui/plugin.xml Context This context should be used to determine when the HTML-contributed Find Occurrences handler should be active or enabled.
org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope Editing JSP Source JSP.ui/plugin.xml Context Context for when the JSP Source editor is being used. Commands should use this when the JSP-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.
org.eclipse.jst.jsp.core.jspsource Editing JSP Source JSP.ui/plugin.xml Context Context for when the JSP Source editor is being used. Commands should use this when the JSP-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.
org.eclipse.wst.css.core.csssource Editing CSS Source CSS.ui/plugin.xml Context Context for when the CSS Source editor is being used. Commands should use this when the CSS-contributed handler will always be used, and to determine when they will be active, enabled, and/or visible on a menu or toolbar.

Bugs

The following outstanding issues need to be addressed to allow complete conversion to the new org.eclipse.ui.menus extension point:

bug 213385 - The search menu in the platform uses actionSets which aren't extensible by the org.eclipse.ui.menus extension.

Core Command Expressions

Commands, Handlers, and Menu contributions are all driven by Core Command Expressions. These allow for control of when a particular command is available in a menu, when it is active, and when it is enabled. The following are some brief examples for controlling when commands are made available based on the type of variable involved.

activeContexts

The activeContexts variable returns a list of all the activeContextsIDs

<menuContribution locationURI="menu:sourceMenuId?after=additions">
   <command commandId="org.eclipse.wst.xml.ui.command1" id="Test" style="push">
      <visibleWhen checkEnabled="false">
         <with variable="activeContexts">
             <iterate operator="or">
                 <equals value="org.eclipse.wst.sse.ui.structuredTextEditorScope"/>
             </iterate>
         </with>
      </visibleWhen>
   </command>
</menuContribution>

This will only enable the command, when the org.eclipse.wst.sse.ui.structuredTextEditorScope is one of the active contexts. Otherwise, the command will not be shown in the menu.

Activating Contexts

The activeContexts variable is responsible for controlling when many of the commands are available, active, or enabled. Just defining the context using the org.eclipse.ui.contexts, however, is not enough. Each context must be activated for the editor using the provisionalDefinition of the extension point org.eclipse.wst.sse.ui.editorConfiguration. For more information on the editor configuration extension point, please refer to the document here. The type attribute will be "activecontexts", and the target attribute should be the content type id of the editor for which the contexts are being activated.

The final attribute that needs to be defined is value. This attribute is a comma-separated list of contexts that should be activated for the editor. Through this attribute, the editor is also able to inherit handlers defined by other editors. The example below is the "activecontexts" definition for the HTML editor where contexts like org.eclipse.wst.xml.navigation are declared to enable XML navigation handlers like Go To Next Sibling without the HTML editor having to define its own handler for the command.

Note: Declaring contexts that activate different handlers for the same command can result in undesired behavior.

<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
	...
	<provisionalDefinition
		type="activecontexts"
		value="org.eclipse.wst.html.core.htmlsource, org.eclipse.wst.html.occurrences, org.eclipse.core.runtime.xml, org.eclipse.wst.xml.navigation, org.eclipse.wst.xml.comments, org.eclipse.wst.xml.selection"
		target="org.eclipse.wst.html.core.htmlsource" />
	...
</extension>

Migration Notes

Here are some migration tips and notes if you contributed to source editor menus prior to WTP 3.0 M6.

Source Editor Menu Paths
Old Menu Path New Menu Path Additional Notes
generateXMLArtifacts/xml generateMenuId/GenerateXML GenerateXML is currently the id of a command inside the Generate menu. This may be changed later so that a separator id is used instead of a command id.
source/sourceGroup sourceMenuId/sourceFormat sourceFormat is currently the id of a command inside the Source menu. This may be changed later so that a separator id is used instead of a command id.