Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Persistence(UnsopportedOperationException)
EMF Persistence [message #817051] Fri, 09 March 2012 15:22 Go to next message
nicolas h is currently offline nicolas hFriend
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
Hi there,

I've a little problem that I can't explain ...

On Eclipse Indigo, I realized a Metamodel MM. I would like to create some models conformed to this metamodel.

Assuming that model and model.edit plug-in are already generated from the genmodel.

Here is the simplest test code I tried, based on the "Hello World" plug-in projet sample :

public void run(IAction action) {
		
		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		IProject project = root.getProject("test");
		if (project.exists() && project.isOpen()) {

			URI uri = URI.createPlatformResourceURI("/test/my.mm", true);
			Resource res = new MMResourceImpl(uri);
			res.getContents().add(MMFactory.eINSTANCE.createMMModel());
			
			try {
				res.save(Collections.EMPTY_MAP);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		MessageDialog.openInformation(
			window.getShell(),
			"Test",
			Hello World);
		}
	}


The file my.mm is created, but is empty, and a java.lang.UnsupportedOperationException is raised :

Quote:
java.lang.UnsupportedOperationException
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.doSave(ResourceImpl.java:1455)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1423)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:992)
at test.actions.SampleAction.run(SampleAction.java:52)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4128)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3974)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3613)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)


Using EditingDomain, ResourceSet produced the same result. Tests have been produced on Debian and MacOS.

I don't understand anymore ...


Is there any idea ?


--
Nicolas
Re: EMF Persistence [message #817110 is a reply to message #817051] Fri, 09 March 2012 16:46 Go to previous message
nicolas h is currently offline nicolas hFriend
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
I'm sorry for the inconvenience. I understood my problem. In the genmodel, I choosed "Model > Resource Type > Basic" instead of "Model > Resource Type > XMI" or XML.

Now it works.

Sorry again,

--
Nicolas
Previous Topic:automaticaly save referenced resources
Next Topic:Teneo logging password
Goto Forum:
  


Current Time: Tue Apr 16 17:42:33 GMT 2024

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

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

Back to the top