Separating domain and pictogram model [message #547943] |
Tue, 20 July 2010 08:55  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03751 seconds