Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [eol] question about usage of native types
[eol] question about usage of native types [message #664913] Tue, 12 April 2011 13:29 Go to next message
m kranz is currently offline m kranz
Messages: 69
Registered: January 2010
Member
hi

i experimented with using native types in an ewl file. while the example from the book works

var frame = new Native("javax.swing.JFrame");

when i try to instance something else like

var util = new Native("org.eclipse.emf.ecore.util.EcoreUtil");

it fails with a "type not found" error message.
is there a way to make it known to epsilon?

thanks in advance

marco
Re: [eol] question about usage of native types [message #664936 is a reply to message #664913] Tue, 12 April 2011 14:28 Go to previous messageGo to next message
m kranz is currently offline m kranz
Messages: 69
Registered: January 2010
Member
ok found the article.

http://www.eclipse.org/gmt/epsilon/doc/articles/call-java-fr om-epsilon/

maybe this should be added to the book, too.

cheers

marco

[Updated on: Tue, 12 April 2011 14:28]

Report message to a moderator

Re: [eol] question about usage of native types [message #664961 is a reply to message #664936] Tue, 12 April 2011 15:32 Go to previous messageGo to next message
m kranz is currently offline m kranz
Messages: 69
Registered: January 2010
Member
ok, after reading the guide i realized it's working only for your own projects / classes...
help appreciated.

thanks

marco
Re: [eol] question about usage of native types [message #665005 is a reply to message #664961] Tue, 12 April 2011 18:38 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 886
Registered: July 2009
Senior Member
Hi Marco,

I think it should actually be OK to also specify an existing class (that has an accessible constructor) in the "class" property of the extension.

Cheers,
Dimitris
Re: [eol] question about usage of native types [message #665163 is a reply to message #665005] Wed, 13 April 2011 14:03 Go to previous messageGo to next message
m kranz is currently offline m kranz
Messages: 69
Registered: January 2010
Member
hi dimitris

ah ok, didn't expect that to work.
besides that, it does not seem to work for internal classes
(tried it with "org.eclipse.emf.ecore.util.EcoreUtil.Copier").
instead i created a derived class now in my plugin, so it's not really
an issue.

cheers

marco
Re: [eol] question about usage of native types [message #665699 is a reply to message #665163] Fri, 15 April 2011 14:35 Go to previous messageGo to next message
m kranz is currently offline m kranz
Messages: 69
Registered: January 2010
Member
hi dimitris

i stumbled upon something else, maybe you can explain to me what is going on there.
what i do is, i create a org.eclipse.emf.ecore.util.EcoreUtil.Copier and deep-copy an UML Activity from my model.
(the activity contains some nodes and edges)

var ecoreUtil = new Native("myproject.MyCopier"); // extends org.eclipse.emf.ecore.util.EcoreUtil.Copier
var result = ecoreUtil.copy(self); // self is an uml Activity
ecoreUtil.copyReferences();
self.node.println(); // the sequence of contained nodes
result.node.println();

while the copying itself works just fine, the last line causes an exception stating "Property 'node' not found".
both 'self' and 'result' are of type Activity, and calling the java method .getNodes() (equivalent of '.node')
on them from eol gets the same results.
i guess it's something about how the objects are handled internally by epsilon,
maybe you can explain to me how this works (and if possible how to solve this).

cheers

marco
Re: [eol] question about usage of native types [message #665714 is a reply to message #665699] Fri, 15 April 2011 15:10 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 886
Registered: July 2009
Senior Member
Hi Marco,

http://www.eclipse.org/gmt/epsilon/examples/index.php?exampl e=org.eclipse.epsilon.examples.clone - and in particular the comments in clone.eol - should help with this.

Cheers,
Dimitris
Re: [eol] question about usage of native types [message #666149 is a reply to message #665714] Tue, 19 April 2011 11:03 Go to previous messageGo to next message
m kranz is currently offline m kranz
Messages: 69
Registered: January 2010
Member
hi dimitris

ok, that one was easy.
thanks a lot, as always. Smile

cheers

marco
Re: [eol] question about usage of native types [message #669324 is a reply to message #666149] Mon, 09 May 2011 22:17 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio Hoyos
Messages: 155
Registered: October 2009
Senior Member

Hello Marco and Dimitris,

Can you give me any pointers on this subject. I have followed the article instructions but I am still getting Type 'MyTool' Type not found error. I also followed marco's advise and wrapped the actual library I want to use in my own class. (I am running this from a standalone setup).

Regards,

Horacio


Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: [eol] question about usage of native types [message #669572 is a reply to message #669324] Tue, 10 May 2011 18:43 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 309
Registered: January 2010
Senior Member
Hi Horacio,

I believe that Epsilon tools are not available from a standalone setup, as these are loaded using Eclipse extension points. However, you should be able to create any class that is in your classpath through "new Native('...')".

Could you please try placing the class that you want to instantiate from EOL in the same classpath as the Java code which is launching your EOL scripts?

Cheers,
Antonio

[Updated on: Tue, 10 May 2011 18:44]

Report message to a moderator

Re: [eol] question about usage of native types [message #669587 is a reply to message #669572] Tue, 10 May 2011 20:17 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio Hoyos
Messages: 155
Registered: October 2009
Senior Member

Antonio,


My standalone setup is actually a set of plugins I run in my own RCP. I tried placing the class in the plugin's class path and it is still not found. This is what I have done using the extension point:

In my plugin.xml I have added the epsilon dt tools extension points to call my class:

...
<!-- Native Types used in Epsilon -->
    <extension point="org.eclipse.epsilon.common.dt.tool">
        <tool
            class="net.sourceforge.riskc.riskcopcode.generator.epsilon.RiskcSimMetrics"
            defaultName="SimMetrics">
        </tool>
    </extension>
...


In my manifest file I added the dt plugin as a required bundel:

...
Require-Bundle: org.eclipse.core.runtime,
 org.junit,
 org.eclipse.epsilon.common.dt,
 org.eclipse.epsilon.eol.engine,
 org.eclipse.epsilon.egl.engine,
 org.eclipse.epsilon.evl.engine,
 org.eclipse.epsilon.emc.emf,
...


Maybe I am missing something else? From my experience using the interactive mode in my other post, can it be that the egl is also not designed to work with native types?


Regards,

Horacio


Horacio Hoyos Rodriguez
EngD Student
University Of York

[Updated on: Tue, 10 May 2011 21:03]

Report message to a moderator

Re: [eol] question about usage of native types [message #669700 is a reply to message #669587] Wed, 11 May 2011 08:17 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 309
Registered: January 2010
Senior Member
Access to tools is another thing that is set up for you when you use the Epsilon launch configurations, but not when you simply use parse() and execute(). You will need to add the native type delegate which gives Epsilon access to your tool.

You can find the code you need to do that inside org.eclipse.epsilon.eol.dt.launching.EclipseContextManager#s etup(IEolContext). It's the last line in the method:
public static void setup(IEolContext context) {
  loadPrettyPrinters(context);
  loadIo(context);
  context.getNativeTypeDelegates().add(new ExtensionPointToolNativeTypeDelegate());
}


Please try that and tell us if it works for you.
Re: [eol] question about usage of native types [message #670867 is a reply to message #669700] Mon, 16 May 2011 01:10 Go to previous message
Horacio Hoyos is currently offline Horacio Hoyos
Messages: 155
Registered: October 2009
Senior Member

Antonio,

Thank you for your answer, it worked flawlessly!

Now I have to figure out what is the best place/moment to add this.. perhaps in the
public IEolExecutableModule createModule() 
method. Create the new specific type module, add the type delegate and return the module.


Best regards,

Horacio


Horacio Hoyos Rodriguez
EngD Student
University Of York

[Updated on: Mon, 16 May 2011 01:12]

Report message to a moderator

Previous Topic:[Epsilon] Standalone: interactive transformations
Next Topic:setMaximumSize
Goto Forum:
  


Current Time: Sun Oct 26 04:46:29 GMT 2014

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

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