Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Contributing to GEF Context menu
Contributing to GEF Context menu [message #82079] Wed, 04 June 2003 21:19 Go to next message
Eclipse UserFriend
Originally posted by: schmerl+gef.cs.cmu.edu

Hi,

I'm trying to work out how to use plugin extensions to add contributions to
the context menu that comes up in the GEF diagram. Is this possible? If so,
could someone direct me to the documentation to do it?

So far, I've tried the objectContribution extension, using edit parts as the
objectClass, and also the class of the editor that registers the context
menu, to no avail.

Any help much appreciated,
Bradley.

P.S. This is what I've tried so far:

<extension point="org.eclipse.ui.popupMenus">
<objectContribution
id="myId"

objectClass="org.eclipse.gef.editparts.AbstractGraphicalEditPart ">
...
</objectContribution>
</extension>

<extension point="org.eclipse.ui.popupMenus">
<viewerContribution id="myId"
targetID="org.eclipse.gef.examples.logicdesigner.LogicEditor ">
....
</viewerContribution>
</extension>
Re: Contributing to GEF Context menu [message #82110 is a reply to message #82079] Thu, 05 June 2003 02:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

There is another step required in the code that created the MenuManager.
The logic editor does not register its menus for contribution, I don't
believe.

"Bradley Schmerl" <schmerl+gef@cs.cmu.edu> wrote in message
news:bblnps$nr3$1@rogue.oti.com...
> Hi,
>
> I'm trying to work out how to use plugin extensions to add contributions
to
> the context menu that comes up in the GEF diagram. Is this possible? If
so,
> could someone direct me to the documentation to do it?
>
> So far, I've tried the objectContribution extension, using edit parts as
the
> objectClass, and also the class of the editor that registers the context
> menu, to no avail.
>
> Any help much appreciated,
> Bradley.
>
> P.S. This is what I've tried so far:
>
> <extension point="org.eclipse.ui.popupMenus">
> <objectContribution
> id="myId"
>
> objectClass="org.eclipse.gef.editparts.AbstractGraphicalEditPart ">
> ...
> </objectContribution>
> </extension>
>
> <extension point="org.eclipse.ui.popupMenus">
> <viewerContribution id="myId"
> targetID="org.eclipse.gef.examples.logicdesigner.LogicEditor ">
> ....
> </viewerContribution>
> </extension>
>
>
Re: Contributing to GEF Context menu [message #82264 is a reply to message #82110] Thu, 05 June 2003 13:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: schmerl+gef.cs.cmu.edu

That's right. The constructor for org.eclipse.gef.ContextMenuProvider only
allows an EditPartViewer as a parameter. I can't find out how to set the id
for the menu (which is private to MenuManager and only seems to be settable
through construction). Is there a way to set the ID?

Bradley.


"Randy Hudson" <none@us.ibm.com> wrote in message
news:bbm9s5$1sn$1@rogue.oti.com...
> There is another step required in the code that created the MenuManager.
> The logic editor does not register its menus for contribution, I don't
> believe.
>
> "Bradley Schmerl" <schmerl+gef@cs.cmu.edu> wrote in message
> news:bblnps$nr3$1@rogue.oti.com...
> > Hi,
> >
> > I'm trying to work out how to use plugin extensions to add contributions
> to
> > the context menu that comes up in the GEF diagram. Is this possible? If
> so,
> > could someone direct me to the documentation to do it?
> >
> > So far, I've tried the objectContribution extension, using edit parts as
> the
> > objectClass, and also the class of the editor that registers the context
> > menu, to no avail.
> >
> > Any help much appreciated,
> > Bradley.
> >
> > P.S. This is what I've tried so far:
> >
> > <extension point="org.eclipse.ui.popupMenus">
> > <objectContribution
> > id="myId"
> >
> > objectClass="org.eclipse.gef.editparts.AbstractGraphicalEditPart ">
> > ...
> > </objectContribution>
> > </extension>
> >
> > <extension point="org.eclipse.ui.popupMenus">
> > <viewerContribution id="myId"
> >
targetID="org.eclipse.gef.examples.logicdesigner.LogicEditor ">
> > ....
> > </viewerContribution>
> > </extension>
> >
> >
>
>
Re: Contributing to GEF Context menu [message #82526 is a reply to message #82264] Fri, 06 June 2003 02:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You do not need to set the ID. I think this is only for submenus? Use:
IWorkbenchtPartSite#registerContextMenu (ID, menu, provider);

Hey, do you Randy Pausch? He was one of my professors.

"Bradley Schmerl" <schmerl+gef@cs.cmu.edu> wrote in message
news:bbnh38$b1$1@rogue.oti.com...
> That's right. The constructor for org.eclipse.gef.ContextMenuProvider only
> allows an EditPartViewer as a parameter. I can't find out how to set the
id
> for the menu (which is private to MenuManager and only seems to be
settable
> through construction). Is there a way to set the ID?
>
> Bradley.
Re: Contributing to GEF Context menu [message #899605 is a reply to message #82526] Wed, 01 August 2012 14:46 Go to previous messageGo to next message
Karthikeyan Missing name is currently offline Karthikeyan Missing nameFriend
Messages: 47
Registered: July 2011
Member
Hi,

Have you got solution. If so kindly post that code or kindly mail to triumph.karthikeyan@gmail.com. Myself need of that code.

Thanks & Regards,
Karthikeyan.B

[Updated on: Wed, 01 August 2012 14:47]

Report message to a moderator

Re: Contributing to GEF Context menu [message #899630 is a reply to message #899605] Wed, 01 August 2012 15:54 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi,

in your GraphicalEditor implementation register the menu with the editor's site:
        @Override
	protected void configureGraphicalViewer() {
		super.configureGraphicalViewer();

		final GraphicalViewer graphicalViewer = getGraphicalViewer();

		// Context menu
		ContextMenuProvider provider = new YourContextMenuProvider(graphicalViewer, getActionRegistry());
		graphicalViewer.setContextMenu(provider);
		getSite().registerContextMenu(provider, graphicalViewer);
        }


in your context provider implementation you have to add standard action groups:
        @Override
	public void buildContextMenu(IMenuManager manager) {
		GEFActionConstants.addStandardActionGroups(manager);
                ...
        }


Then you can easily add menu contribution using as follows:
<extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="popup:idOfYourEditor?after=org.eclipse.gef.group.save">
         <command
               commandId="org.eclipse.ui.file.save"
               style="push">
         </command>
      </menuContribution>
      <menuContribution
            locationURI="popup:idOfYourEditor?after=additions">
         <command
               commandId="someCommandId"
               style="push">
         </command>
      </menuContribution>
</extension>

Re: Contributing to GEF Context menu [message #899712 is a reply to message #899630] Thu, 02 August 2012 05:10 Go to previous messageGo to next message
Karthikeyan Missing name is currently offline Karthikeyan Missing nameFriend
Messages: 47
Registered: July 2011
Member
Hi,

Thank you for your reply. Sorry myself new to this. Kindly clarify below doubts.

In buildContextmenu in mycontextProvider, how to add palette tools into that.

In plugin.xml
<command
commandId="someCommandId"
style="push">
</command>
what commandId need to be given and from where. And how it is being used.

Note: My requirement is to bring Palette tools into the GEF editor on user mouse click, as like GMF and graphiti ie show in attached image. Kindly refer it. Is it possible?

Thanks & Regards,
Karthikeyan.B

[Updated on: Thu, 02 August 2012 06:45]

Report message to a moderator

Re: Contributing to GEF Context menu [message #899755 is a reply to message #899712] Thu, 02 August 2012 08:41 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Wow, it looks nice, the tools are shown when right click on the editPart?

They did it, so it must be possible:) But I don't know how. You are free to look at the source code of the graphiti.

As of adding tools from the palette to the context menu, look at this
http://www.eclipse.org/forums/index.php/t/368734/

[Updated on: Thu, 02 August 2012 08:41]

Report message to a moderator

Re: Contributing to GEF Context menu [message #899823 is a reply to message #899755] Thu, 02 August 2012 13:20 Go to previous messageGo to next message
Karthikeyan Missing name is currently offline Karthikeyan Missing nameFriend
Messages: 47
Registered: July 2011
Member
Hi,

If you got any idea or code. Kindly help me in this.

Requirement: we can implement gmf or graphiti class in our GEF Plugin to achieve this functionality.

Thanks & Regards,
Karthikeyan.B
Re: Contributing to GEF Context menu [message #901153 is a reply to message #899823] Fri, 10 August 2012 06:38 Go to previous messageGo to next message
Karthikeyan Missing name is currently offline Karthikeyan Missing nameFriend
Messages: 47
Registered: July 2011
Member
Hi,

It is done by slightly modifying the DiagramPopupBarEditPolicy in GMF. I got that image popup. Now myself need to show the menu on left click of icons in that popup. Can anyone tell me, how to create a menu as like context menu with custom icons in the mouse left click of popup bar icons.

index.php/fa/11127/0/

Thanks & Regards,
Karthikeyan.B
  • Attachment: untitled.JPG
    (Size: 12.30KB, Downloaded 1257 times)

[Updated on: Fri, 10 August 2012 06:49]

Report message to a moderator

Re: Contributing to GEF Context menu [message #902762 is a reply to message #901153] Mon, 20 August 2012 10:25 Go to previous messageGo to next message
Karthikeyan Missing name is currently offline Karthikeyan Missing nameFriend
Messages: 47
Registered: July 2011
Member
Hi,

Finally i achieved the above concept using PromptForConnectionAndEndCommand in org.eclipse.gmf.runtime.diagram.ui.commands package. It has been altered corresponding to GEF and used.

Thanks & Regards,
Karthikeyan.B
Re: Contributing to GEF Context menu [message #902906 is a reply to message #899755] Tue, 21 August 2012 05:22 Go to previous message
Karthikeyan Missing name is currently offline Karthikeyan Missing nameFriend
Messages: 47
Registered: July 2011
Member
Hi,

In my editor, I created tree edit part. In that modelChildren method, i override as following

getModelChildren()
{
List result = new ArrayList();
result.add(component1);
result.add(component2);

return result;
}

my problem is, when i add shapes in editor in following order

component2 - 1
component1 - 1
component2 - 2
component1 - 2

but in my tree view it exist as follows

component1 - 1
component1 - 2
component2 - 1
component2 - 2

Kindly suggest any solution for this.

Thanks & Regards,
Karthikeyan.B

Previous Topic:Background Image - Poof!
Next Topic:[Draw2D] How to create loop connection
Goto Forum:
  


Current Time: Fri Mar 29 01:33:19 GMT 2024

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

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

Back to the top