|
1
|
|
package abbot.editor.editors;
|
|
2
|
|
|
|
3
|
|
import java.awt.GridLayout;
|
|
4
|
|
import java.awt.event.ActionEvent;
|
|
5
|
|
import java.lang.reflect.*;
|
|
6
|
|
import java.util.*;
|
|
7
|
|
|
|
8
|
|
import javax.swing.*;
|
|
9
|
|
|
|
10
|
|
import abbot.i18n.Strings;
|
|
11
|
|
import abbot.script.Launch;
|
|
12
|
|
import abbot.editor.widgets.ArrayEditor;
|
|
13
|
|
import abbot.util.PathClassLoader;
|
|
14
|
|
|
|
15
|
|
|
|
16
|
|
public class LaunchEditor extends CallEditor {
|
|
17
|
|
|
|
18
|
|
private Launch launch;
|
|
19
|
|
|
|
20
|
|
private ArrayEditor classpath;
|
|
21
|
|
private JCheckBox thread;
|
|
22
|
|
|
|
23
|
|
public static final String HELP_DESC = Strings.get("FixClassname");
|
|
24
|
|
|
|
25
|
8
|
public LaunchEditor(Launch launch) {
|
|
26
|
8
|
super(launch);
|
|
27
|
8
|
this.launch = launch;
|
|
28
|
|
|
|
29
|
8
|
String[] paths =
|
|
30
|
|
PathClassLoader.convertPathToFilenames(launch.getClasspath());
|
|
31
|
|
|
|
32
|
|
|
|
33
|
|
|
|
34
|
8
|
classpath = addArrayEditor(Strings.get("Classpath"), paths);
|
|
35
|
8
|
classpath.setName(TAG_CLASSPATH);
|
|
36
|
|
|
|
37
|
8
|
thread = addCheckBox(Strings.get("Thread"), launch.isThreaded());
|
|
38
|
8
|
thread.setName(TAG_THREADED);
|
|
39
|
|
}
|
|
40
|
|
|
|
41
|
|
|
|
42
|
0
|
protected String[] getMethodNames(Method[] mlist) {
|
|
43
|
0
|
ArrayList list = new ArrayList();
|
|
44
|
0
|
int mask = Modifier.PUBLIC | Modifier.STATIC;
|
|
45
|
0
|
for (int i=0;i < mlist.length;i++) {
|
|
46
|
0
|
if ((mlist[i].getModifiers() & mask) == mask) {
|
|
47
|
0
|
list.add(mlist[i].getName());
|
|
48
|
|
}
|
|
49
|
|
}
|
|
50
|
0
|
return (String[])list.toArray(new String[list.size()]);
|
|
51
|
|
}
|
|
52
|
|
|
|
53
|
52
|
public void actionPerformed(ActionEvent ev) {
|
|
54
|
52
|
Object src = ev.getSource();
|
|
55
|
52
|
if (src == classpath) {
|
|
56
|
42
|
Object[] values = classpath.getValues();
|
|
57
|
42
|
String cp = null;
|
|
58
|
42
|
if (values.length > 0) {
|
|
59
|
42
|
StringBuffer buf = new StringBuffer();
|
|
60
|
42
|
for (int i=0;i < values.length;i++) {
|
|
61
|
43
|
if (i > 0)
|
|
62
|
1
|
buf.append(System.getProperty("path.separator"));
|
|
63
|
43
|
String path = (String)values[i];
|
|
64
|
43
|
if ("".equals(path))
|
|
65
|
5
|
path = ".";
|
|
66
|
43
|
buf.append(path);
|
|
67
|
|
}
|
|
68
|
42
|
cp = buf.toString();
|
|
69
|
|
}
|
|
70
|
42
|
launch.setClasspath(cp);
|
|
71
|
|
|
|
72
|
|
|
|
73
|
42
|
validateTargetClass();
|
|
74
|
42
|
validateMethod();
|
|
75
|
42
|
fireStepChanged();
|
|
76
|
|
}
|
|
77
|
10
|
else if (src == thread) {
|
|
78
|
1
|
launch.setThreaded(!launch.isThreaded());
|
|
79
|
1
|
fireStepChanged();
|
|
80
|
|
}
|
|
81
|
|
else {
|
|
82
|
9
|
super.actionPerformed(ev);
|
|
83
|
|
}
|
|
84
|
|
|
|
85
|
|
|
|
86
|
52
|
if (HELP_DESC.equals(launch.getDescription())) {
|
|
87
|
3
|
launch.setDescription(null);
|
|
88
|
3
|
fireStepChanged();
|
|
89
|
|
}
|
|
90
|
|
}
|
|
91
|
|
}
|
|
92
|
|
|