Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Separating domain and pictogram model(Store information about the pictogram model and domail model in two different files)
Separating domain and pictogram model [message #547943] Tue, 20 July 2010 08:55 Go to next message
No real name is currently offline No real nameFriend
Messages: 9
Registered: July 2010
Junior Member
Presently the information about the pictogram model and the domain model is being saved in the same file.I shall like to know if it is possible to save the two models in two different files.
Re: Separating domain and pictogram model [message #549426 is a reply to message #547943] Mon, 26 July 2010 15:28 Go to previous messageGo to next message
Tim Kaiser is currently offline Tim KaiserFriend
Messages: 118
Registered: July 2009
Senior Member
Hi !
Here is a hack which shows how it can be accomplished in the case of the graphiti tutorial:
- Add the following method, e.g. to the class TutorialUtil
- Call saveToModelFile() in the TutorialCreateEClassFeature instead of adding the created EClass to the Resource of the Diagram.


public static void saveToModelFile(final EObject obj, final Diagram d) throws CoreException, IOException {
URI uri = d.eResource().getURI();
uri = uri.trimFragment();
uri = uri.trimFileExtension();
uri = uri.appendFileExtension("model");
ResourceSet rSet = d.eResource().getResourceSet();
final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IResource file = workspaceRoot.findMember(uri.toPlatformString(true));
if (file == null || !file.exists()) {
Resource createResource = rSet.createResource(uri);
createResource.save(new HashMap());
createResource.setTrackingModification(true);
}
final Resource resource = rSet.getResource(uri, true);
resource.getContents().add(obj);

}

This method is in no way perfect, just a hack showing the principle...
Best, Tim
Re: Separating domain and pictogram model [message #670065 is a reply to message #547943] Thu, 12 May 2011 14:52 Go to previous messageGo to next message
Phillipp  is currently offline Phillipp Friend
Messages: 24
Registered: May 2011
Junior Member
Hi,

I would like to know if there is a more sophisticated to do this by now.
Re: Separating domain and pictogram model [message #670271 is a reply to message #670065] Fri, 13 May 2011 10:27 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1640
Registered: July 2009
Location: Walldorf, Germany
Senior Member
What would you like to see here?

Michael


"Phillipp" wrote in message news:iqgrnf$7sf$1@news.eclipse.org...

Hi,

I would like to know if there is a more sophisticated to do
this by now.
Re: Separating domain and pictogram model [message #677159 is a reply to message #670271] Tue, 07 June 2011 18:21 Go to previous messageGo to next message
Phillipp  is currently offline Phillipp Friend
Messages: 24
Registered: May 2011
Junior Member
Sorry, it was a unqualified comment. I just had problems writing the Files according to a given ECore-Model but now it works fine.

Sometimes thinking and playing around with your Sample-Project just gets you what you want...

thank you!

[Updated on: Tue, 07 June 2011 18:23]

Report message to a moderator

Re: Separating domain and pictogram model [message #1014669 is a reply to message #549426] Tue, 26 February 2013 08:54 Go to previous messageGo to next message
sakop qq is currently offline sakop qqFriend
Messages: 29
Registered: January 2013
Junior Member
what if I invoked setModificationTracking(false)?
Re: Separating domain and pictogram model [message #1015595 is a reply to message #1014669] Fri, 01 March 2013 10:16 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1640
Registered: July 2009
Location: Walldorf, Germany
Senior Member
That will disable some of the notifications that Graphiti uses to update the
diagram. Not recommended unless you exactly know what you are doing.

Michael
Previous Topic:How to implement the undo&redo functions?
Next Topic:Customizing Context Menu (remove standard features)
Goto Forum:
  


Current Time: Sun Dec 28 01:45:53 GMT 2014

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

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