Home » Modeling » Epsilon » [EGL] Arrays in Epsilon?
[EGL] Arrays in Epsilon? [message #1047873] |
Tue, 23 April 2013 19:34 |
Patricia Fernández 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 |
|
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 |
Patricia Fernández 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 |
|
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 |
Patricia Fernández 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
|
|
| | | | |
Goto Forum:
Current Time: Thu Apr 25 17:24:36 GMT 2024
Powered by FUDForum. Page generated in 0.03295 seconds
|