Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EGL] Arrays in Epsilon?
[EGL] Arrays in Epsilon? [message #1047873] Tue, 23 April 2013 19:34 Go to next message
Patricia Fernández is currently offline Patricia FernándezFriend
Messages: 41
Registered: October 2012
Member
Hello,

I've created a Java Tool which looks like this:

package pluginChooseModel;
...
public class ChooseModel extends JFrame{     
	public String WindowChooseModel (String[] models){
                ...
	}
}


I also added the operation in the EOL file:
operation chooseModel (models: List): String {
	var sampleTool = new Native("pluginChooseModel.ChooseModel");
	return sampleTool.WindowChooseModel(models);
} 


But when I try to use it in an EGL file:
var models:List; 
for (mod in Model.allInstances()){
	models.add(mod.name);
}
var e= chooseModel(models);


It gives me the following error Type 'pluginChooseModel.ChooseModel' not found. I added the jar to the source path and re-started Epsilon but it keeps giving me that error.

Could it be because I'm using a List as parameter instead of an array? If so, how can I declare an array in Epsilon? I tried many ways (like var a:[],var a: String[]...) but it doesn't work.

Thanks in advance.

[Updated on: Tue, 23 April 2013 19:34]

Report message to a moderator

Re: [EGL] Arrays in Epsilon? [message #1047921 is a reply to message #1047873] Tue, 23 April 2013 21:05 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Particia,

The error message you're receiving would indicate that the tool has not been registered successfully with Epsilon. Are your running your EGL template from a launch configuration or directly from Java?

Cheers,
Dimitris
Re: [EGL] Arrays in Epsilon? [message #1047935 is a reply to message #1047921] Tue, 23 April 2013 21:31 Go to previous messageGo to next message
Patricia Fernández is currently offline Patricia FernándezFriend
Messages: 41
Registered: October 2012
Member
Hi Dimistris,

I'm using a launch configuration.

Also, the project where pluginChooseModel is implemented contains other packages with tools and the other ones work ok.

But now I'm receiving this error:

Method 'WindowChooseModel' not found for: pluginChooseModel.ChooseModel[frame1,0,0,0x0,invalid,hidden,
layout=java.awt.BorderLayout,title=,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,
rootPane=javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,
border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]


Here is the full implementation of the tool, if needed:
package pluginChooseModel;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class ChooseModel extends JFrame{     
	public String WindowChooseModel (String[] models){
	    JFrame frame = new JFrame();
	    String name = (String) JOptionPane.showInputDialog(frame, 
	        "Select the name of the model you want to generate.",
	        "Choose the model",
	        JOptionPane.QUESTION_MESSAGE, 
	        null, 
	        models, 
	        models[0]);
	    return name;
	}
}

[Updated on: Tue, 23 April 2013 21:33]

Report message to a moderator

Re: [EGL] Arrays in Epsilon? [message #1048537 is a reply to message #1047935] Wed, 24 April 2013 16:02 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Patricia,

This is a different error message which, as you suspected, is a result of the incompatibility between String[] and List. Changing "String[] models" to "List models" in your operation signature would probably do the trick.

Cheers,
Dimitris
Re: [EGL] Arrays in Epsilon? [message #1048681 is a reply to message #1048537] Wed, 24 April 2013 20:31 Go to previous messageGo to next message
Patricia Fernández is currently offline Patricia FernándezFriend
Messages: 41
Registered: October 2012
Member
Hi Dimitris,

I tried that, but it keeps failing when I run the EGL file.

public String windowChooseModel (List m){ 
	    String models[] = m.getItems(); 
	    JFrame frame = new JFrame();
	    String name= (String) JOptionPane.showInputDialog(frame, 
	        "Select the name of the model you want to generate.",
	        "Choose the model",
	        JOptionPane.QUESTION_MESSAGE, 
	        null, 
	        models, 
	        models[0]); 
	    return name; 
	}

[Updated on: Wed, 24 April 2013 20:35]

Report message to a moderator

Re: [EGL] Arrays in Epsilon? [message #1049018 is a reply to message #1048681] Thu, 25 April 2013 08:33 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Patricia,

Could you please put together a minimal example [1] I can use to reproduce/investigate this?

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [EGL] Arrays in Epsilon? [message #1049150 is a reply to message #1049018] Thu, 25 April 2013 12:47 Go to previous messageGo to next message
Patricia Fernández is currently offline Patricia FernándezFriend
Messages: 41
Registered: October 2012
Member
Hi Dimitris,

Of course! I attach the following files:

- MinimalEGL.zip: Contains the .egl and .eol files and an uml model.
- PluginMinimal.zip: Contains the java tool.
- pluginMinimal.jar: The exported file from PluginMinimal.

Thanks for your time.
Cheers.
Re: [EGL] Arrays in Epsilon? [message #1049775 is a reply to message #1049150] Fri, 26 April 2013 08:59 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Patricia,

In your ChooseModel class you should use java.util.List instead of java.awt.List.

Cheers,
Dimitris
Re: [EGL] Arrays in Epsilon? [message #1049898 is a reply to message #1049775] Fri, 26 April 2013 12:27 Go to previous message
Patricia Fernández is currently offline Patricia FernándezFriend
Messages: 41
Registered: October 2012
Member
Hi Dimitris,

I tried it and it works now, thank you so much for the help.

[Updated on: Fri, 26 April 2013 12:27]

Report message to a moderator

Previous Topic:[EVL] Custom validation messages
Next Topic:Collapseble nodes?
Goto Forum:
  


Current Time: Fri Mar 29 11:38:46 GMT 2024

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

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

Back to the top