"a registered resource factory is needed" outside the generated editor [message #377406] |
Thu, 01 May 2003 13:12  |
Eclipse User |
|
|
|
I have an EMF model which is running perfectly in the generated editor.
Now I want to load the model from a file in some code outside of the
generated editor. I get the exception below. For loading the file I
perform the steps as in the generated editor (see below).
How do I register the required resource factory?
Thanks for any hints,
Chris
=== code snippet starts here ===
List factories = new ArrayList();
factories.add(new ResourceItemProviderAdapterFactory());
factories.add(new ModelItemProviderAdapterFactory());
adapterFactory = new ComposedAdapterFactory(factories);
BasicCommandStack commandStack = new BasicCommandStack();
editingDomain = new AdapterFactoryEditingDomain(adapterFactory,
commandStack);
String inputFile = "f:/workspace/eva/Releases13.model";
Resource resource = editingDomain.loadResource
(URI.createFileURI(inputFile).toString());
=== code snippet ends here ===
=== console output starts here ===
java.lang.RuntimeException: Cannot create a resource for
'file:/f:/workspace/eva/Releases13.model'; a registered resource factory
is needed
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:282)
at
org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain.load Resource(AdapterFactoryEditingDomain.java:284)
at eva.fs.tests.AllTests.loadFile(AllTests.java:202)
at eva.fs.tests.AllTests.buildEd(AllTests.java:162)
at eva.fs.tests.EvaEditionTest.setUp(EvaEditionTest.java:24)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:270)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:161)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05649 seconds