Revision 1428
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.scripting.swing</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.scripting</artifactId> |
|
11 |
<version>2.3.130</version> |
|
12 |
</parent> |
|
13 |
<modules> |
|
14 |
<module>org.gvsig.scripting.swing.api</module> |
|
15 |
<module>org.gvsig.scripting.swing.impl</module> |
|
16 |
</modules> |
|
17 |
</project> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
DefaultExampleManager class. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.scripting.impl.DefaultExampleManager"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
|
|
26 |
<!-- |
|
27 |
By default, show only logging messages of INFO level or higher, |
|
28 |
through the previously configured CONSOLE appender. |
|
29 |
--> |
|
30 |
<root> |
|
31 |
<priority value="INFO" /> |
|
32 |
<appender-ref ref="CONSOLE" /> |
|
33 |
</root> |
|
34 |
</log4j:configuration> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/resources/README.txt | ||
---|---|---|
1 |
#set( $symbol_pound = '#' ) |
|
2 |
#set( $symbol_dollar = '$' ) |
|
3 |
#set( $symbol_escape = '\' ) |
|
4 |
Put into this folder the resources needed by your test classes. |
|
5 |
|
|
6 |
This folder is added to the Tests classpath, so you can load any resources |
|
7 |
through the ClassLoader. |
|
8 |
|
|
9 |
By default, in this folder you can find an example of log4j configuration, |
|
10 |
prepared to log messages through the console, so logging works when you |
|
11 |
run your tests classes. |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/MyTestJScriptableThinlet.java | ||
---|---|---|
1 |
package org.gvsig.scripting; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.io.File; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
|
|
8 |
import org.gvsig.scripting.swing.api.JThinlet; |
|
9 |
import org.gvsig.scripting.swing.impl.DefaultJThinlet; |
|
10 |
|
|
11 |
public class MyTestJScriptableThinlet { |
|
12 |
|
|
13 |
public static void main(String[] args) { |
|
14 |
|
|
15 |
// Creamos el JPanel del thinlet y le |
|
16 |
// cargamos el xml de pruebas. |
|
17 |
JThinlet panel = new DefaultJThinlet(new File("/home/jobacas/ScriptFramework/org.gvsig.scripting/src/org/gvsig/scripting/impl/xul/thing.xml")); |
|
18 |
|
|
19 |
JFrame frame = new JFrame("TEST JScriptableThinlet"); |
|
20 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
21 |
frame.setLayout(new BorderLayout()); |
|
22 |
frame.setSize(500, 400); |
|
23 |
// Añadimos el JPanel del thinlet al frame. |
|
24 |
frame.add(panel, BorderLayout.CENTER); |
|
25 |
//frame.pack(); |
|
26 |
frame.setVisible(true); |
|
27 |
|
|
28 |
} |
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 |
|
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/impl/MyTestDefaultJThinG.java | ||
---|---|---|
1 |
package org.gvsig.scripting.impl; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
|
|
5 |
import javax.swing.JFrame; |
|
6 |
|
|
7 |
import org.gvsig.scripting.swing.impl.DefaultJThinG; |
|
8 |
|
|
9 |
public class MyTestDefaultJThinG { |
|
10 |
|
|
11 |
public static void main(String[] args) { |
|
12 |
|
|
13 |
// Creamos el JPanel del thinlet y le |
|
14 |
// cargamos el xml de pruebas. |
|
15 |
DefaultJThinG panel = new DefaultJThinG(); |
|
16 |
|
|
17 |
JFrame frame = new JFrame("TEST JScriptableThinlet"); |
|
18 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
19 |
frame.setLayout(new BorderLayout()); |
|
20 |
frame.setSize(500, 400); |
|
21 |
// Añadimos el JPanel del thinlet al frame. |
|
22 |
frame.add(panel, BorderLayout.CENTER); |
|
23 |
frame.pack(); |
|
24 |
frame.setVisible(true); |
|
25 |
|
|
26 |
} |
|
27 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/MyTestJScriptableThinG.java | ||
---|---|---|
1 |
package org.gvsig.scripting; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
|
|
5 |
import javax.swing.JFrame; |
|
6 |
|
|
7 |
import org.gvsig.scripting.swing.impl.DefaultJThinG; |
|
8 |
|
|
9 |
public class MyTestJScriptableThinG { |
|
10 |
|
|
11 |
public static void main(String[] args) { |
|
12 |
|
|
13 |
// Creamos el JPanel del thinlet y le |
|
14 |
// cargamos el xml de pruebas. |
|
15 |
DefaultJThinG panel = new DefaultJThinG(); |
|
16 |
|
|
17 |
JFrame frame = new JFrame("TEST JScriptableThinlet"); |
|
18 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
19 |
frame.setLayout(new BorderLayout()); |
|
20 |
frame.setSize(500, 400); |
|
21 |
// Añadimos el JPanel del thinlet al frame. |
|
22 |
frame.add(panel, BorderLayout.CENTER); |
|
23 |
//frame.pack(); |
|
24 |
frame.setVisible(true); |
|
25 |
|
|
26 |
} |
|
27 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/MyTestJScriptingBrowser.java | ||
---|---|---|
1 |
package org.gvsig.scripting; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Dimension; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
import javax.swing.JPanel; |
|
8 |
|
|
9 |
import org.gvsig.scripting.swing.api.ScriptingSwingLocator; |
|
10 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
11 |
import org.gvsig.scripting.swing.impl.DefaultJScriptingBrowser; |
|
12 |
|
|
13 |
public class MyTestJScriptingBrowser extends JPanel { |
|
14 |
|
|
15 |
/** |
|
16 |
* |
|
17 |
*/ |
|
18 |
private static final long serialVersionUID = 1L; |
|
19 |
private DefaultJScriptingBrowser treePanel; |
|
20 |
|
|
21 |
public MyTestJScriptingBrowser() { |
|
22 |
super(new BorderLayout()); |
|
23 |
|
|
24 |
// Inicializamos las librerías |
|
25 |
ScriptingLibrary lib = new ScriptingLibrary(); |
|
26 |
lib.initialize(); |
|
27 |
|
|
28 |
|
|
29 |
// Asignamos el locator e iniciamos la instancia |
|
30 |
|
|
31 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
32 |
ScriptingManager manager = uimanager.getManager(); |
|
33 |
treePanel = new DefaultJScriptingBrowser(uimanager, manager.getUserFolder()); |
|
34 |
|
|
35 |
// Establecemos algunas características del JPanel |
|
36 |
treePanel.setPreferredSize(new Dimension(500, 800)); |
|
37 |
add(treePanel, BorderLayout.CENTER); |
|
38 |
; |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* Create the GUI and show it. For thread safety, |
|
43 |
* this method should be invoked from the |
|
44 |
* event-dispatching thread. |
|
45 |
*/ |
|
46 |
private static void createAndShowGUI() { |
|
47 |
//Create and set up the window. |
|
48 |
JFrame frame = new JFrame("TEST ScriptUserBrowser"); |
|
49 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
50 |
|
|
51 |
//Create and set up the content pane. |
|
52 |
MyTestJScriptingBrowser newContentPane = new MyTestJScriptingBrowser(); |
|
53 |
newContentPane.setOpaque(true); //content panes must be opaque |
|
54 |
frame.getContentPane().add(newContentPane, BorderLayout.CENTER); |
|
55 |
|
|
56 |
//Display the window. |
|
57 |
frame.pack(); |
|
58 |
frame.setVisible(true); |
|
59 |
} |
|
60 |
|
|
61 |
public static void main(String[] args) { |
|
62 |
|
|
63 |
//Iniciamos el test |
|
64 |
javax.swing.SwingUtilities.invokeLater(new Runnable() { |
|
65 |
public void run() { |
|
66 |
createAndShowGUI(); |
|
67 |
} |
|
68 |
}); |
|
69 |
} |
|
70 |
|
|
71 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/MyTestLauncher.java | ||
---|---|---|
1 |
package org.gvsig.scripting; |
|
2 |
|
|
3 |
import javax.swing.JFrame; |
|
4 |
import javax.swing.JPanel; |
|
5 |
|
|
6 |
|
|
7 |
public class MyTestLauncher extends JPanel { |
|
8 |
|
|
9 |
/** |
|
10 |
* |
|
11 |
*/ |
|
12 |
private static final long serialVersionUID = 1L; |
|
13 |
|
|
14 |
|
|
15 |
public static void main( String args[] ) { |
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
// Inicializamos las librerías |
|
20 |
/* |
|
21 |
ScriptingLibrary lib = new ScriptingLibrary(); |
|
22 |
lib.initialize(); |
|
23 |
|
|
24 |
// Asignamos el locator e iniciamos la instancia |
|
25 |
ScriptingUIManager uimanager = ScriptingLocator.getUIManager(); |
|
26 |
ScriptingManager manager = uimanager.getManager(); |
|
27 |
|
|
28 |
URL u = TestLauncher.class.getClassLoader().getResource("org/gvsig/scripting/impl/scripts/"); |
|
29 |
File f = new File(u.getPath()); |
|
30 |
manager.registerSystemFolder("Tests", f); |
|
31 |
*/ |
|
32 |
|
|
33 |
JFrame frame = new JFrame("TEST Launcher"); |
|
34 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
35 |
|
|
36 |
//Create and set up the content pane. |
|
37 |
// JScriptingLauncher newContentPane = new JScriptingLauncher(uimanager); |
|
38 |
// newContentPane.setOpaque(true); //content panes must be opaque |
|
39 |
// frame.setContentPane(newContentPane); |
|
40 |
|
|
41 |
//Display the window. |
|
42 |
frame.pack(); |
|
43 |
frame.setSize( 250,400 ); |
|
44 |
frame.setVisible(true); |
|
45 |
|
|
46 |
} |
|
47 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/TestComposer.java | ||
---|---|---|
1 |
package org.gvsig.scripting; |
|
2 |
|
|
3 |
import javax.swing.JPanel; |
|
4 |
|
|
5 |
import org.gvsig.scripting.swing.api.ScriptingSwingLocator; |
|
6 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
7 |
|
|
8 |
public class TestComposer extends JPanel { |
|
9 |
|
|
10 |
/** |
|
11 |
* |
|
12 |
*/ |
|
13 |
private static final long serialVersionUID = 1L; |
|
14 |
|
|
15 |
|
|
16 |
public static void main( String args[] ) { |
|
17 |
// Asignamos el locator e iniciamos la instancia |
|
18 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
19 |
ScriptingManager manager = uimanager.getManager(); |
|
20 |
|
|
21 |
/* URL u = TestLauncher.class.getClassLoader().getResource("org/gvsig/scripting/impl/scripts/"); |
|
22 |
File f = new File(u.getPath()); |
|
23 |
manager.registerSystemFolder("Tests", f); |
|
24 |
*/ |
|
25 |
|
|
26 |
uimanager.createComposer(); |
|
27 |
|
|
28 |
} |
|
29 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/swing/impl/composer/TestJMoveScriptModel.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.impl.composer; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import junit.framework.Assert; |
|
6 |
|
|
7 |
import org.gvsig.scripting.ScriptingFolder; |
|
8 |
import org.gvsig.scripting.ScriptingLocator; |
|
9 |
import org.gvsig.scripting.ScriptingManager; |
|
10 |
import org.gvsig.scripting.ScriptingScript; |
|
11 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
12 |
|
|
13 |
public class TestJMoveScriptModel extends AbstractLibraryAutoInitTestCase { |
|
14 |
|
|
15 |
protected ScriptingManager manager; |
|
16 |
protected JMoveScriptModel model; |
|
17 |
|
|
18 |
@Override |
|
19 |
protected void doSetUp() throws Exception { |
|
20 |
manager = ScriptingLocator.getManager(); |
|
21 |
} |
|
22 |
|
|
23 |
public void setWorkingFolder(){ |
|
24 |
File file =new File(this.getClass().getClassLoader().getResource("org/gvsig/scripting/home").getFile()); |
|
25 |
// FIXME: hay que sustituirlo por manager.setHomeFolder(home) |
|
26 |
// manager.setRootUserFolder(file.getAbsolutePath()); |
|
27 |
} |
|
28 |
|
|
29 |
public void testMove() { |
|
30 |
setWorkingFolder(); |
|
31 |
ScriptingFolder folder = (ScriptingFolder) manager.createUnit(ScriptingManager.UNIT_FOLDER, manager.getUserFolder(), "test"); |
|
32 |
ScriptingScript script = (ScriptingScript) manager.createUnit(ScriptingManager.UNIT_SCRIPT, manager.getUserFolder(), "testScript01"); |
|
33 |
model = new JMoveScriptModel(manager,script); |
|
34 |
model.setMoveTo(folder.getFile()); |
|
35 |
try { |
|
36 |
model.validate(); |
|
37 |
} catch (Exception e) { |
|
38 |
Assert.fail("The data model is correct. Validation couldn't fail"); |
|
39 |
} |
|
40 |
script.move(folder); |
|
41 |
Assert.assertEquals(folder.getFile().getAbsolutePath(), model.getUnit().getParent().getFile().getAbsolutePath()); |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
public void testMoveWithSameName() { |
|
46 |
setWorkingFolder(); |
|
47 |
ScriptingFolder folder = (ScriptingFolder) manager.createUnit(ScriptingManager.UNIT_FOLDER, manager.getUserFolder(), "test"); |
|
48 |
ScriptingScript script1 = (ScriptingScript) manager.createUnit(ScriptingManager.UNIT_SCRIPT, manager.getUserFolder(), "testScript01"); |
|
49 |
manager.createUnit(ScriptingManager.UNIT_SCRIPT, folder, "testScript01"); |
|
50 |
model = new JMoveScriptModel(manager,script1); |
|
51 |
model.setMoveTo(folder.getFile()); |
|
52 |
try { |
|
53 |
model.validate(); |
|
54 |
} catch (Exception e) { |
|
55 |
Assert.assertEquals("This file already exists.\nWrite another name for the script",e.getMessage()); |
|
56 |
} |
|
57 |
Assert.assertFalse(script1.move(folder)); |
|
58 |
} |
|
59 |
|
|
60 |
public void testMoveToAnInvalidDestination() { |
|
61 |
setWorkingFolder(); |
|
62 |
ScriptingScript script = (ScriptingScript) manager.createUnit(ScriptingManager.UNIT_SCRIPT, manager.getUserFolder(), "testScript01"); |
|
63 |
model = new JMoveScriptModel(manager,script); |
|
64 |
|
|
65 |
model.setMoveTo(""); |
|
66 |
try { |
|
67 |
model.validate(); |
|
68 |
} catch (Exception e) { |
|
69 |
Assert.assertEquals("Destination must not be empty.",e.getMessage()); |
|
70 |
} |
|
71 |
|
|
72 |
model.setMoveTo("/not/a/valid/path"); |
|
73 |
try { |
|
74 |
model.validate(); |
|
75 |
} catch (Exception e) { |
|
76 |
Assert.assertEquals("Not a valid destination.",e.getMessage()); |
|
77 |
} |
|
78 |
} |
|
79 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/swing/impl/composer/TestJNewScriptModel.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.impl.composer; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import junit.framework.Assert; |
|
6 |
|
|
7 |
import org.gvsig.scripting.ScriptingFolder; |
|
8 |
import org.gvsig.scripting.ScriptingLocator; |
|
9 |
import org.gvsig.scripting.ScriptingManager; |
|
10 |
import org.gvsig.scripting.ScriptingUnit; |
|
11 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
12 |
|
|
13 |
public class TestJNewScriptModel extends AbstractLibraryAutoInitTestCase { |
|
14 |
|
|
15 |
protected ScriptingManager manager; |
|
16 |
// protected JNewScriptModel model; |
|
17 |
// protected JNewScriptModel model2; |
|
18 |
// |
|
19 |
@Override |
|
20 |
protected void doSetUp() throws Exception { |
|
21 |
manager = ScriptingLocator.getManager(); |
|
22 |
} |
|
23 |
|
|
24 |
// public void setWorkingFolder(){ |
|
25 |
// File file =new File(this.getClass().getClassLoader().getResource("org/gvsig/scripting/home").getFile()); |
|
26 |
// if (!file.exists()) { |
|
27 |
// file.mkdir(); |
|
28 |
// } |
|
29 |
//// FIXME: hay que sustituirlo por manager.setHomeFolder(home) |
|
30 |
//// manager.setRootUserFolder(file.getAbsolutePath()); |
|
31 |
// } |
|
32 |
// |
|
33 |
// public void testCreate(){ |
|
34 |
// setWorkingFolder(); |
|
35 |
// model.setType(ScriptingManager.UNIT_SCRIPT); |
|
36 |
// model.setName("TestScript01"); |
|
37 |
// model.setDescription("Test Script 01"); |
|
38 |
// model.setCreatedBy("Anonymus"); |
|
39 |
// model.setVersion("v0.1"); |
|
40 |
// model.setPath(manager.getRootUserFolder()); |
|
41 |
// try { |
|
42 |
// model.validate(); |
|
43 |
// } catch (Exception e) { |
|
44 |
// Assert.fail("The data model is correct. Validation couldn't fail"); |
|
45 |
// } |
|
46 |
// } |
|
47 |
// |
|
48 |
// public void testCreateWithEmptyName() { |
|
49 |
// testCreate(); |
|
50 |
// model.setType(ScriptingManager.UNIT_SCRIPT); |
|
51 |
// model.setName(""); |
|
52 |
// model.setDescription("Test Script 01"); |
|
53 |
// model.setCreatedBy("Anonymus"); |
|
54 |
// model.setVersion("v0.1"); |
|
55 |
// model.setPath(manager.getRootUserFolder()); |
|
56 |
// try { |
|
57 |
// model.validate(); |
|
58 |
// } catch (Exception e) { |
|
59 |
// Assert.assertEquals(e.getMessage(), "Name must not be empty."); |
|
60 |
// } |
|
61 |
// } |
|
62 |
// |
|
63 |
// public void testCreateWithSameName() { |
|
64 |
// testCreate(); |
|
65 |
// this.manager.createUnit( |
|
66 |
// model.getType(), |
|
67 |
// manager.getFolder(new File(model.getPath())), |
|
68 |
// model.getName()+model.getExtension() |
|
69 |
// ); |
|
70 |
// |
|
71 |
// model.setType(ScriptingManager.UNIT_SCRIPT); |
|
72 |
// model.setName("TestScript01"); |
|
73 |
// model.setDescription("Test Script 01"); |
|
74 |
// model.setCreatedBy("Anonymus"); |
|
75 |
// model.setVersion("v0.1"); |
|
76 |
// model.setPath(manager.getRootUserFolder()); |
|
77 |
// try { |
|
78 |
// model.validate(); |
|
79 |
// } catch (Exception e) { |
|
80 |
// Assert.assertEquals(e.getMessage(), "This file already exists.\nWrite another name for the script"); |
|
81 |
// |
|
82 |
// } |
|
83 |
// ScriptingUnit newFolder= this.manager.createUnit( |
|
84 |
// ScriptingManager.UNIT_FOLDER, |
|
85 |
// manager.getFolder(new File(model.getPath())), |
|
86 |
// "scripts" |
|
87 |
// ); |
|
88 |
// model.setPath(((ScriptingFolder) newFolder).getPath()); |
|
89 |
// try { |
|
90 |
// model.validate(); |
|
91 |
// } catch (Exception e) { |
|
92 |
// Assert.fail("The data model is correct. Validation couldn't fail"); |
|
93 |
// } |
|
94 |
// |
|
95 |
// } |
|
96 |
// |
|
97 |
// public void testCreateProjects() { |
|
98 |
// testCreate(); |
|
99 |
// |
|
100 |
// model.setType(ScriptingManager.UNIT_PROJECT); |
|
101 |
// model.setName("TestScript01"); |
|
102 |
// model.setDescription("Test Script 01"); |
|
103 |
// model.setCreatedBy("Anonymus"); |
|
104 |
// model.setVersion("v0.1"); |
|
105 |
// model.setPath(manager.getRootUserFolder()); |
|
106 |
// try { |
|
107 |
// model.validate(); |
|
108 |
// } catch (Exception e) { |
|
109 |
// Assert.assertEquals(e.getMessage(), "Projects will be supported in future versions"); |
|
110 |
// |
|
111 |
// } |
|
112 |
// } |
|
113 |
|
|
114 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/swing/impl/composer/TestJRemoveHelpModel.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.impl.composer; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.gvsig.scripting.ScriptingLocator; |
|
6 |
import org.gvsig.scripting.ScriptingManager; |
|
7 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
8 |
|
|
9 |
public class TestJRemoveHelpModel extends AbstractLibraryAutoInitTestCase { |
|
10 |
|
|
11 |
protected ScriptingManager manager; |
|
12 |
protected JMoveScriptModel model; |
|
13 |
|
|
14 |
@Override |
|
15 |
protected void doSetUp() throws Exception { |
|
16 |
manager = ScriptingLocator.getManager(); |
|
17 |
} |
|
18 |
|
|
19 |
public void setWorkingHelpFolder(){ |
|
20 |
File file =new File(this.getClass().getClassLoader().getResource("org/gvsig/scripting/home/help").getFile()); |
|
21 |
// FIXME: hay que sustituirlo por manager.setHomeFolder(home) |
|
22 |
// manager.getHelpManager().setFolder(file.getAbsolutePath()); |
|
23 |
} |
|
24 |
|
|
25 |
public void testMove() { |
|
26 |
setWorkingHelpFolder(); |
|
27 |
|
|
28 |
} |
|
29 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/swing/impl/composer/TestJRenameModel.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.impl.composer; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import junit.framework.Assert; |
|
6 |
|
|
7 |
import org.gvsig.scripting.ScriptingLocator; |
|
8 |
import org.gvsig.scripting.ScriptingManager; |
|
9 |
import org.gvsig.scripting.ScriptingScript; |
|
10 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
11 |
|
|
12 |
public class TestJRenameModel extends AbstractLibraryAutoInitTestCase { |
|
13 |
|
|
14 |
protected ScriptingManager manager; |
|
15 |
protected JRenameModel model; |
|
16 |
|
|
17 |
@Override |
|
18 |
protected void doSetUp() throws Exception { |
|
19 |
manager = ScriptingLocator.getManager(); |
|
20 |
} |
|
21 |
|
|
22 |
public void setWorkingFolder(){ |
|
23 |
File file =new File(this.getClass().getClassLoader().getResource("org/gvsig/scripting/home").getFile()); |
|
24 |
// FIXME: hay que sustituirlo por manager.setHomeFolder(home) |
|
25 |
// manager.setRootUserFolder(file.getAbsolutePath()); |
|
26 |
} |
|
27 |
|
|
28 |
public File getFile(String name){ |
|
29 |
return new File(manager.getRootUserFolder()+File.separator+name); |
|
30 |
} |
|
31 |
|
|
32 |
public void checkExistsFile(String fName){ |
|
33 |
File fscript = getFile(fName); |
|
34 |
Assert.assertTrue(fscript.exists()); |
|
35 |
} |
|
36 |
|
|
37 |
public void checkDoesntExistFile(String fName){ |
|
38 |
File fscript = getFile(fName); |
|
39 |
Assert.assertFalse(fscript.exists()); |
|
40 |
} |
|
41 |
|
|
42 |
public void testRename() { |
|
43 |
setWorkingFolder(); |
|
44 |
ScriptingScript script = (ScriptingScript) manager.createUnit(ScriptingManager.UNIT_SCRIPT, manager.getUserFolder(), "testScript01"); |
|
45 |
checkExistsFile("testScript01.py"); |
|
46 |
checkExistsFile("testScript01.inf"); |
|
47 |
|
|
48 |
model = new JRenameModel(manager,script); |
|
49 |
model.setNewName("testScript"); |
|
50 |
try { |
|
51 |
model.validate(); |
|
52 |
} catch (Exception e) { |
|
53 |
Assert.fail("The data model is correct. Validation couldn't fail"); |
|
54 |
} |
|
55 |
Assert.assertTrue(script.rename("testScript")); |
|
56 |
|
|
57 |
//Comprobamos que existen los ficheros con el nuevo nombre |
|
58 |
checkExistsFile("testScript.py"); |
|
59 |
checkExistsFile("testScript.inf"); |
|
60 |
|
|
61 |
//Confirmamos que han sido renombrados y no copiados |
|
62 |
checkDoesntExistFile("testScript01.py"); |
|
63 |
checkDoesntExistFile("testScript01.inf"); |
|
64 |
} |
|
65 |
|
|
66 |
public void testRenameSameName() { |
|
67 |
setWorkingFolder(); |
|
68 |
ScriptingScript script1 = (ScriptingScript) manager.createUnit(ScriptingManager.UNIT_SCRIPT, manager.getUserFolder(), "testScript01"); |
|
69 |
ScriptingScript script2 = (ScriptingScript) manager.createUnit(ScriptingManager.UNIT_SCRIPT, manager.getUserFolder(), "testScript02"); |
|
70 |
|
|
71 |
checkExistsFile(script2.getId()+".py"); |
|
72 |
checkExistsFile(script2.getId()+".inf"); |
|
73 |
|
|
74 |
model = new JRenameModel(manager,script1); |
|
75 |
model.setNewName(script2.getId()); |
|
76 |
try { |
|
77 |
model.validate(); |
|
78 |
} catch (Exception e) { |
|
79 |
Assert.assertEquals("This file already exists.\nWrite another name for the script",e.getMessage()); |
|
80 |
} |
|
81 |
Assert.assertFalse(script1.rename(script2.getId())); |
|
82 |
|
|
83 |
} |
|
84 |
|
|
85 |
public void testRenameWithEmptyNewName() { |
|
86 |
setWorkingFolder(); |
|
87 |
ScriptingScript script = (ScriptingScript) manager.createUnit(ScriptingManager.UNIT_SCRIPT, manager.getUserFolder(), "testScript01"); |
|
88 |
checkExistsFile("testScript01.py"); |
|
89 |
checkExistsFile("testScript01.inf"); |
|
90 |
|
|
91 |
model = new JRenameModel(manager,script); |
|
92 |
model.setNewName(""); |
|
93 |
try { |
|
94 |
model.validate(); |
|
95 |
} catch (Exception e) { |
|
96 |
Assert.assertEquals("Name must not be empty.",e.getMessage()); |
|
97 |
} |
|
98 |
|
|
99 |
checkExistsFile("testScript01.py"); |
|
100 |
checkExistsFile("testScript01.inf"); |
|
101 |
} |
|
102 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/org/gvsig/scripting/swing/syntaxhighlight/MyTest.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.syntaxhighlight; |
|
2 |
|
|
3 |
import javax.swing.JEditorPane; |
|
4 |
import javax.swing.JFrame; |
|
5 |
import javax.swing.JScrollPane; |
|
6 |
|
|
7 |
|
|
8 |
public class MyTest { |
|
9 |
public static void main(String a[]) |
|
10 |
{ |
|
11 |
|
|
12 |
/* final JEditorPane edit = new JEditorPaneSyntaxHighlighting(); |
|
13 |
edit.setContentType("text/java"); |
|
14 |
|
|
15 |
JFrame frame = new JFrame("Syntax Highlighting"); |
|
16 |
frame.getContentPane().add( new JScrollPane(edit) ); |
|
17 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
18 |
frame.setSize(800,300); |
|
19 |
frame.setVisible(true);*/ |
|
20 |
} |
|
21 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/test/java/README.txt | ||
---|---|---|
1 |
#set( $symbol_pound = '#' ) |
|
2 |
#set( $symbol_dollar = '$' ) |
|
3 |
#set( $symbol_escape = '\' ) |
|
4 |
For each class you are going to test, create one Test class with the same |
|
5 |
name as the class to test, ending with Test. |
|
6 |
|
|
7 |
For example, the unit tests of the "ExampleLibrary" class are performed |
|
8 |
by the "ExampleLibraryTest" class. |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.130/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/composer/DefaultJScriptingComposer.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.impl.composer; |
|
2 |
|
|
3 |
import org.gvsig.scripting.swing.impl.composer.components.DefaultDock; |
|
4 |
import org.gvsig.scripting.swing.impl.composer.components.DefaultProblems; |
|
5 |
import org.gvsig.scripting.swing.impl.composer.components.DefaultJTabbedPaneClosable; |
|
6 |
import java.awt.BorderLayout; |
|
7 |
import java.awt.Color; |
|
8 |
import java.awt.Dialog; |
|
9 |
import java.awt.Dimension; |
|
10 |
import java.awt.event.ActionEvent; |
|
11 |
import java.awt.event.ActionListener; |
|
12 |
import java.awt.event.KeyEvent; |
|
13 |
import java.beans.PropertyChangeEvent; |
|
14 |
import java.io.File; |
|
15 |
import java.util.ArrayList; |
|
16 |
import java.util.Collection; |
|
17 |
import java.util.Date; |
|
18 |
import java.util.HashSet; |
|
19 |
import java.util.Iterator; |
|
20 |
import java.util.LinkedHashMap; |
|
21 |
import java.util.List; |
|
22 |
import java.util.Map; |
|
23 |
import java.util.Set; |
|
24 |
import javax.swing.AbstractAction; |
|
25 |
import javax.swing.Action; |
|
26 |
import static javax.swing.Action.ACCELERATOR_KEY; |
|
27 |
import static javax.swing.Action.ACTION_COMMAND_KEY; |
|
28 |
import javax.swing.JButton; |
|
29 |
import javax.swing.JComponent; |
|
30 |
import javax.swing.JLabel; |
|
31 |
import javax.swing.JMenuBar; |
|
32 |
import javax.swing.JMenuItem; |
|
33 |
import javax.swing.JOptionPane; |
|
34 |
import javax.swing.JPanel; |
|
35 |
import javax.swing.JSplitPane; |
|
36 |
import javax.swing.JTabbedPane; |
|
37 |
import javax.swing.JToolBar; |
|
38 |
import javax.swing.KeyStroke; |
|
39 |
import javax.swing.SwingUtilities; |
|
40 |
import javax.swing.UIManager; |
|
41 |
import javax.swing.event.AncestorEvent; |
|
42 |
import javax.swing.event.AncestorListener; |
|
43 |
import javax.swing.event.ChangeEvent; |
|
44 |
import javax.swing.event.ChangeListener; |
|
45 |
import javax.swing.event.ListSelectionEvent; |
|
46 |
import javax.swing.text.JTextComponent; |
|
47 |
import org.apache.commons.io.FileUtils; |
|
48 |
import org.apache.commons.io.IOCase; |
|
49 |
import org.apache.commons.io.filefilter.FileFilterUtils; |
|
50 |
import org.fife.rsta.ui.GoToDialog; |
|
51 |
import org.fife.rsta.ui.search.FindDialog; |
|
52 |
import org.fife.rsta.ui.search.ReplaceDialog; |
|
53 |
import org.fife.rsta.ui.search.SearchEvent; |
|
54 |
import org.fife.rsta.ui.search.SearchListener; |
|
55 |
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; |
|
56 |
import org.fife.ui.rtextarea.SearchContext; |
|
57 |
import org.fife.ui.rtextarea.SearchEngine; |
|
58 |
import org.fife.ui.rtextarea.SearchResult; |
|
59 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
|
60 |
import org.gvsig.installer.swing.api.SwingInstallerManager; |
|
61 |
import org.gvsig.installer.swing.api.packagebuilder.PackageBuildder; |
|
62 |
import org.gvsig.scripting.CompileErrorException; |
|
63 |
import org.gvsig.scripting.ExecuteErrorException; |
|
64 |
import org.gvsig.scripting.ScriptingBaseScript; |
|
65 |
import org.gvsig.scripting.ScriptingFolder; |
|
66 |
import org.gvsig.scripting.ScriptingManager; |
|
67 |
import org.gvsig.scripting.ScriptingNotification; |
|
68 |
import org.gvsig.scripting.ScriptingScript; |
|
69 |
import org.gvsig.scripting.ScriptingUnit; |
|
70 |
import org.gvsig.scripting.swing.api.JCodeEditor; |
|
71 |
import org.gvsig.scripting.swing.api.JEditor; |
|
72 |
import org.gvsig.scripting.swing.api.JScriptingBrowser; |
|
73 |
import org.gvsig.scripting.swing.api.JScriptingBrowser.BrowserActionEvent; |
|
74 |
import org.gvsig.scripting.swing.api.JScriptingComposer; |
|
75 |
import static org.gvsig.scripting.swing.api.JScriptingComposer.DOCKED_PROBLEMS; |
|
76 |
import org.gvsig.scripting.swing.api.JScriptingComposer.Dock.DockedPanel; |
|
77 |
import org.gvsig.scripting.swing.api.JScriptingComposer.Problems; |
|
78 |
import org.gvsig.scripting.swing.api.JScriptingComposer.Problems.Problem; |
|
79 |
import org.gvsig.scripting.swing.api.JScriptingConsole; |
|
80 |
import org.gvsig.scripting.swing.api.JScriptingLauncher; |
|
81 |
import org.gvsig.scripting.swing.api.JTextEditor; |
|
82 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
83 |
import org.gvsig.scripting.swing.api.ScriptingUIManager.MenuEntry; |
|
84 |
import org.gvsig.scripting.swing.api.SyntaxtHighlightTextComponent.UpdateCaretPositionActionEvent; |
|
85 |
import org.gvsig.scripting.swing.impl.DefaultJScriptingBrowser; |
|
86 |
import org.gvsig.scripting.swing.impl.DefaultJScriptingConsole; |
|
87 |
import org.gvsig.scripting.swing.impl.DefaultScriptingUIManager; |
|
88 |
import org.gvsig.scripting.swing.impl.JDialogContent; |
|
89 |
import org.gvsig.scripting.swing.impl.composer.components.JTabbedPaneClosable; |
|
90 |
import org.gvsig.scripting.swing.impl.composer.editors.ScriptUnitEditor; |
|
91 |
import org.gvsig.tools.ToolsLocator; |
|
92 |
import org.gvsig.tools.i18n.I18nManager; |
|
93 |
import org.gvsig.tools.observer.Observable; |
|
94 |
import org.gvsig.tools.observer.Observer; |
|
95 |
import org.gvsig.tools.packageutils.PackageInfo; |
|
96 |
import org.gvsig.tools.packageutils.PackageManager; |
|
97 |
import org.gvsig.tools.packageutils.Version; |
|
98 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
99 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
100 |
import org.slf4j.Logger; |
|
101 |
import org.slf4j.LoggerFactory; |
|
102 |
|
|
103 |
@SuppressWarnings("UseSpecificCatch") |
|
104 |
public class DefaultJScriptingComposer extends JPanel implements JScriptingComposer, Observer, ActionListener { |
|
105 |
|
|
106 |
/** |
|
107 |
* |
|
108 |
*/ |
|
109 |
private static final long serialVersionUID = 1L; |
|
110 |
|
|
111 |
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultJScriptingComposer.class); |
|
112 |
|
|
113 |
public static final int CLOSE_ACTION = 1; |
|
114 |
|
|
115 |
private final ScriptingUIManager uimanager; |
|
116 |
private final ScriptingManager manager; |
|
117 |
private final ClassLoader loader; |
|
118 |
|
|
119 |
private JSplitPane mainPanel; |
|
120 |
private Dock dock; |
|
121 |
|
|
122 |
private Map<String, ToolEntry> menus; |
|
123 |
private JMenuBar menuBar; |
|
124 |
|
|
125 |
private Map<String, ToolEntry> tools; |
|
126 |
private JToolBar toolBar; |
|
127 |
|
|
128 |
private StatusBar statusBar; |
|
129 |
|
|
130 |
private FindDialog findDialog; |
|
131 |
private ReplaceDialog replaceDialog; |
|
132 |
private GoToDialog gotoDialog; |
|
133 |
|
|
134 |
private ActionListener defaultActionlistener = null; |
|
135 |
|
|
136 |
private Set<ChangeListener> changeEditorListeners = null; |
|
137 |
private ScriptingScript mainScript; |
|
138 |
|
|
139 |
private class GoToLineAction extends AbstractAction { |
|
140 |
|
|
141 |
private static final long serialVersionUID = -7353913671104893812L; |
|
142 |
|
|
143 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
144 |
public GoToLineAction() { |
|
145 |
super(uimanager.getTranslation("go_to_line_Xhorizontal_ellipsisX")); |
|
146 |
int c = getToolkit().getMenuShortcutKeyMask(); |
|
147 |
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_L, c)); |
|
148 |
putValue(ACTION_COMMAND_KEY, "GotoLine"); |
|
149 |
} |
|
150 |
|
|
151 |
@Override |
|
152 |
public void actionPerformed(ActionEvent e) { |
|
153 |
JEditor editor = getCurrentEditor(); |
|
154 |
if (!(editor instanceof JTextEditor)) { |
|
155 |
return; |
|
156 |
} |
|
157 |
JTextEditor textEditor = (JTextEditor) editor; |
|
158 |
if (findDialog.isVisible()) { |
|
159 |
findDialog.setVisible(false); |
|
160 |
} |
|
161 |
if (replaceDialog.isVisible()) { |
|
162 |
replaceDialog.setVisible(false); |
|
163 |
} |
|
164 |
gotoDialog.setMaxLineNumberAllowed(textEditor.getLineCount()); |
|
165 |
gotoDialog.setVisible(true); |
|
166 |
int line = gotoDialog.getLineNumber(); |
|
167 |
|
|
168 |
if (line > 0) { |
|
169 |
textEditor.selectLine(line); |
|
170 |
} |
|
171 |
} |
|
172 |
|
|
173 |
@Override |
|
174 |
public boolean isEnabled() { |
|
175 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
176 |
return panel != null && panel.getComponent() instanceof JTextEditor; |
|
177 |
} |
|
178 |
} |
|
179 |
|
|
180 |
private class ShowFindDialogAction extends AbstractAction { |
|
181 |
|
|
182 |
private static final long serialVersionUID = -7840632153011361661L; |
|
183 |
|
|
184 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
185 |
public ShowFindDialogAction() { |
|
186 |
super(uimanager.getTranslation("find_Xhorizontal_ellipsisX")); |
|
187 |
int c = getToolkit().getMenuShortcutKeyMask(); |
|
188 |
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, c)); |
|
189 |
putValue(ACTION_COMMAND_KEY, "ShowFindDialog"); |
|
190 |
} |
|
191 |
|
|
192 |
@Override |
|
193 |
public void actionPerformed(ActionEvent e) { |
|
194 |
if (replaceDialog.isVisible()) { |
|
195 |
replaceDialog.setVisible(false); |
|
196 |
} |
|
197 |
findDialog.setVisible(true); |
|
198 |
} |
|
199 |
|
|
200 |
@Override |
|
201 |
public boolean isEnabled() { |
|
202 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
203 |
return panel != null && panel.getComponent() instanceof JTextEditor; |
|
204 |
} |
|
205 |
} |
|
206 |
|
|
207 |
private class ShowReplaceDialogAction extends AbstractAction { |
|
208 |
|
|
209 |
private static final long serialVersionUID = 7209167803487996060L; |
|
210 |
|
|
211 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
212 |
public ShowReplaceDialogAction() { |
|
213 |
super(uimanager.getTranslation("replace_Xhorizontal_ellipsisX")); |
|
214 |
int c = getToolkit().getMenuShortcutKeyMask(); |
|
215 |
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_H, c)); |
|
216 |
putValue(ACTION_COMMAND_KEY, "ShowReplaceDialog"); |
|
217 |
} |
|
218 |
|
|
219 |
@Override |
|
220 |
public void actionPerformed(ActionEvent e) { |
|
221 |
if (findDialog.isVisible()) { |
|
222 |
findDialog.setVisible(false); |
|
223 |
} |
|
224 |
replaceDialog.setVisible(true); |
|
225 |
} |
|
226 |
|
|
227 |
@Override |
|
228 |
public boolean isEnabled() { |
|
229 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
230 |
return panel != null && panel.getComponent() instanceof JTextEditor; |
|
231 |
} |
|
232 |
} |
|
233 |
|
|
234 |
private class LauncherAction extends AbstractAction { |
|
235 |
|
|
236 |
private static final long serialVersionUID = 6257776255757689286L; |
|
237 |
|
|
238 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
239 |
public LauncherAction() { |
|
240 |
super(uimanager.getTranslation("Launcher")); |
|
241 |
putValue(ACTION_COMMAND_KEY, "ShowLauncher"); |
|
242 |
} |
|
243 |
|
|
244 |
@Override |
|
245 |
public void actionPerformed(ActionEvent e) { |
|
246 |
getWindowManager().showWindow( |
|
247 |
uimanager.createLauncher().asJComponent(), |
|
248 |
uimanager.getTranslation("Scripting_Launcher"), |
|
249 |
WindowManager.MODE.TOOL |
|
250 |
); |
|
251 |
} |
|
252 |
|
|
253 |
} |
|
254 |
|
|
255 |
private class SelectAllAction extends AbstractAction { |
|
256 |
|
|
257 |
private static final long serialVersionUID = 2725549699989067383L; |
|
258 |
|
|
259 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
260 |
public SelectAllAction() { |
|
261 |
super(uimanager.getTranslation("Select_all")); |
|
262 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-edit-select-all")); |
|
263 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Select_all")); |
|
264 |
putValue(ACTION_COMMAND_KEY, "DocumentSelectAll"); |
|
265 |
} |
|
266 |
|
|
267 |
@Override |
|
268 |
public void actionPerformed(ActionEvent e) { |
|
269 |
currentScriptSelectAll(); |
|
270 |
} |
|
271 |
|
|
272 |
@Override |
|
273 |
public boolean isEnabled() { |
|
274 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
275 |
return panel != null && panel.getComponent() instanceof JTextEditor; |
|
276 |
} |
|
277 |
|
|
278 |
} |
|
279 |
|
|
280 |
private class PackageScriptAction extends AbstractAction { |
|
281 |
|
|
282 |
private static final long serialVersionUID = 8020393562984016720L; |
|
283 |
|
|
284 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
285 |
public PackageScriptAction() { |
|
286 |
super(uimanager.getTranslation("_Package_script")); |
|
287 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-package")); |
|
288 |
putValue(ACTION_COMMAND_KEY, "PackageScript"); |
|
289 |
} |
|
290 |
|
|
291 |
@Override |
|
292 |
public void actionPerformed(ActionEvent e) { |
|
293 |
createScriptPackage(); |
|
294 |
} |
|
295 |
|
|
296 |
} |
|
297 |
|
|
298 |
private class AboutAction extends AbstractAction { |
|
299 |
|
|
300 |
private static final long serialVersionUID = -4928359535828269502L; |
|
301 |
|
|
302 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
303 |
public AboutAction() { |
|
304 |
super(uimanager.getTranslation("About_scripts_editor")); |
|
305 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-about")); |
|
306 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("About_scripts_editor")); |
|
307 |
putValue(ACTION_COMMAND_KEY, "About"); |
|
308 |
} |
|
309 |
|
|
310 |
@Override |
|
311 |
public void actionPerformed(ActionEvent e) { |
|
312 |
getWindowManager().showWindow( |
|
313 |
getAboutUsDialog(), |
|
314 |
uimanager.getTranslation("About_scripts_editor"), |
|
315 |
WindowManager.MODE.WINDOW |
|
316 |
); |
|
317 |
} |
|
318 |
|
|
319 |
} |
|
320 |
|
|
321 |
private class CutAction extends AbstractAction { |
|
322 |
|
|
323 |
private static final long serialVersionUID = -8549655706085425411L; |
|
324 |
|
|
325 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
326 |
public CutAction() { |
|
327 |
super(uimanager.getTranslation("Cut")); |
|
328 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-edit-cut")); |
|
329 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Cut")); |
|
330 |
putValue(ACTION_COMMAND_KEY, "DocumentCut"); |
|
331 |
} |
|
332 |
|
|
333 |
@Override |
|
334 |
public void actionPerformed(ActionEvent e) { |
|
335 |
currentScriptCut(); |
|
336 |
} |
|
337 |
|
|
338 |
@Override |
|
339 |
public boolean isEnabled() { |
|
340 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
341 |
return panel != null && panel.getComponent() instanceof JTextEditor; |
|
342 |
} |
|
343 |
|
|
344 |
} |
|
345 |
|
|
346 |
private class CopyAction extends AbstractAction { |
|
347 |
|
|
348 |
private static final long serialVersionUID = -6870773810752024874L; |
|
349 |
|
|
350 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
351 |
public CopyAction() { |
|
352 |
super(uimanager.getTranslation("Copy")); |
|
353 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-edit-copy")); |
|
354 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Copy")); |
|
355 |
putValue(ACTION_COMMAND_KEY, "DocumentCopy"); |
|
356 |
} |
|
357 |
|
|
358 |
@Override |
|
359 |
public void actionPerformed(ActionEvent e) { |
|
360 |
currentScriptCopy(); |
|
361 |
} |
|
362 |
|
|
363 |
@Override |
|
364 |
public boolean isEnabled() { |
|
365 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
366 |
return panel != null && panel.getComponent() instanceof JTextEditor; |
|
367 |
} |
|
368 |
|
|
369 |
} |
|
370 |
|
|
371 |
private class PasteAction extends AbstractAction { |
|
372 |
|
|
373 |
private static final long serialVersionUID = -5829551248494873061L; |
|
374 |
|
|
375 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
376 |
public PasteAction() { |
|
377 |
super(uimanager.getTranslation("Paste")); |
|
378 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-edit-paste")); |
|
379 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Paste")); |
|
380 |
putValue(ACTION_COMMAND_KEY, "DocumentPaste"); |
|
381 |
} |
|
382 |
|
|
383 |
@Override |
|
384 |
public void actionPerformed(ActionEvent e) { |
|
385 |
currentScriptPaste(); |
|
386 |
} |
|
387 |
|
|
388 |
@Override |
|
389 |
public boolean isEnabled() { |
|
390 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
391 |
return panel != null && panel.getComponent() instanceof JTextEditor; |
|
392 |
} |
|
393 |
|
|
394 |
} |
|
395 |
|
|
396 |
private class ExitAction extends AbstractAction { |
|
397 |
|
|
398 |
private static final long serialVersionUID = 9165363564675325925L; |
|
399 |
|
|
400 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
401 |
public ExitAction() { |
|
402 |
super(uimanager.getTranslation("Close")); |
|
403 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-exit")); |
|
404 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Close")); |
|
405 |
putValue(ACTION_COMMAND_KEY, "CloseComposer"); |
|
406 |
} |
|
407 |
|
|
408 |
@Override |
|
409 |
public void actionPerformed(ActionEvent e) { |
|
410 |
closeAllScripts(); |
|
411 |
closeWindow(); |
|
412 |
if (defaultActionlistener != null) { |
|
413 |
ActionEvent event = new ActionEvent(this, CLOSE_ACTION, "close"); |
|
414 |
defaultActionlistener.actionPerformed(event); |
|
415 |
} |
|
416 |
} |
|
417 |
|
|
418 |
} |
|
419 |
|
|
420 |
private class SaveAction extends AbstractAction { |
|
421 |
|
|
422 |
private static final long serialVersionUID = -870379961486387727L; |
|
423 |
|
|
424 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
425 |
public SaveAction() { |
|
426 |
super(uimanager.getTranslation("Save")); |
|
427 |
int c = getToolkit().getMenuShortcutKeyMask(); |
|
428 |
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, c)); |
|
429 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-doc-save")); |
|
430 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Save")); |
|
431 |
putValue(ACTION_COMMAND_KEY, "DocumentSave"); |
|
432 |
} |
|
433 |
|
|
434 |
@Override |
|
435 |
public void actionPerformed(ActionEvent e) { |
|
436 |
currentScriptSave(); |
|
437 |
} |
|
438 |
|
|
439 |
@Override |
|
440 |
public boolean isEnabled() { |
|
441 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
442 |
return panel != null; |
|
443 |
} |
|
444 |
} |
|
445 |
|
|
446 |
private class ReloadAction extends AbstractAction { |
|
447 |
|
|
448 |
private static final long serialVersionUID = -870379961486387727L; |
|
449 |
|
|
450 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
451 |
public ReloadAction() { |
|
452 |
super(uimanager.getTranslation("Reload")); |
|
453 |
// int c = getToolkit().getMenuShortcutKeyMask(); |
|
454 |
// putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, c)); |
|
455 |
// putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-doc-save")); |
|
456 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Reload")); |
|
457 |
putValue(ACTION_COMMAND_KEY, "DocumentReload"); |
|
458 |
} |
|
459 |
|
|
460 |
@Override |
|
461 |
public void actionPerformed(ActionEvent e) { |
|
462 |
currentScriptReload(); |
|
463 |
} |
|
464 |
|
|
465 |
@Override |
|
466 |
public boolean isEnabled() { |
|
467 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
468 |
return panel != null; |
|
469 |
} |
|
470 |
} |
|
471 |
|
|
472 |
private class RunAction extends AbstractAction { |
|
473 |
|
|
474 |
private static final long serialVersionUID = 4851968883766990149L; |
|
475 |
|
|
476 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
477 |
public RunAction() { |
|
478 |
super(uimanager.getTranslation("Run")); |
|
479 |
int c = getToolkit().getMenuShortcutKeyMask(); |
|
480 |
// putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); |
|
481 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-run")); |
|
482 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Run")); |
|
483 |
putValue(ACTION_COMMAND_KEY, "DocumentRun"); |
|
484 |
} |
|
485 |
|
|
486 |
@Override |
|
487 |
public void actionPerformed(ActionEvent e) { |
|
488 |
currentScriptExecute(); |
|
489 |
} |
|
490 |
|
|
491 |
@Override |
|
492 |
public boolean isEnabled() { |
|
493 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
494 |
return panel != null; |
|
495 |
} |
|
496 |
} |
|
497 |
|
|
498 |
private class RunMainAction extends AbstractAction { |
|
499 |
|
|
500 |
private static final long serialVersionUID = 4851968883766990149L; |
|
501 |
|
|
502 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
503 |
public RunMainAction() { |
|
504 |
super(uimanager.getTranslation("_Run_main_script")); |
|
505 |
int c = getToolkit().getMenuShortcutKeyMask(); |
|
506 |
// putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); |
|
507 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-run-main")); |
|
508 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("_Run_main_script")); |
|
509 |
putValue(ACTION_COMMAND_KEY, "RunMainScript"); |
|
510 |
} |
|
511 |
|
|
512 |
@Override |
|
513 |
public void actionPerformed(ActionEvent e) { |
|
514 |
mainScriptExecute(); |
|
515 |
} |
|
516 |
|
|
517 |
@Override |
|
518 |
public boolean isEnabled() { |
|
519 |
return true; |
|
520 |
} |
|
521 |
} |
|
522 |
|
|
523 |
private class SelectMainScriptAction extends AbstractAction { |
|
524 |
|
|
525 |
private static final long serialVersionUID = 4851968883766990149L; |
|
526 |
|
|
527 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
528 |
public SelectMainScriptAction() { |
|
529 |
super(uimanager.getTranslation("_Select_main_script")); |
|
530 |
int c = getToolkit().getMenuShortcutKeyMask(); |
|
531 |
// putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); |
|
532 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-select-main")); |
|
533 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("_Select_main_script")); |
|
534 |
putValue(ACTION_COMMAND_KEY, "SelectMainScript"); |
|
535 |
} |
|
536 |
|
|
537 |
@Override |
|
538 |
public void actionPerformed(ActionEvent e) { |
|
539 |
mainScriptSelect(); |
|
540 |
} |
|
541 |
|
|
542 |
@Override |
|
543 |
public boolean isEnabled() { |
|
544 |
return true; |
|
545 |
} |
|
546 |
} |
|
547 |
|
|
548 |
private class SaveAndRunAction extends AbstractAction { |
|
549 |
|
|
550 |
private static final long serialVersionUID = 4851968883766990149L; |
|
551 |
|
|
552 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
553 |
public SaveAndRunAction() { |
|
554 |
super(uimanager.getTranslation("Save and run")); |
|
555 |
int c = getToolkit().getMenuShortcutKeyMask(); |
|
556 |
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); |
|
557 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-save-and-run")); |
|
558 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Save and run")); |
|
559 |
putValue(ACTION_COMMAND_KEY, "DocumentSaveAndRun"); |
|
560 |
} |
|
561 |
|
|
562 |
@Override |
|
563 |
public void actionPerformed(ActionEvent e) { |
|
564 |
currentScriptSave(); |
|
565 |
currentScriptExecute(); |
|
566 |
} |
|
567 |
|
|
568 |
@Override |
|
569 |
public boolean isEnabled() { |
|
570 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
571 |
return panel != null; |
|
572 |
} |
|
573 |
} |
|
574 |
|
|
575 |
private class CloseAllAction extends AbstractAction { |
|
576 |
|
|
577 |
private static final long serialVersionUID = 3385142920283598457L; |
|
578 |
|
|
579 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
580 |
public CloseAllAction() { |
|
581 |
super(uimanager.getTranslation("Close_all_documents")); |
|
582 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-doc-closeall")); |
|
583 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Close_all_documents")); |
|
584 |
putValue(ACTION_COMMAND_KEY, "CloseAll"); |
|
585 |
} |
|
586 |
|
|
587 |
@Override |
|
588 |
public void actionPerformed(ActionEvent e) { |
|
589 |
closeAllScripts(); |
|
590 |
} |
|
591 |
|
|
592 |
@Override |
|
593 |
public boolean isEnabled() { |
|
594 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
595 |
return panel != null; |
|
596 |
} |
|
597 |
|
|
598 |
} |
|
599 |
|
|
600 |
private class CloseDocumentAction extends AbstractAction { |
|
601 |
|
|
602 |
private static final long serialVersionUID = 4152188500446249755L; |
|
603 |
|
|
604 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
605 |
public CloseDocumentAction() { |
|
606 |
super(uimanager.getTranslation("Close_document")); |
|
607 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-doc-close")); |
|
608 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Close_current_tab")); |
|
609 |
putValue(ACTION_COMMAND_KEY, "DocumentClose"); |
|
610 |
} |
|
611 |
|
|
612 |
@Override |
|
613 |
public void actionPerformed(ActionEvent e) { |
|
614 |
currentScriptClose(); |
|
615 |
} |
|
616 |
|
|
617 |
@Override |
|
618 |
public boolean isEnabled() { |
|
619 |
DockedPanel panel = dock.getSelected(Dock.DOCK_CENTER); |
|
620 |
return panel != null; |
|
621 |
} |
|
622 |
|
|
623 |
} |
|
624 |
|
|
625 |
private class ShowConsoleAction extends AbstractAction { |
|
626 |
|
|
627 |
private static final long serialVersionUID = -7545333555439711068L; |
|
628 |
|
|
629 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
630 |
public ShowConsoleAction() { |
|
631 |
super(uimanager.getTranslation("Console")); |
|
632 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-show-console")); |
|
633 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Show_console_panel")); |
|
634 |
putValue(ACTION_COMMAND_KEY, "ShowConsole"); |
|
635 |
} |
|
636 |
|
|
637 |
@Override |
|
638 |
public void actionPerformed(ActionEvent e) { |
|
639 |
addConsolePanel(); |
|
640 |
} |
|
641 |
} |
|
642 |
|
|
643 |
private class ShowProblemsAction extends AbstractAction { |
|
644 |
|
|
645 |
private static final long serialVersionUID = 5276964996914550830L; |
|
646 |
|
|
647 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
648 |
public ShowProblemsAction() { |
|
649 |
super(uimanager.getTranslation("Problems")); |
|
650 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-show-problems")); |
|
651 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Show_problems_panel")); |
|
652 |
putValue(ACTION_COMMAND_KEY, "ShowProblems"); |
|
653 |
} |
|
654 |
|
|
655 |
@Override |
|
656 |
public void actionPerformed(ActionEvent e) { |
|
657 |
addProblemsPanel(); |
|
658 |
} |
|
659 |
} |
|
660 |
|
|
661 |
private class ShowProjectsAction extends AbstractAction { |
|
662 |
|
|
663 |
private static final long serialVersionUID = 5873598740133693862L; |
|
664 |
|
|
665 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
666 |
public ShowProjectsAction() { |
|
667 |
super(uimanager.getTranslation("Projects")); |
|
668 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-show-projects")); |
|
669 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Show_projects_panel")); |
|
670 |
putValue(ACTION_COMMAND_KEY, "ShowProjects"); |
|
671 |
} |
|
672 |
|
|
673 |
@Override |
|
674 |
public void actionPerformed(ActionEvent e) { |
|
675 |
addProjectsPanel(); |
|
676 |
} |
|
677 |
} |
|
678 |
|
|
679 |
private class NewDocumentAction extends AbstractAction { |
|
680 |
|
|
681 |
private static final long serialVersionUID = 7889613706183211620L; |
|
682 |
|
|
683 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
684 |
public NewDocumentAction() { |
|
685 |
super(uimanager.getTranslation("New")); |
|
686 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-doc-add")); |
|
687 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("New")); |
|
688 |
putValue(ACTION_COMMAND_KEY, "DocumentNew"); |
|
689 |
} |
|
690 |
|
|
691 |
@Override |
|
692 |
public void actionPerformed(ActionEvent e) { |
|
693 |
try { |
|
694 |
scriptNew(); |
|
695 |
} catch (Exception e1) { |
|
696 |
LOGGER.warn("Can't create a new document", e1); |
|
697 |
} |
|
698 |
} |
|
699 |
|
|
700 |
} |
|
701 |
|
|
702 |
private class NewFolderAction extends AbstractAction { |
|
703 |
|
|
704 |
private static final long serialVersionUID = 7889613706183211620L; |
|
705 |
|
|
706 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
707 |
public NewFolderAction() { |
|
708 |
super(uimanager.getTranslation("New folder")); |
|
709 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-folder-add")); |
|
710 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("New folder")); |
|
711 |
putValue(ACTION_COMMAND_KEY, "FolderNew"); |
|
712 |
} |
|
713 |
|
|
714 |
@Override |
|
715 |
public void actionPerformed(ActionEvent e) { |
|
716 |
try { |
|
717 |
FolderNew(); |
|
718 |
} catch (Exception e1) { |
|
719 |
LOGGER.warn("Can't create a new folder", e1); |
|
720 |
} |
|
721 |
} |
|
722 |
|
|
723 |
} |
|
724 |
|
|
725 |
private class ProjectEditAction extends AbstractAction { |
|
726 |
|
|
727 |
private static final long serialVersionUID = -3393464285985649074L; |
|
728 |
|
|
729 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
730 |
public ProjectEditAction() { |
|
731 |
super(uimanager.getTranslation("Edit")); |
|
732 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-doc-edit")); |
|
733 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Open_edition_mode")); |
|
734 |
putValue(ACTION_COMMAND_KEY, "DocumentEdit"); |
|
735 |
} |
|
736 |
|
|
737 |
@Override |
|
738 |
public void actionPerformed(ActionEvent e) { |
|
739 |
try { |
|
740 |
ScriptingUnit selectedItem = getLauncherSelectedUnit(); |
|
741 |
if( uimanager.hasEditor(selectedItem) ) { |
|
742 |
scriptEdit(selectedItem); |
|
743 |
} |
|
744 |
} catch (Exception e1) { |
|
745 |
LOGGER.warn("Can't edit document", e1); |
|
746 |
} |
|
747 |
} |
|
748 |
} |
|
749 |
|
|
750 |
private class ProjectRunAction extends AbstractAction { |
|
751 |
|
|
752 |
private static final long serialVersionUID = -3393464285985649074L; |
|
753 |
|
|
754 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
755 |
public ProjectRunAction() { |
|
756 |
super(uimanager.getTranslation("Run")); |
|
757 |
putValue(Action.SMALL_ICON, uimanager.getIcon("scripting-run")); |
|
758 |
putValue(Action.SHORT_DESCRIPTION, uimanager.getTranslation("Run")); |
|
759 |
putValue(ACTION_COMMAND_KEY, "ProjectRun"); |
|
760 |
} |
|
761 |
|
|
762 |
@Override |
|
763 |
public void actionPerformed(ActionEvent e) { |
|
764 |
try { |
|
765 |
ScriptingUnit selectedItem = getLauncherSelectedUnit(); |
|
766 |
if( selectedItem instanceof ScriptingScript ) { |
|
767 |
scriptExecute((ScriptingScript) selectedItem); |
|
768 |
} |
Also available in: Unified diff