Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Menu Contributions"
(→Current RCP using ActionBarAdvisor) |
(→Current RCP using an actionSet) |
||
Line 35: | Line 35: | ||
== Current RCP using an actionSet == | == Current RCP using an actionSet == | ||
+ | |||
+ | Using an actionSet, you can also place the command in the main menu. | ||
+ | |||
+ | <extension | ||
+ | point="org.eclipse.ui.actionSets"> | ||
+ | <actionSet | ||
+ | id="org.eclipse.ui.file.exitActions" | ||
+ | label="Exit Actions" | ||
+ | visible="true"> | ||
+ | <action | ||
+ | class="org.eclipse.ui.internal.QuitAction" | ||
+ | id="quit" | ||
+ | definitionId="org.eclipse.ui.file.exit" | ||
+ | label="E&amp;xit" | ||
+ | menubarPath="file/fileEnd" | ||
+ | tooltip="Exit Eclipse"> | ||
+ | </action> | ||
+ | </actionSet> | ||
+ | </extension> | ||
+ | |||
+ | == Proposed new menu == | ||
+ | |||
+ | With the new structure, you would have to turn the action into a handler. | ||
+ | |||
+ | |||
+ | <extension | ||
+ | point="org.eclipse.ui.actionSets"> | ||
+ | <actionSet | ||
+ | id="org.eclipse.ui.file.exitActions" | ||
+ | label="Exit Actions" | ||
+ | visible="true"> | ||
+ | <action | ||
+ | class="org.eclipse.ui.internal.QuitAction" | ||
+ | id="quit" | ||
+ | definitionId="org.eclipse.ui.file.exit" | ||
+ | label="E&amp;xit" | ||
+ | menubarPath="file/fileEnd" | ||
+ | tooltip="Exit Eclipse"> | ||
+ | </action> | ||
+ | </actionSet> | ||
+ | </extension> | ||
+ | |||
+ | |||
<extension | <extension |
Revision as of 11:11, 18 October 2006
Placement examples that try to descript the old to new way.
Contents
Example Matrix
Example | Location | visible when | enabled when | defined by | placed by | handled by | comments |
---|---|---|---|---|---|---|---|
File->Exit | global menu | always | always | Workbench | IDEApplication | IDEApplication | |
Edit->Copy | global menu | always | there is an enabled handler | Workbench | IDEApplication | active part (what about Trim??) | enablement determined by handler |
Global toolbar->Save | global toolbar | always | the active part needs saving | Workbench | IDEApplication | Workbench | |
Global toolbar->Open Type | global toolbar | Java Navigation action set is enabled | Java Navigation action set is enabled | JDT UI | JDT UI | JDT UI | |
Global toolbar->Toggle Mark Occurrences | global (editor) toolbar | any Java editor is active | any Java editor is active | all Java Editors | all Java Editors | active Java Editor | push button state is updated based on active editor |
File->Exit
Current RCP using ActionBarAdvisor
The ApplicationActionBarAdvisor should add the exit menu.
// create the file menu MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_file, IWorkbenchActionConstants.M_FILE); // ... quitAction = ActionFactory.QUIT.create(window); register(quitAction); ActionContributionItem quitItem = new ActionContributionItem(quitAction); quitItem.setVisible(!"carbon".equals(SWT.getPlatform())); //$NON-NLS-1$ menu.add(quitItem);
Current RCP using an actionSet
Using an actionSet, you can also place the command in the main menu.
<extension point="org.eclipse.ui.actionSets"> <actionSet id="org.eclipse.ui.file.exitActions" label="Exit Actions" visible="true"> <action class="org.eclipse.ui.internal.QuitAction" id="quit" definitionId="org.eclipse.ui.file.exit" label="E&xit" menubarPath="file/fileEnd" tooltip="Exit Eclipse"> </action> </actionSet> </extension>
With the new structure, you would have to turn the action into a handler.
<extension point="org.eclipse.ui.actionSets"> <actionSet id="org.eclipse.ui.file.exitActions" label="Exit Actions" visible="true"> <action class="org.eclipse.ui.internal.QuitAction" id="quit" definitionId="org.eclipse.ui.file.exit" label="E&xit" menubarPath="file/fileEnd" tooltip="Exit Eclipse"> </action> </actionSet> </extension>
<extension point="org.eclipse.ui.actionSets"> <actionSet id="org.eclipse.ui.file.exitActions" label="Exit Actions" visible="true"> <action class="org.eclipse.ui.internal.QuitAction" id="quit" definitionId="org.eclipse.ui.file.exit" label="E&xit" menubarPath="file/fileEnd" tooltip="Exit Eclipse"> </action> </actionSet> </extension>