Skip to main content


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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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] by Moderator

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
Eclipse UserFriend
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
Eclipse UserFriend
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: Thu Feb 13 07:16:14 GMT 2025

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

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

Back to the top