Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Unable to run org.eclipse.gef.examples.ediagram
Unable to run org.eclipse.gef.examples.ediagram [message #643771] Wed, 08 December 2010 08:51 Go to next message
Murthy Bhat is currently offline Murthy Bhat
Messages: 159
Registered: July 2009
Senior Member
Hello,

For some references I tried to download the "org.eclipse.gef.examples.ediagram" example from CVS and run it. I try to create a new ecore file and I get a blank error message.

On further investigation it appears to me that the application is failing to create a new resource out of the resourceset. I guess it has something to do with the URI.

Would be great if anyone could help me out here.

Thanks,
Murthy
Re: Unable to run org.eclipse.gef.examples.ediagram [message #643776 is a reply to message #643771] Wed, 08 December 2010 09:15 Go to previous message
Murthy Bhat is currently offline Murthy Bhat
Messages: 159
Registered: July 2009
Senior Member
Hi,
I have resolved the issue now.

I need to register my resource factory before creating the resource. So I create a method as below and call it as one of the first lines in the doFinish() method of 'NewEDiagramWizard'

private void registerFactory() {
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
"ecore", new XMIResourceFactoryImpl() {
public Resource createResource(URI uri) {
XMIResource xmiResource = new XMIResourceImpl(uri);
return xmiResource;
}
});
}

After this, there was one last hurdle between me and the GEF editor, the package inclusion error.

So I modified the part in the doFinish() method as below.

doFinish(). . . .

if (ecoreResource == null) {
// The URI didn't match any existing file,so create a new one in the workspace
ecoreResource = rsrcSet.createResource(uri);
}
EPackage pckg = EcoreFactory.eINSTANCE.createEPackage();
pckg.setName("changeMe");
ecoreResource.getContents().add(pckg);
try {
ecoreResource.save(Collections.EMPTY_MAP);
} catch (IOException ioe) {
EDiagramPlugin.INSTANCE.log(ioe);
}

List contents = ecoreResource.getContents();
for (int j = 0; j < contents.size(); j++) {
diagram.getImports().add(contents.get(j));
}


Hope this helps someone is in similar situation.

Regards,
Murthy
Previous Topic:SWT.DEL key and a Graphical viewer inside an eclipse ViewPart
Next Topic:elementary draw2d program doesn't work
Goto Forum:
  


Current Time: Sun Sep 21 16:12:10 GMT 2014

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

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