Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Epsilon] Standalone: interactive transformations
icon5.gif  [Epsilon] Standalone: interactive transformations [message #669331] Mon, 09 May 2011 23:36 Go to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

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
Type 'System' not found

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 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

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 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

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 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

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 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

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 #669686 is a reply to message #669599] Wed, 11 May 2011 07:31 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Horacio,

I'm sorry to read that you've ran into a couple of problems with EGL. As you noted, EGL is implemented in a different way to the other languages. Sometimes changes to EOL aren't propagated to EGL, but we're working to improve this.

As you suspected, user input and the built-in variables should definitely be present in EGL templates; this is a bug.

Could you fill a bug report to cover this?
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=GMT& component=Epsilon

Please post the bug number so that I can start working on a fix right away. I'll also add some regression tests and see if this in an opportunity to make it easier for EGL to mimic EOL's default behaviour.

Many thanks,
Louis.
Re: [Epsilon] Standalone: interactive transformations [message #669693 is a reply to message #669686] Wed, 11 May 2011 08:02 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Just adding to Louis' comments: JFaceUserInput is set up when you use one of the Epsilon launch configurations. That's why you didn't get windowed input, even when running EGL inside your Eclipse RCP-based application.
Re: [Epsilon] Standalone: interactive transformations [message #669820 is a reply to message #669693] Wed, 11 May 2011 16:17 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

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
Re: [Epsilon] Standalone: interactive transformations [message #670149 is a reply to message #669820] Thu, 12 May 2011 20:21 Go to previous message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Horacio,

Thanks a lot for the positive feedback, your contributions on the forum, and for posting the bug report! It's great to hear from our users.

I've begun to investigate this issue, which I actually think might affect some of the other languages too. Dimitris, Antonio and I will discuss the bug over email, and I'll apply a fix. I'll post any further updates to the bug report.

Thanks again for reporting the bug! Have a good evening...

Cheers,
Louis.
Previous Topic:[Epsilon] Standalone: imported sources
Next Topic:[eol] question about usage of native types
Goto Forum:
  


Current Time: Thu Mar 28 23:10:58 GMT 2024

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

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

Back to the top