Skip to main content


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: 210
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 290 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: 14
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 Moreno Pérez
Enterprise Architect
El Corte Inglés, 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: 210
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
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
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 - Red Hat
Senior Software Engineer in Fuse Tooling team
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: 210
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
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
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 - Red Hat
Senior Software Engineer in Fuse Tooling team
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: 210
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: Fri Apr 19 20:10:42 GMT 2024

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

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

Back to the top