Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Trying to add to the context menu programmatically
Trying to add to the context menu programmatically [message #628744] Thu, 23 September 2010 22:00
Eclipse UserFriend
Originally posted by: harrisb.ociweb.com

Hello,

I'm trying to add to the context menu for a GMF figure programmatically
(what's added will depend on the domain element behind the figure).
To get familiar with the mechanics for doing this I'm trying a out a
simple menu addition. My approach is to

1. Define a custom class that inherits from DiagramContextMenuProvider
and add to the menu in method buildContextMenu().

2. In plugin.xml add a extension using target extension-point
org.eclipse.gmf.runtime.common.ui.services.action.contributi onItemProviders.

3. Use GMF class DiagramContributionItemProvider for the
ContributionItemProvider.

4. For the popupContribution class use the custom class mentioned in step 1.

5. Make the criteria for the contribution be all the top level nodes on
the diagram.

At the end of this post is the actual extension itself. The problem is
that my custom class
(context_menu_add.diagram.providers.CustomContextMenuProvide r) is never
getting accessed so there is no menu modifications done.

Any ideas what I could be doing wrong? Or is there an example of
programmatic context menu modification to point me to, or maybe there's
a better strategy to do what I'm trying to do?

Thanks,
Byron Harris

<extension id="Context_menu_addContributionItemProvider"
name="Context_menu_addContributionItemProvider"
point=" org.eclipse.gmf.runtime.common.ui.services.action.contributi onItemProviders ">
<contributionItemProvider
class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContribu tionItemProvider ">
<Priority name="Low">
</Priority>
<popupContribution
class=" context_menu_add.diagram.providers.CustomContextMenuProvider ">
<popupStructuredContributionCriteria

objectClass=" org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPar t ">
<method

name=" getDiagramEditDomain().getEditorPart().getEditorSite().getId () "

value=" context_menu_add.diagram.part.Context_menu_addDiagramEditorI D "/>
</popupStructuredContributionCriteria>
</popupContribution>
</contributionItemProvider>
</extension>
Previous Topic:Removing Functions From GMF Menu Bar?
Next Topic:reuse the attributs of GMF file's
Goto Forum:
  


Current Time: Thu Apr 25 12:52:16 GMT 2024

Powered by FUDForum. Page generated in 0.02668 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top