plugbee / dslforge

A generator of domain-specific language (DSL) editors for web applications and cloud IDEs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate Web Editor from Xtext Wizard does not find MWE2 Workflow file

david-pace opened this issue · comments

I just installed DSL Forge Tools Feature 0.9.0.201608071811 and tried generating a web editor using the wizard. After choosing my *.xtext grammar file, all fields stay empty and it is impossible to continue the wizard with the next button.

Steps to reproduce:

  1. (Install DSl Forge Tools via Help -> Install New Software using http://dslforge.org/downloads/tooling/repository/)
  2. New -> Other... -> DSL Forge -> Generate Web Editor from Xtext -> Next
  3. Browse... -> (choose .xtext Grammar)
    All fields stay empty.

When using a generated Xtext example project, it works out of the box. So the problem is specific to my grammar. Could the problem be that the bundle containing my grammar is git-managed and therefore located in an external filesystem location?

I found the reason in the error log:
org.eclipse.core.internal.resources.ResourceException: Resource '/tld.domain.my.dsl/src/main/java/path/to/package/dsl/MyDSL.mwe2' does not exist.
A workaround is to rename the MWE2 file. If this is expected behaviour, this bug can be closed.

So far, there is one assumption: the file name can be either {grammar name}.mwe2 or Generate{grammar_name}.mwe2 because this is the way it is named by default in Xtext. Both cases are normally handled, see loadWorkflowResource

Could you please provide the stack trace ?

Here is the stacktrace:

org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.core.internal.resources.ResourceException: Resource '/.../src/main/java/.../dsl/MyDSL.mwe2' does not exist.
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
    at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:265)
    at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:25)
    at org.dslforge.xtext.generator.util.GeneratorUtil.loadWorkflowResource(GeneratorUtil.java:515)
    at org.dslforge.xtext.generator.util.GeneratorUtil.getReferencedResources(GeneratorUtil.java:352)
    at org.dslforge.xtext.generator.util.GeneratorUtil.loadXtextGrammar(GeneratorUtil.java:246)
    at org.dslforge.xtext.generator.ui.wizard.XtextGrammarImportPage.handleBrowseFileSystem(XtextGrammarImportPage.java:180)
    at org.dslforge.xtext.generator.ui.wizard.XtextGrammarImportPage.access$0(XtextGrammarImportPage.java:173)
    at org.dslforge.xtext.generator.ui.wizard.XtextGrammarImportPage$1.widgetSelected(XtextGrammarImportPage.java:111)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:827)
    at org.eclipse.jface.window.Window.open(Window.java:803)
    at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:269)
    at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:290)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
    at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:252)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:234)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:493)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:486)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
    at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:343)
    at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:160)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Caused by: org.eclipse.core.internal.resources.ResourceException: Resource '/.../src/main/java/.../dsl/MyDSL.mwe2' does not exist.
    at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:334)
    at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:208)
    at org.eclipse.core.internal.resources.File.getContents(File.java:267)
    at org.eclipse.core.internal.resources.File.getContents(File.java:260)
    at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$WorkbenchHelper.createPlatformResourceInputStream(PlatformResourceURIHandlerImpl.java:207)
    at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:525)
    at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:360)
    at org.eclipse.xtext.resource.XtextResourceSet$1.createInputStream(XtextResourceSet.java:298)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1269)
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
    ... 63 more

To extend the existing logic it would be an option to search for any *.mwe2 file in the directory of the .xtext grammar.
In any case it would be nice to see an appropriate error message stating which files were searched and possibly were not found. Currently the wizard fails silently without obvious error reporting. An 'Unhandled event loop exception' is only found in the error log containing a ResourceException.

Fix committed, thanks for the suggestion.

Thank you very much for the enhancement!