Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Mwe2Launcher - Resource does not exist
Mwe2Launcher - Resource does not exist [message #1815668] Tue, 08 October 2019 04:36 Go to next message
Eclipse UserFriend
Hello everyone,

I whish to create an Xtext plug-in for my DSL, which (re-)generates the Xtext artifacts at each start-up.

In order to do this I have created a custom Activator java file in org.xtext.example.mydsl.ui which overrides the MyDslActivator:
public class CustomActivator extends MydslActivator
{
	@Override
	public void start(BundleContext context) throws Exception
	{
		String currentDirectory = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); 
		//results '/home/username/eclipse-workspace/org.xtext.example.mydsl.ui/'
		Mwe2Launcher.main(new String[] {currentDirectory + "../org.xtext.example.mydsl/src/org/xtext/example/mydsl/GenerateMyDsl.mwe2"});
		super.start(context);
	}
}


I have added this activator to the MANIFEST.MF as a Bundle-Activator.
Whenever I try to run this, I get the following error:
1    [main] ERROR org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher  - org.eclipse.core.internal.resources.ResourceException: Resource '/home/username/eclipse-workspace/org.xtext.example.mydsl/src/org/xtext/example/mydsl/GenerateMyDsl.mwe2' does not exist.
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.core.internal.resources.ResourceException: Resource '/home/username/eclipse-workspace/org.xtext.example.mydsl/src/org/xtext/example/mydsl/GenerateMyDsl.mwe2' does not exist.


Do you have any suggestion what the problem could be and how to solve it?
Re: Mwe2Launcher - Resource does not exist [message #1815669 is a reply to message #1815668] Tue, 08 October 2019 04:40 Go to previous messageGo to next message
Eclipse UserFriend
This looks as a bad idea in general. An activator should not do any long running operation on startup, this blocks the startup process. Further, when it would execute the MWE workflow and produce new output, this won't get picked up by your DSL. You should regenerate the Xtext implementation before starting a runtime instance, or in the build process.
Re: Mwe2Launcher - Resource does not exist [message #1815671 is a reply to message #1815669] Tue, 08 October 2019 04:50 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for the feedback.

I have some "customizable" language components which requires the re-generation.
Can you please tell me how you would handle this?
Re: Mwe2Launcher - Resource does not exist [message #1815672 is a reply to message #1815671] Tue, 08 October 2019 04:53 Go to previous messageGo to next message
Eclipse UserFriend
I don't know your use case enough. Customizations usually don't happen at runtime, especially for the language itself. Sounds out of scope for what I can discuss in a forum.
Re: Mwe2Launcher - Resource does not exist [message #1815676 is a reply to message #1815672] Tue, 08 October 2019 05:40 Go to previous messageGo to next message
Eclipse UserFriend
Understood.

In the meantime, I have moved my code to a startup extension point (IStartup implementation) and the same error occures.
It's getting interesting.
Re: Mwe2Launcher - Resource does not exist [message #1815681 is a reply to message #1815676] Tue, 08 October 2019 07:00 Go to previous message
Eclipse UserFriend
Hi

If your customization is user-profile/host-machine dependent, it would seem that customization should be done the first time the user attempts to use your tooling with the customization saved for re-use by later sessions.

If your customization is workspace content-dependent then maybe you do need to customize in startUp(), which is certainly much much better than IStartup.early.startup() which will impact on all users even if they only started Eclipse to use a text editor.

However I would strongly recommend reviewing your design so that your 'customizations' use a configuration/import file rather than a different tool generation.

Regards

Ed Willink
Previous Topic:How to attatch Comments to the semantic model and serialize them
Next Topic:Error using maven in Eclipse
Goto Forum:
  


Current Time: Wed Mar 19 11:44:53 EDT 2025

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

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

Back to the top