Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Change generated DiagramFile.gif icon automatically(Change generated DiagramFile.gif icon automatically during the GMF diagram generation process?)
Change generated DiagramFile.gif icon automatically [message #1011949] Wed, 20 February 2013 15:18 Go to next message
web Mac is currently offline web MacFriend
Messages: 5
Registered: February 2013
Location: Germany
Junior Member
Is it possible to change the DiagramFile.gif icon (which is generated in the .diagram folder by GMF) automatically during the generation process?


So far i only see the possibility to change these diagram files afterwards manually which does not really satisfy my needs since i have more then one editor and these are generated quiet frequently right now.
Re: Change generated DiagramFile.gif icon automatically [message #1012299 is a reply to message #1011949] Thu, 21 February 2013 09:50 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
Hi,

you can set the path in gmfgen model. GenDiagram and GenEditor do have an icon path property. I would recommend you to set these properties by using a QVTo transforamtion which is automatically executed each time the genmodel is generated. If you like to do this apporach I can help you further with automating this change.

Ralph
Re: Change generated DiagramFile.gif icon automatically [message #1012347 is a reply to message #1012299] Thu, 21 February 2013 11:44 Go to previous messageGo to next message
web Mac is currently offline web MacFriend
Messages: 5
Registered: February 2013
Location: Germany
Junior Member
Hi Ralph and thank you for the quick reply. Razz

I am already using a transformation and getting an .transformed.gmfgen model out of the .gmfgen file.
I'd like to keep it this generative way and don't want to touch the .gmfgen manually!

For the transformation an .xpt file is used, making some internalTransforms like this:

import gmfgen;
import ecore;
extension org::eclipse::xtend::util::stdlib::counter;


// transforms the given GMFGenModel
List[emf::EObject] transform(List[emf::EObject] gmfGenModelContents) :
   let contents = gmfGenModelContents.eAllContents.addAll(gmfGenModelContents) :
   	contents.internalTransform() ->
   gmfGenModelContents;
	
internalTransform(GenDiagram this) :
	this.setEditingDomainID("SharedEditingDomain") ->
	this.setVisualID(2000); 


Do you reffer to this possibility of the .gmfgen model modification?

If so, can you please tell me which transformations are necessary in order to link to an own FileDiagram icon?


P.S.: I also use GMFTools for an automatically generation.

[Updated on: Thu, 21 February 2013 11:45]

Report message to a moderator

Re: Change generated DiagramFile.gif icon automatically [message #1012404 is a reply to message #1012347] Thu, 21 February 2013 14:00 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
Hi,

I do the following in my custom qvt operation which I do automatically execute with genmodel creation via the wizzard:

this.genEditorGenerator := gmfgenModel.objectsOfType(GenEditorGenerator)->asOrderedSet()->first();
genEditorGenerator.editor.iconPath := "icons/melanie16.gif";

genDiagram := gmfgenModel.objectsOfType(GenDiagram)->asOrderedSet()->first();
genDiagram.creationWizardIconPath := "icons/melanie16.gif";


You can find my whole transformation at: http://code.google.com/a/eclipselabs.org/p/melanie/source/browse/de.uni_mannheim.informatik.swt.models.gmf/transformations/postRec.qvto

Ralph
Re: Change generated DiagramFile.gif icon automatically [message #1012456 is a reply to message #1012404] Thu, 21 February 2013 15:40 Go to previous message
web Mac is currently offline web MacFriend
Messages: 5
Registered: February 2013
Location: Germany
Junior Member
that was a good hint! Smile

for all folks who use xpt instead of qvt, i used the following code to modify the icon path:

internalTransform(GenEditorView this) :
	setIconPath("icons/obj16/myIcon.gif");

However, it still referrs to the .diagram/icons folder and not to the projects model folder.
So it's yet to automize the last step to copy the file from the model/icons to the .diagram/icons folder.
My guess is to do it with the GMFTools, but therefore i would need to register a listener to the asynchronus generation task that the file gets copied AFTER the generation process.

If anybody knows how to do that (or if it's possible to reference the icon to the model/icons folder instead of the local .diagram/icons folders) you're welcome to share your knowledge here! Smile
Previous Topic:Problem in generating Code
Next Topic:Where is my editing domain set to null
Goto Forum:
  


Current Time: Mon Dec 22 00:39:59 GMT 2014

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

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