Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Native from class in plug-in(Using ECL to instantiate a class thats declared in the plug-in)
Native from class in plug-in [message #1823054] Wed, 18 March 2020 22:22 Go to next message
Magnus Marthinsen is currently offline Magnus MarthinsenFriend
Messages: 9
Registered: January 2020
Junior Member
Hi!

I am creating a plug-in that is supposed to repair models. When the model is repaired, I would like to measure the distance between the fix and the original. I have downloaded a tool that is using ecl to measure the difference.

The tool has a Java-file that launches an ecl-module, which instantiates a Native. In the ecl-file, these are the first lines:
pre variables {
var simmetrics : new Native("org.epsilon.ecl.tools.textcomparison.simmetrics.SimMetricsTool");
var nrclasses: Real=Source!EClass.all.size();
var nrattributes: Real=Source!EAttribute.all.size();
var nrreferences: Real=Source!EReference.all.size();
}


I have tried it with a Main-method that tests two models and this works fine when it is called from the same workspace. My problem is when I launch the plug-in as an Eclipse Application and trigger the difference meassure, I get the following error:

Type 'org.epsilon.ecl.tools.textcomparison.simmetrics.SimMetricsTool' not found
	at (bundleresource://1205.fwk972537643:3/SimilarityMetamodelsChecker/epsilon/compare.ecl@2:21-2:93)
	at (bundleresource://1205.fwk972537643:3/SimilarityMetamodelsChecker/epsilon/compare.ecl@2:0-2:94)
	at (bundleresource://1205.fwk972537643:3/SimilarityMetamodelsChecker/epsilon/compare.ecl@2:0-2:94)
	at (bundleresource://1205.fwk972537643:3/SimilarityMetamodelsChecker/epsilon/compare.ecl@1:14-6:1)
	at (bundleresource://1205.fwk972537643:3/SimilarityMetamodelsChecker/epsilon/compare.ecl@1:0-68:1)


To me, this looks like it can't find the SimMetricsTool-class. Is there something I need to do in order for this to work from the launched eclipse workspace?

I have tried to add it as an extension from the plug-in with no luck:
<extension
         point="org.eclipse.epsilon.common.dt.tool">
      <tool
            class="org.epsilon.ecl.tools.textcomparison.simmetrics.SimMetricsTool"
            defaultName="SimMetricsTool">
      </tool>
</extension>


Any ideas?
Re: Native from class in plug-in [message #1823055 is a reply to message #1823054] Wed, 18 March 2020 22:29 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 Magnus,

We stopped maintaining this Simmetrics-based tool a few years ago I'm afraid. Please see https://www.eclipse.org/forums/index.php?t=msg&th=811996&goto=1423986&#msg_1423986.

Thanks,
Dimitris
Re: Native from class in plug-in [message #1823142 is a reply to message #1823055] Fri, 20 March 2020 08:32 Go to previous messageGo to next message
Magnus Marthinsen is currently offline Magnus MarthinsenFriend
Messages: 9
Registered: January 2020
Junior Member
Thank you for your reply Dimitris :)

I think we have followed the new guidelines. The tool I'm using has a Java-class that makes use of the Simmtrics-library. I'm not very familiar with Epsilon, but I don't think my problem has to do with the Simmetrics-library.

Somehow, the ecl-file is not able to find the Java-class SimMetricsTool.java when launched from a new Eclipse instance. If the ecl-file is called from a Main-method in the project it works fine, but if an action triggers the plug-in in a new Eclipse instance I get the error above.

Any ideas? I'm attaching an image of the project structure that might be helpful.

Magnus
Re: Native from class in plug-in [message #1823143 is a reply to message #1823142] Fri, 20 March 2020 08:35 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 Magnus,

Could you please send me a minimal example I can use to reproduce this?

Thanks,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: Native from class in plug-in [message #1823149 is a reply to message #1823143] Fri, 20 March 2020 11:16 Go to previous messageGo to next message
Magnus Marthinsen is currently offline Magnus MarthinsenFriend
Messages: 9
Registered: January 2020
Junior Member
I have now constructed a minimal example.

I am running Epsilon Core 1.5.1.201809302027 org.eclipse.epsilon.core.feature.feature.group Eclipse Modeling Project

To recreate the error:
1. Run the Main-class. Everything should work.
2. Run the project as an Eclipse Application
3. The new workspace has a menu-item "Minimal Example" with one menu item "Compare". Click that.
4. The application fails.

The Compare-action triggers a similar version of the comparison as the Main-file executes, but now it fails.

Thank you so much for taking the time to look at this!
Re: Native from class in plug-in [message #1823150 is a reply to message #1823149] Fri, 20 March 2020 11:29 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 Magnus,

Adding the following statement just before you execute your ECL module should do the trick, as per [1].

module.getContext().getNativeTypeDelegates().add(new ExtensionPointToolNativeTypeDelegate());


Thanks,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/call-java-from-epsilon/
Re: Native from class in plug-in [message #1823154 is a reply to message #1823150] Fri, 20 March 2020 12:19 Go to previous messageGo to next message
Magnus Marthinsen is currently offline Magnus MarthinsenFriend
Messages: 9
Registered: January 2020
Junior Member
It worked, thank you so much!

Best regards,
Magnus Marthinsen
Re: Native from class in plug-in [message #1823155 is a reply to message #1823154] Fri, 20 March 2020 12:49 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

You're welcome - I'm glad to hear this worked for you.

Thanks,
Dimitris
Previous Topic:excel spreadsheet could not resolve module.
Next Topic:Duplicate connections being drawn in GMF editor generated by Eugenia
Goto Forum:
  


Current Time: Sat Apr 27 02:33:17 GMT 2024

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

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

Back to the top