Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Having customized forms or Adding Menus/Toolbars/Context Menus and etc. when running GMF as a plugin
Having customized forms or Adding Menus/Toolbars/Context Menus and etc. when running GMF as a plugin [message #1702105] Sun, 19 July 2015 16:06 Go to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 121
Registered: February 2014
Senior Member
Hi everybody,

Consider that I want build a domain specific modelling tool using GMF. What I found is that when we run GMF project as eclipse plugin, we are still constrained with the environment that GMF provides for you. However, I would like to use GMF modelling functionality but adding some more stuffs like MenuBars, Context Menus or everythingles that I could have in my own developed modelling tool.
For example, in the attached screetshot, they can right click on the model and have their own menu items...

Is that possible, if yes how ... ?

Thanks and Appreciated ... Smile
  • Attachment: mmtf.png
    (Size: 162.39KB, Downloaded 94 times)
Re: Having customized forms or Adding Menus/Toolbars/Context Menus and etc. when running GMF as a pl [message #1702559 is a reply to message #1702105] Thu, 23 July 2015 08:37 Go to previous messageGo to next message
Ángel Moreno is currently offline Ángel MorenoFriend
Messages: 13
Registered: November 2013
Location: Madrid
Junior Member
Hi Parsa Pourali,

Shhhhhh... this is a TOP SECRET.... Very Happy

Go to your *.diagram plug-in, go to the package xxxxx.diagram.part, and go to the Java Class DiagramEditorContextMenuProvider.java. In this class, go to the buildContextMenu() function and check how works the next code :

menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
menu.appendToGroup("editGroup", deleteAction);

In this point you have access to the Context Menu, from all point of your Diagram Editor Surface... Study how add new actions and Menus some code to study, and decide what actions and submenus do you have include in your Context Menu...

Regards,


Ángel M.
Researcher @ Kybele Research Group
Rey Juan Carlos University, Madrid, Spain

[Updated on: Thu, 23 July 2015 11:01]

Report message to a moderator

Re: Having customized forms or Adding Menus/Toolbars/Context Menus and etc. when running GMF as a pl [message #1702631 is a reply to message #1702559] Thu, 23 July 2015 16:00 Go to previous messageGo to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 121
Registered: February 2014
Senior Member
Thanks,
I'll let you know how this secret stuffs worked for me Wink At this moment, it seems to be more complicated than what I thought ! Very Happy

Regards,
Parsa
Re: Having customized forms or Adding Menus/Toolbars/Context Menus and etc. when running GMF as a pl [message #1703695 is a reply to message #1702631] Tue, 04 August 2015 10:09 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien PupierFriend
Messages: 633
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

to display your contextual menu, you can use the extension point org.eclipse.ui.menus with the locationUri popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu
You can have an example by looking to https://github.com/bonitasoft/bonita-studio/blob/master/bundles/plugins/org.bonitasoft.studio.diagram.custom/plugin.xml

Regards,


Aurélien Pupier - Bonitasoft S.A.
My company Eclipse-related blog
Re: Having customized forms or Adding Menus/Toolbars/Context Menus and etc. when running GMF as a pl [message #1703888 is a reply to message #1703695] Wed, 05 August 2015 15:54 Go to previous messageGo to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 121
Registered: February 2014
Senior Member
Hi Aurelien,

Thank you so much, the link was a very good starting point for me, it was very helpful.

Also, it may be a long shot, but I'd rather ask, do you know or think that we can have access to the elements of a model. for example, I want to have an action listener on the transition label of a state diagram. So, whenever the user tries to edit the label of a transition in a state machine, I can listen to it and do some code ... not sure , if it is possible in GMF or other modelling frameworks ...

Thanks,
Regards,
Parsa
Re: Having customized forms or Adding Menus/Toolbars/Context Menus and etc. when running GMF as a pl [message #1704014 is a reply to message #1703888] Thu, 06 August 2015 16:33 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien PupierFriend
Messages: 633
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi Parsa,

for new questions, please open a new topic next time. I will answer here this time, if you need more details after my answer, please also open a new thread.

Of course you put listener when editing elements of the model. If you want to listen to semantic model directly you can take a look here . if you want to listen at Diagram level you can use a DiagramEventBroker, there is an example here.

Regards,


Aurélien Pupier - Bonitasoft S.A.
My company Eclipse-related blog
Re: Having customized forms or Adding Menus/Toolbars/Context Menus and etc. when running GMF as a pl [message #1704142 is a reply to message #1704014] Fri, 07 August 2015 15:52 Go to previous message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 121
Registered: February 2014
Senior Member
Thanks Aurélien,

That's great!

Best Regards,
Parsa
Previous Topic:Split Generated Method
Next Topic:Failed to create part's control - Eclipse GMF
Goto Forum:
  


Current Time: Thu Jun 22 12:07:49 GMT 2017

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

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