[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.gmf] Re: Get the domain model file
|
- From: Andreas Schoeneck <as.maps@xxxxxxxxx>
- Date: Thu, 18 Jun 2009 12:18:03 +0200
- Newsgroups: eclipse.modeling.gmf
- Organization: EclipseCorner
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.0
I found the solution myself with the help of the following post:
news://news.eclipse.org:119/f4oa0l$fnc$1@xxxxxxxxxxxxxxxxx
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/msg06592.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?