Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Using Epsilon in Java
Using Epsilon in Java [message #1460628] Mon, 03 November 2014 19:29 Go to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi my friend,
I need to call Epsilon in java program. In fact My epsilon codes must be called in during a Java application. How I must start doing this?
I've started with 'org.eclipse.epsilon.example.estandalon' and tried to run it. So I check out this example in my work space. But when I run its Java code, for example 'EtlStandalonExample.java', I get bottom error:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The import org.eclipse.epsilon.eol.dom cannot be resolved.....

I've checked dependency and this seems correct. In according to
http://www.eclipse.org/epsilon/examples/index.php?example=org.eclipse.epsilon.examples.standalone, I have not any lunch file in 'org.eclipse.epsilon.example.estandalon'. What is the reason of error that I get?

[Updated on: Tue, 04 November 2014 16:35]

Report message to a moderator

Re: Using Epsilon in Java [message #1460674 is a reply to message #1460628] Mon, 03 November 2014 20:38 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

Sorry about that. Updating your copy of org.eclipse.epsilon.examples.standalone from the SVN should fix these errors.

Cheers,
Dimitris
Re: Using Epsilon in Java [message #1460748 is a reply to message #1460674] Mon, 03 November 2014 22:32 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Dear Dimitris,
It's OK. Thanks for your quick reply. I updated 'org.eclipse.epsilon.examples.standalone' and all its dependent plug-ins in my work space. But I get several other errors likes:

Exception in thread "main" java.lang.NullPointerException
at CallEpsiloninJava.EpsilonStandaloneExample.getFile(EpsilonStandloneExample.java:110)....

I have not any .lunch yet!
Should I do like standalone example For calling epsilon in Java? I'm beginner in doing this, what is your offer for learning and trying this?

Regards...
Re: Using Epsilon in Java [message #1460761 is a reply to message #1460748] Mon, 03 November 2014 22:51 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

Yes - studying how .standalone does things is the recommended way of getting familiar with Epsilon's Java API (I've tried running all runnable classes in .standalone (e.g. EolStandaloneExample, EtlStandaloneExample) and everything seems to be working fine on my side).

Cheers,
Dimitris
Re: Using Epsilon in Java [message #1461510 is a reply to message #1460761] Tue, 04 November 2014 16:35 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Dear Dimitris,
I Add .standalon and bottom plug-ins in my work space again.
org.eclipse.epsilon.eol.engine,
org.eclipse.epsilon.emc.emf,
org.eclipse.epsilon.ecl.engine,
org.eclipse.epsilon.egl.engine,
org.eclipse.epsilon.eml.engine,
org.eclipse.epsilon.erl.engine,
org.eclipse.epsilon.etl.engine,
org.eclipse.epsilon.evl.engine,
org.eclipse.epsilon.ewl.engine,
org.eclipse.uml2.uml
But I have several errors in above plug-in. For example, there is an error in definition of constructor EpsilonTreeAdaptor(URI, AbstractModule) in .eol.engin!
I'm trying to solve these errors. What is your suggestion about reason of these errors?
Re: Using Epsilon in Java [message #1461570 is a reply to message #1461510] Tue, 04 November 2014 18:02 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

We're in the middle of refactoring some of the internals of Epsilon, which could explain the errors you're receiving. If you're using the 1.2 release, please check out the .standlone example from http://dev.eclipse.org/svnroot/modeling/org.eclipse.epsilon/tags/1.2

Cheers,
Dimitris
Re: Using Epsilon in Java [message #1463532 is a reply to message #1461570] Thu, 06 November 2014 17:03 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi Dimitris,
I tried several versions of .standalone and its dependent plug-ins, but I gave similar errors in plug-ins which are added as dependency. I tried to solve them, but any alteration in one of them causes a new error in other plug-ins and this process need to a lot of time.
I use Kepler Service Release 2 and JRE-SE1.7.
Is it possible that I know what is version of your eclipse and jre and where do you check out .standalone and epsilon plug-ins?
I'll embrace from any suggestion.
Thanks for all your support Smile

[Updated on: Thu, 06 November 2014 17:36]

Report message to a moderator

Re: Using Epsilon in Java [message #1463717 is a reply to message #1463532] Thu, 06 November 2014 21:25 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

Which version of Epsilon are you using?

Cheers,
Dimitris
Re: Using Epsilon in Java [message #1463733 is a reply to message #1463717] Thu, 06 November 2014 21:54 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi,
Excuse me, I forget to specify it. I'm using epsilon1.1-SR1.
Re: Using Epsilon in Java [message #1463755 is a reply to message #1463733] Thu, 06 November 2014 22:23 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

In this case, I'd suggest trying to check-out the .standalone example under http://dev.eclipse.org/svnroot/modeling/org.eclipse.epsilon/tags/1.1_SR1

Cheers,
Dimitris
Re: Using Epsilon in Java [message #1464687 is a reply to message #1463755] Fri, 07 November 2014 20:02 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Dear Dimitris,
Thanks for all your support. I checked out this version and with little change, I could run it.
Re: Using Epsilon in Java [message #1468316 is a reply to message #1464687] Mon, 10 November 2014 19:04 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi dear Dimitris,
I'm working on using the epsilon in Java application after the successful running of standalone example.
I implemented a Java application and in during the Java application, I call my Epsilon codes. I do this process For EOL and ETL, but for EPL I've faced with some problems. I did similar to EOL for EPL, but I get several errors in parser. For example, I get an error on 'pattern' key word that is defined in my EPL code. My EPL.java class contains the override of createModule(), getModels() , getSource() and postProcess() operations. Have I missed any things in EPL.java class? Do I do different from EOL for calling the EPL?
Re: Using Epsilon in Java [message #1468509 is a reply to message #1468316] Mon, 10 November 2014 22:37 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

Could you please post a minimal example [1] I can use to reproduce the issues you're encountering?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: Using Epsilon in Java [message #1469064 is a reply to message #1468509] Tue, 11 November 2014 09:16 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi Dimitris,
Thanks for your quick reply. I attached one simple example.
in this example, 'CallEpsiloninJava.java' class is similar to 'EpsilonStandalonExample.java' and 'EplCodes.java' class is similar to 'EolStandaloneExample.java' class in org.eclipse.epsilon.example.standalone.
When I run 'EplCodes.java', I get these errors:
Parse errors occured...
Line: 2, Reason: mismatched input: 'pre'
Line: 3, Reason: no viable alternative at input '{'

I added 'org.eclipse.epsilon.epl.engine' to dependencies, but my problem wasn't solved!
Re: Using Epsilon in Java [message #1469080 is a reply to message #1469064] Tue, 11 November 2014 09:33 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

The problem is that you're trying to parse EPL code using the EOL parser. You'd need to replace line 22 in "EplCodes.java" from

return new EolModule();


to

return new EplModule();


Cheers,
Dimitris
Re: Using Epsilon in Java [message #1470288 is a reply to message #1469080] Wed, 12 November 2014 08:11 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi Dimitris,
Thanks in advanced:)
This was indeed missing and works fine now:)

[Updated on: Sun, 16 November 2014 18:56]

Report message to a moderator

Re: Using Epsilon in Java [message #1475974 is a reply to message #1470288] Sun, 16 November 2014 18:54 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi,
After using the Epsilon in java application (Standalone epsilon) I've faced with a problem for interactive Epsilon codes that used the IUserinput interface. In fact, I get this error:
"Undefined variable, type or model: 'Iuserinput'.
I searched on this forum and see this topic: http://www.eclipse.org/forums/index.php/t/209012/. I follow this topic and it seems that this problem is solved, But I can't use Iuserinputs in any Epsilon language!
My question is, if this problem is solved, why it doesn't work in Epsilon 1.2?

Regards
Re: Using Epsilon in Java [message #1477452 is a reply to message #1475974] Mon, 17 November 2014 22:57 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

Does the following work for you?

EolModule module = new EolModule();
module.parse("System.user.prompt('1+1=?').println();");
module.execute();


Cheers,
Dimitris
Re: Using Epsilon in Java [message #1477871 is a reply to message #1477452] Tue, 18 November 2014 07:17 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi dear Dimitris,
Yes, it truly works. But when I use the 'System.user.prompt('1+1=?')' in EOL, it can not be recognized as defined type.
Re: Using Epsilon in Java [message #1478547 is a reply to message #1477871] Tue, 18 November 2014 19:38 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

This seems to be working fine in the Epsilon 1.2 development tools. Could you please elaborate a bit more on this?

Cheers,
Dimitris
Re: Using Epsilon in Java [message #1479291 is a reply to message #1478547] Wed, 19 November 2014 10:08 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi Dimitris,
I Use 'System.user.prompt('1+1=?')' in Epsilon code and when I run this epsilon code, I get one dialog box for prompting the value. But when I run this Epsilon code via Java, I get this error:
Exception in thread "main" Undefined variable, type or model: 'System'

I've attached one simple example. In this example, The epsilon code (pattern.epl) uses the 'System.user.prompt('1+1=?')' and run successfully. When I run this epsilon by the commands of java in 'EplCodes.java' I get the above error! I think that something are lost in my codes!
Regards...
Re: Using Epsilon in Java [message #1479455 is a reply to message #1479291] Wed, 19 November 2014 12:46 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

Sorry about that. This has been now fixed in the SVN. If you're not running Epsilon from source, replacing your createModule() method with the following should do the trick.

@Override
public IEolExecutableModule createModule() {
	EplModule module = EplModule();
	module.getContext().getFrameStack().putGlobal(Variable.createReadOnlyVariable("System",new EolSystem()));
	return module;
}


Cheers,
Dimitris

[Updated on: Wed, 19 November 2014 12:46]

Report message to a moderator

Re: Using Epsilon in Java [message #1485979 is a reply to message #1479455] Mon, 24 November 2014 18:17 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi Dimitris,
Thanks again for your reply and excuse me for the my late reply.
I change createModule() but I think this is necessary to change execute method, So What url of SVN can help me to see this fixed standalone example?
Regards

[Updated on: Mon, 24 November 2014 18:19]

Report message to a moderator

Re: Using Epsilon in Java [message #1492512 is a reply to message #1485979] Sat, 29 November 2014 23:03 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

Apologies for the slow response. Why is it necessary to change the execute method? To get a copy of the bleeding-edge version of Epsilon that contains the fix to EplModule, you'll need to check out the source from the SVN: https://www.eclipse.org/epsilon/doc/articles/epsilon-source-svn/

Cheers,
Dimitris
Re: Using Epsilon in Java [message #1495997 is a reply to message #1492512] Tue, 02 December 2014 17:48 Go to previous message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi Dimitris,
Thanks for your reply. Your answers always help me.
I changed createModule() method to :
@Override
	public IEolExecutableModule createModule() {
		EplModule module =new  EplModule();
		EolSystem system = new EolSystem();
		 system.setContext(module.getContext());
	module.getContext().getFrameStack().putGlobal(Variable.createReadOnlyVariable("System",system));
		return module;
		}

Now 'system' is recognized as a type and this works true.
I meant to change the 'execute()' method for getting the windowed input-apologies for any confusion caused. I checked the several versions of standalone example and there isn't windowed input case in them.
I replaced the default userInput to a JFaceUserInput in execute() method, but I got another errors on 'org.eclipse.jface.dialogs.IInputValidator'. Now I'm trying to correct it...

[Updated on: Tue, 02 December 2014 17:55]

Report message to a moderator

Previous Topic:[EWL] EMF proxies resolving
Next Topic:Starting with EGL
Goto Forum:
  


Current Time: Tue Apr 16 08:57:00 GMT 2024

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

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

Back to the top