Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » View Menu: Grid and SnapToGeometry entries
View Menu: Grid and SnapToGeometry entries [message #1337261] Tue, 06 May 2014 15:58 Go to next message
Hernan Gonzalez is currently offline Hernan Gonzalez
Messages: 181
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
I'm trying to understand how is the "View" menu filled. Specifically, the Menu items "Grid" and "Snap to Geometry".

I don't quite understand why they always appears (eg, in the tutorial), even greyed-out.
They seem to be some GEF thing, but browsing the GEF plugin I don't see any declarative addtion, only see that the entries correspond to the ToggleGridACtion and ToggleSnapToGeometryAction classes. This actions are (apparently) activated only programatically, and the Graphiti standard Editor does this with ToggleGridAction in DiagramBehaviour.initActionRegistry:

 ...
 IAction showGrid = new ToggleGridAction(diagramContainer.getGraphicalViewer());
 diagramContainer.getActionRegistry().registerAction(showGrid);
 ...


If I comment out those lines, the option appears disable in the menu (greyed out). But, why does it appear at all? Who adds it? Can't I remove it?

[Updated on: Tue, 06 May 2014 15:59]

Report message to a moderator

Re: View Menu: Grid and SnapToGeometry entries [message #1341480 is a reply to message #1337261] Thu, 08 May 2014 09:57 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1590
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hernan,

the view menu is added to the menu in the DiagramEditorActionBarContributor,
method contributeToMenu. You might provide an own implementation for your
editor that does not add the menu.

Michael
Re: View Menu: Grid and SnapToGeometry entries [message #1341692 is a reply to message #1341480] Thu, 08 May 2014 12:00 Go to previous message
Hernan Gonzalez is currently offline Hernan Gonzalez
Messages: 181
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
Michael Wenz wrote on Thu, 08 May 2014 10:57
Hernan,

the view menu is added to the menu in the DiagramEditorActionBarContributor,
method contributeToMenu.

Michael


Oops, I missed, that. Thanks!

Previous Topic:Highlighting of Anchors
Next Topic:Default Context Menu Choices not working
Goto Forum:
  


Current Time: Mon Sep 01 19:42:54 EDT 2014

Powered by FUDForum. Page generated in 0.02235 seconds