[Epsilon] Standalone: interactive transformations [message #669331] |
Mon, 09 May 2011 23:36 |
|
Hello,
Sorry for all the posts, but I am getting to try more Epsilon features in standalone mode.
My last attempt was with interactive transformations. As mentioned in section 5.6 of the Epsilon Book I am using UserInput in order to receive input from the user. Two things happen. First I get the following message:
Warning: Variable UserInput is deprecated. Use System.user instead.
Second, the prompt is being displayed at the console and I hope it would be some sort of windnow.
For the first I tried using System.user but I get a
error.
So, how can I get System.user working on standalone mode and second, how can I get a windowed input type. According to section 3.7
Quote:EOL provides the IUserInput interface that can be realized in different ways according to the execution environment and attached to the runtime context via the IEolContext.setUserInput(IUserInput userInput) method.
So I am wondering it must be something to do with this. But how would I create my own implementation of IUserInput? Is there any example/source code I can take a look at?
Best regards,
Horacio
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
Re: [Epsilon] Standalone: interactive transformations [message #669574 is a reply to message #669331] |
Tue, 10 May 2011 18:58 |
|
About your first question: are you running execute() on the EolModule? execute() calls prepare(), which sets up the System variable and the null constant for you.
As for the second question: normally, when you run Epsilon inside Eclipse, JFaceUserInput is used and you get windowed input. In standalone mode or when running the Ant tasks, you get the default implementation, which is console-based (JavaConsoleUserInput).
Please have a look at org.eclipse.epsilon.eol.dt.userinput.JFaceUserInput (here).
|
|
|
Re: [Epsilon] Standalone: interactive transformations [message #669585 is a reply to message #669574] |
Tue, 10 May 2011 20:11 |
|
Hi Antonio,
When i say "standalone" I actually mean my own set of eclipse plugins I use in my own RCP, so I guess the JFaceUserInput should be working. Perhaps I am missing an eclipse bundle in the required bundles in the manifest? How does eol knows if to use the window or the console for user input? Can I force it to use a specific one?
I am calling the user input from within an egl template and I am calling execute method of the egl module that uses it. My base epsilon module is basically the same as the EpsilonStandalone example. Maybe user input is not ment to be used in egl =D ?
Regards,
Horacio
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
Re: [Epsilon] Standalone: interactive transformations [message #669591 is a reply to message #669585] |
Tue, 10 May 2011 20:49 |
|
Hi Antonio,
So looking at the egl "module" source code... it seems egl is a whole different breed. Digging into the code I found the egl module execute method and in this case the null and System variables are not created. So, I took the eol module code and added the part of the prepare method that creates the variables to my implementation. And... VOILA! it worked. However I am still getting the prompt at the console and not from a window. Is there any reason the null and System variables are not added to the egl module? Can this be a bug?
Regards,
Foam
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
Re: [Epsilon] Standalone: interactive transformations [message #669599 is a reply to message #669591] |
Tue, 10 May 2011 21:39 |
|
Antonio,
I guess the EGLModule uses an EGLContext which extends the EOLContext and as such has a JavaConsoleUserInput as the defualt userInput. So what I did was that after defining the null and System variables I went ahead and changed the default userInput to a JFaceUserInput. Mi final execute method looks like this:
@Override
public void execute() throws RiskcException {
module = createModule();
try {
module.parse(sourceURI);
} catch (URISyntaxException e) {
throw new RiskcException("Error parsing source. " + e.getMessage());
} catch (Exception e) {
throw new RiskcException("Error parsing source. " + e.getMessage());
}
if (module.getParseProblems().size() > 0) {
System.err.println("Parse errors occured...");
for (ParseProblem problem : module.getParseProblems()) {
System.err.println(problem.toString());
}
throw new RiskcException("Parse errors occured. See stack trace for details.");
}
for (IModel model : getModels()) {
module.getContext().getModelRepository().addModel(model);
}
module.getContext().getFrameStack().put(Variable.createReadOnlyVariable("null", null));
EolSystem system = new EolSystem();
system.setContext(module.getContext());
module.getContext().getFrameStack().put(Variable.createReadOnlyVariable("System",system));
module.getContext().setUserInput(new JFaceUserInput(new PrettyPrinterManager()));
preProcess();
try {
result = execute(module);
} catch (EolRuntimeException e) {
throw new RiskcException(e.getMessage());
}
postProcess();
module.getContext().getModelRepository().dispose();
}
I am getting a windowed prompt now =D.
Thanks for your help.
Horacio
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
|
|
Re: [Epsilon] Standalone: interactive transformations [message #669820 is a reply to message #669693] |
Wed, 11 May 2011 16:17 |
|
Louis,
I am a big fan of Epsilon, to the point that I am suggesting it to all my fellow students and researchers that work in modeling (and have had some success when I describe all the neat stuff and awesome capabilities/features it has =D). So facing this issues just lets me understand the tools better and hopefully find more bugs or suggests new functionalities that will improve Epsilon tools.
I crated the bug, ID is : 345459 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=345459)
I just reported the null and System variables, as actually EGL uses the EOLContext and hence provides the JavaConsole input method (I wanted the windowed). Probably this should be tested by running the EGL template from an epsilon run configuration, but it can't be done until the plugin's source code fixes the bug.
Regards,
Horacio
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
|
Powered by
FUDForum. Page generated in 0.02357 seconds