Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Get the domain model file
Get the domain model file [message #234032] Thu, 18 June 2009 09:26 Go to next message
Andreas Schoeneck is currently offline Andreas SchoeneckFriend
Messages: 22
Registered: July 2009
Junior Member
Hi there,

I am wondering on how to find out which domain model file a diagram is
for, i.e. I want to get the .XYZ file for a given .XYZ_diagram file.
Any help is appreciated.

Regards
Andreas
Re: Get the domain model file [message #234051 is a reply to message #234032] Thu, 18 June 2009 10:18 Go to previous message
Andreas Schoeneck is currently offline Andreas SchoeneckFriend
Messages: 22
Registered: July 2009
Junior Member
I found the solution myself with the help of the following post:


news://news.eclipse.org:119/f4oa0l$fnc$1@build.eclipse.org
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg06592.html

My solution is as follows:

public IFile getDomainFileOf(IFile diagramFile) {

ResourceSet set = new ResourceSetImpl();

Resource res = set.getResource(
URI.createPlatformResourceURI(
diagramFile.getFullPath().toString(),
true),
true);

for (EObject o : res.getContents()) {
if (o instanceof Diagram) {

Diagram diagram = (Diagram) o;
return WorkspaceSynchronizer.getFile(
diagram.getElement().eResource());
}
}
return null;
}

Any comments?
Previous Topic:Question about linked emf and gmf editors
Next Topic:Do I need a Top Node Reference anymore?
Goto Forum:
  


Current Time: Thu Mar 28 10:50:29 GMT 2024

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

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

Back to the top