Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » SETTING-UP the EDITOR Models by code
SETTING-UP the EDITOR Models by code [message #1053741] Tue, 07 May 2013 09:04 Go to next message
Luca Salemio is currently offline Luca Salemio
Messages: 14
Registered: May 2013
Junior Member
Hi Everyone,
I am realizing a graphical editor with Eclipse GMF.
- First of all I defined an ecore metamodel to describe my editor
- In my ecore metamodel there is an EClass called Block. Since the user can define different blocks to have into the palette that reflect Block definition, I would like to implement a set up phase where he can decide which and how many to have, before starting up the editor and its components. (note: It is not possible to know a priori how many of them he will have and he can also change their properties and number during the normal execution of the program, so for example, he can create a new element of that block and it has to be visible into the palette).

Is it possible to define the .gmfgraph, .gmftool and the others by code without using the GMF Dashboard ?

I hope to have well defined the problem,
Thank you very much in advance.

Best regards,
Luca.
Re: SETTING-UP the EDITOR Models by code [message #1053750 is a reply to message #1053741] Tue, 07 May 2013 09:40 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi Luca,

you can completely program using GMF runtime without using GMF Tooling. It could be however be very useful to define a basic set of your language using the GMF models and manipulate the generated elements (figures, palettes etc.) at runtime. That is what works quite well in my case.

Ralph
Re: SETTING-UP the EDITOR Models by code [message #1053893 is a reply to message #1053750] Wed, 08 May 2013 02:49 Go to previous messageGo to next message
Luca Salemio is currently offline Luca Salemio
Messages: 14
Registered: May 2013
Junior Member
Ralph Gerbig wrote on Tue, 07 May 2013 09:40
Hi Luca,

you can completely program using GMF runtime without using GMF Tooling. It could be however be very useful to define a basic set of your language using the GMF models and manipulate the generated elements (figures, palettes etc.) at runtime. That is what works quite well in my case.

Ralph


Thank you very much Ralph for your suggestions.

I am a very beginner with GMF so I am reading tutorials and documentations about it, but I cannot find the one that can really help me.
Since I am using Eclipse Juno I searched here http://help.eclipse.org/juno/index.jsp
but I didn't find any specification.

Can you recommend me where I can find the right documentation for Eclipse Juno ?

Thanks,
Luca.
Re: SETTING-UP the EDITOR Models by code [message #1058222 is a reply to message #1053741] Mon, 13 May 2013 05:17 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

here you will find documentation on GMF Runtime http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.gmf.doc/reference/api/runtime/overview-summary.html . You should also take a look on the examples and code snippets in the GMF wiki.

Ralph
Re: SETTING-UP the EDITOR Models by code [message #1071228 is a reply to message #1058222] Fri, 19 July 2013 11:48 Go to previous messageGo to next message
Luca Salemio is currently offline Luca Salemio
Messages: 14
Registered: May 2013
Junior Member
Hi Ralph,
thank you very much for all suggestions,

I was able to create dinamically into the palette the number of objects I needed from a single ecore class so they refer just to one metamodel class definition.
I this time I would like to get their properties from the palette to draw on the editor but the only thing I can do it is getting the type of class.
It would be nice for me to get for example their name to be set already into the objects at the moment of their instantiation.

How can I get also some other properties they have ?
For example, these NodeTools into the palette have different names, how can I know them at the moment of block creation on the editor? It seems like there is no connection between palette and commands.

Can you help me ?

Best regards,
Luca.
Re: SETTING-UP the EDITOR Models by code [message #1072179 is a reply to message #1071228] Mon, 22 July 2013 04:42 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

you can access the palette in your command via the editing domain and ask for the active tool.

Ralph

[Updated on: Mon, 22 July 2013 04:43]

Report message to a moderator

Re: SETTING-UP the EDITOR Models by code [message #1072284 is a reply to message #1072179] Mon, 22 July 2013 09:01 Go to previous messageGo to next message
Luca Salemio is currently offline Luca Salemio
Messages: 14
Registered: May 2013
Junior Member
Hi Ralph, thanks for replying me.
I am trying to follow your advice from the method doExecuteWithResult of an EditElementCommand but I am not able to do as you suggested me.

Can you please give more detail how to access to the getActiveTool I guess?

Thanks,
Luca
Re: SETTING-UP the EDITOR Models by code [message #1072418 is a reply to message #1072284] Mon, 22 July 2013 14:11 Go to previous message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

here is code that I placed in canExecute. This is code that I place in a create command https://github.com/deep-modeling/melanee-core/blob/master/plugins/org.melanee.core.models.gmf/templates/aspects/xpt/diagram/commands/CreateNodeCommand.xpt . I also do use it in ElementInitializer (line 104) https://github.com/deep-modeling/melanee-core/blob/master/plugins/org.melanee.core.models.gmf/templates/aspects/xpt/providers/ElementInitializers.xpt . It is important that you https://github.com/deep-modeling/melanee-core/blob/master/plugins/org.melanee.core.models.gmf/templates/aspects/xpt/editor/Editor.xpt (line 81) show how to get a palette from an editing domain. It is important to know that this is done on a DefaultEditDomain so may need to do a type cast when retrieving you edit domain from somewhere else than the generated xxxDiagramEditor.

Ralph
Previous Topic:Invisible Phantom Nodes
Next Topic:Adding menu to the palette
Goto Forum:
  


Current Time: Thu Aug 21 02:28:15 EDT 2014

Powered by FUDForum. Page generated in 0.02360 seconds