Community
Participate
Working Groups
The toggle grid and ruler commands(and other GEF specific commands) cannot be shown in the right click menu of the editor. However the ZoomIN and Zoom Out are shown. The reason seems to be because only two extensions (i:e zoom in and zoom out ) are made to "org.eclipse.ui.commands" in the GEF plugin. Which fails to add any other command id (like toogle_ruler_visibility etc.) to the command definitions in the registry while initial extension processing during loading. PATCH: Add more extensions for respective GEF specific actions to the current plugin. Requires merely a change in the plugin.xml.
Created attachment 17713 [details] Patched plugin.xml to define the commands for the GEF Toggle actions
The purpose of defining a Command definition is to allow keybindings to be set and changed by the user. How does this affect the ability to put something on a menu? I don't see the connection.
(In reply to comment #2) > The purpose of defining a Command definition is to allow keybindings to be set > and changed by the user. How does this affect the ability to put something on a > menu? I don't see the connection. -> Well the definition is serving more than its intended purpose by actually enabling the Command. The "handleAboutToShow" of a menumanager calls the update, which checks the "isVisible()" of a contribution item. This function returns true only is the associated CommandCallback returns isActive(String commandId) = true for the particular commandID.For those GEF Actions which dont have a commandId(derived from the actionDefinitinId of the Action class)the method returns a true. Like DeleteAction, DirectEditAction etc. However for those GEF actions which have a commandID(actionDefinitionId) set in their constructors, the method checks if the commandId is defined in the registry. This definition comes only by extension to the 'org.eclipse.ui.commands' point as i have suggested in the patch. Another possible solution without adding command extensions would be to not set the actionDefinitionId() in the constructor of these Actions which is this line. //setActionDefinitionId(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY); however i am not sure of the effect of this change on the behaviour of the actions elsewhere. Please let me know if i made myself clear. otherwise i will try to help by sending a test case along with a stack trace of the calls.
Thanks. I wish all bug reporters had comments as clear and helpful as yours. We will add command definitions because it makes sense. It sounds like there is also a potential bug in the workbench. If an action has an unmapped definition ID set, you should get a warning message in the .log file.
I downloaded the latest interation build. U seem to have added some command definitions, however the toggle_ruler_visibility, toggle_grid_visibility, toggle_snap_to_geometry, commands have not been added. These were the commands whose use led me to the bug in the first place. Any particular reason
Unset target milestone as the specified one is already passed.