executing mwe2 programmatically within Eclipse plugin [message #1799476] |
Fri, 07 December 2018 08:15  |
Eclipse User |
|
|
|
Hello,
I want to invoke MWE2 workflow file from a eclipse plugin and expect that the runtime of the eclipse is being used during execution.
I have used below code with Mwe2Runner and Mwe2Launcher, but it does not seem to work and in both the cases I get exceptions.
Case 1: With Mwe2Runner
Injector injector = new Mwe2StandaloneSetup()
.createInjectorAndDoEMFRegistration();
Mwe2Runner runner = injector.getInstance(Mwe2Runner.class);
URI uri = URI.createFileURI(getWorkFlowFilePath());
runner.run(uri,
new HashMap<>());
I get below exeption:
Quote:java.lang.IllegalStateException: [XtextLinkingDiagnostic: null:31 Couldn't resolve reference to JvmType 'com.pc.TestReader
In this case, it is clearly visible that eclipse runtime is not considered.
Case 2: With Mwe2Launcher
Mwe2Launcher.main(new String[] {URI.createFileURI(getWorkFlowFilePath()).toFileString()});
Quote:java.lang.IllegalStateException: Couldn't find module D:\01_Main\Test.mwe2
In this case I see that launcher is considering filePath as module name and failing :-(
Note: In both the case, I am fetching the path of workflow file with the below code and I see that it is completely valid
public static String getWorkFlowFilePath() {
Bundle bundle = Platform.getBundle("com.project1");
URL entry = bundle.getEntry("workflow/Test.mwe2");
if (entry != null) {
URL fileURL;
try {
fileURL = FileLocator.toFileURL(entry);
if (fileURL != null) {
return fileURL.getFile();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
It will be helpful if anyone of you can let me know how to solve this issue..
Thanks !!
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25114 seconds