Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Native usage
Native usage [message #1855229] Mon, 03 October 2022 10:48 Go to next message
Ludovico Iovino is currently offline Ludovico IovinoFriend
Messages: 33
Registered: July 2019
Member
Hi folks,
I've been using Native constructs to load external Java libraries, but I'm struggling to load and use EqualityHelper.
I need to invoke the equals method, but even if I'm able to load EcoreUtil correctly via epsilon interface:
var emfTool : new Native("org.eclipse.epsilon.emc.emf.tools.EmfTool");
var ecoreutil = emfTool.ecoreUtil;

I can't do it the same for EqualityHelper which is a static class...do you have any suggestions?
Re: Native usage [message #1855230 is a reply to message #1855229] Mon, 03 October 2022 11:21 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Ludo,

To be able to instantiate a Java class as a Native type in EOL, the class needs to be registered using the org.eclipse.epsilon.common.dt.tool extension point in the containing plug-in's plugin.xml, as is the case with EmfTool (see https://git.eclipse.org/c/epsilon/org.eclipse.epsilon.git/tree/plugins/org.eclipse.epsilon.emc.emf.dt/plugin.xml#n48). Does this help?

Thanks,
Dimitris
Re: Native usage [message #1855232 is a reply to message #1855230] Mon, 03 October 2022 12:25 Go to previous messageGo to next message
Ludovico Iovino is currently offline Ludovico IovinoFriend
Messages: 33
Registered: July 2019
Member
Maybe I'm missing something.
Here s my plugin.xml
<plugin>
<extension
point="org.eclipse.epsilon.common.dt.tool">
<tool
class="org.eclipse.emf.ecore.util.EcoreUtil.EqualityHelper"
defaultName="equalityhelper">
</tool>
</extension>
</plugin>
and in ETL:
var equalityhelper = new Native("org.eclipse.emf.ecore.util.EcoreUtil.EqualityHelper");
but still:
Type 'org.eclipse.emf.ecore.util.EcoreUtil.EqualityHelper' not found
Re: Native usage [message #1855234 is a reply to message #1855232] Mon, 03 October 2022 14:54 Go to previous messageGo to next message
Ludovico Iovino is currently offline Ludovico IovinoFriend
Messages: 33
Registered: July 2019
Member
Actually i managed to make it work with:
var equalityhelper : new Native("org.eclipse.emf.ecore.util.EcoreUtil$EqualityHelper");
Re: Native usage [message #1855239 is a reply to message #1855234] Mon, 03 October 2022 17:14 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Many thanks for sharing your solution! It'd be great if you could add a few sentences about this in a pull request for https://github.com/eclipse/epsilon-website/blob/master/mkdocs/docs/doc/articles/call-java-from-epsilon/index.md

Cheers,
Dimitris
Re: Native usage [message #1855247 is a reply to message #1855239] Tue, 04 October 2022 09:40 Go to previous message
Ludovico Iovino is currently offline Ludovico IovinoFriend
Messages: 33
Registered: July 2019
Member
Yes I'll do that. Thanks
Previous Topic:JavaDoc documentation of IModel
Next Topic:Unconventional naming of antlib descriptor
Goto Forum:
  


Current Time: Fri Apr 26 21:08:53 GMT 2024

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

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

Back to the top