Hi,
I'm using the AMW codebase to build a weaver that is independent of the
GUI but still runs in Eclipse as a plugin. I've succeeded in getting the
code to work with just one issue. I'm forced to create an EditingDomain to
enable the WeavingModelManager (WMM) to load properly. The WMM fails with
an exception as follows if I do not setup the EditingDomain.
at
org.eclipse.weaver.core.WeaverModelManager.getWeavingModel(WeaverModelManager.java:518)
at atlhook.handlers.SampleHandler.execute(SampleHandler.java:104)
at
org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:240)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:475)
at
org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:429)
at
org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:165)
at
org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247)
at
org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:570)
at
org.eclipse.ui.menus.CommandContributionItem.access$8(CommandContributionItem.java:556)
at
org.eclipse.ui.menus.CommandContributionItem$3.handleEvent(CommandContributionItem.java:546)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3319)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
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:508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
I use the following code to create the EditingDomain
List factories = new ArrayList();
ComposedAdapterFactory adapterFactory = new
ComposedAdapterFactory(factories);
GlobalWeaverEditor gWE = new GlobalWeaverEditor();
AdapterFactoryEditingDomain editingDomain =
gWE.createEditingDomain(adapterFactory);
Resource res = wMM.getWeavingMetamodel();
WeaverResourceUtil.initResource(res); Resource rs =
wMM.getWeavingModel(editingDomain);
I don't use the last rs but am forced to call
wMM.getWeavingModel(editingDomain) to avoid the excpetion above.
Have a I missed a step in creating the WeavingModelManager properly or is
there a dependency on the EditingDomain?
Regards,
Ronan