Revision 684
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<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"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.scripting.app.mainplugin</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.scripting.app</artifactId> |
|
11 |
<version>2.3.19</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
17 |
<scope>compile</scope> |
|
18 |
</dependency> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
22 |
<type>test-jar</type> |
|
23 |
<scope>test</scope> |
|
24 |
</dependency> |
|
25 |
<dependency> |
|
26 |
<groupId>org.gvsig</groupId> |
|
27 |
<artifactId>org.gvsig.i18n</artifactId> |
|
28 |
<scope>compile</scope> |
|
29 |
</dependency> |
|
30 |
<dependency> |
|
31 |
<groupId>org.gvsig</groupId> |
|
32 |
<artifactId>org.gvsig.andami</artifactId> |
|
33 |
<scope>compile</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId> |
|
38 |
<scope>compile</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
43 |
<scope>compile</scope> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
48 |
<scope>compile</scope> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.about.api</artifactId> |
|
53 |
<scope>compile</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.scripting.lib.api</artifactId> |
|
58 |
<scope>compile</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.scripting.swing.api</artifactId> |
|
63 |
<scope>compile</scope> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>org.gvsig</groupId> |
|
67 |
<artifactId>org.gvsig.scripting.lib.impl</artifactId> |
|
68 |
<scope>compile</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.scripting.swing.impl</artifactId> |
|
73 |
<scope>compile</scope> |
|
74 |
</dependency> |
|
75 |
|
|
76 |
<!-- force adding --> |
|
77 |
<dependency> |
|
78 |
<groupId>org.ini4j</groupId> |
|
79 |
<artifactId>ini4j</artifactId> |
|
80 |
<scope>runtime</scope> |
|
81 |
</dependency> |
|
82 |
<dependency> |
|
83 |
<groupId>net.sourceforge.thinlet</groupId> |
|
84 |
<artifactId>thinlet</artifactId> |
|
85 |
<scope>runtime</scope> |
|
86 |
</dependency> |
|
87 |
<dependency> |
|
88 |
<groupId>org.gvsig</groupId> |
|
89 |
<artifactId>org.gvsig.scripting.thing</artifactId> |
|
90 |
<scope>runtime</scope> |
|
91 |
</dependency> |
|
92 |
<dependency> |
|
93 |
<groupId>com.jeta</groupId> |
|
94 |
<artifactId>abeille</artifactId> |
|
95 |
<type>tar.gz</type> |
|
96 |
<scope>runtime</scope> |
|
97 |
</dependency> |
|
98 |
<dependency> |
|
99 |
<groupId>org.jopendocument</groupId> |
|
100 |
<artifactId>jOpenDocument</artifactId> |
|
101 |
<scope>runtime</scope> |
|
102 |
</dependency> |
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
<dependency> |
|
107 |
<groupId>org.python</groupId> |
|
108 |
<artifactId>${jython.artifactId}</artifactId> |
|
109 |
<scope>runtime</scope> |
|
110 |
</dependency> |
|
111 |
<dependency> |
|
112 |
<groupId>org.codehaus.groovy</groupId> |
|
113 |
<artifactId>groovy-all</artifactId> |
|
114 |
<scope>runtime</scope> |
|
115 |
</dependency> |
|
116 |
<dependency> |
|
117 |
<groupId>org.renjin</groupId> |
|
118 |
<artifactId>renjin-script-engine</artifactId> |
|
119 |
<classifier>jar-with-dependencies</classifier> |
|
120 |
<scope>runtime</scope> |
|
121 |
</dependency> |
|
122 |
|
|
123 |
<dependency> |
|
124 |
<groupId>org.scala-lang</groupId> |
|
125 |
<artifactId>scala-dist</artifactId> |
|
126 |
<scope>runtime</scope> |
|
127 |
</dependency> |
|
128 |
<dependency> |
|
129 |
<groupId>org.scala-lang</groupId> |
|
130 |
<artifactId>scala-compiler</artifactId> |
|
131 |
<scope>runtime</scope> |
|
132 |
</dependency> |
|
133 |
<dependency> |
|
134 |
<groupId>org.scala-lang</groupId> |
|
135 |
<artifactId>scala-library</artifactId> |
|
136 |
<scope>runtime</scope> |
|
137 |
</dependency> |
|
138 |
<dependency> |
|
139 |
<groupId>org.scala-lang</groupId> |
|
140 |
<artifactId>scala-reflect</artifactId> |
|
141 |
<scope>runtime</scope> |
|
142 |
</dependency> |
|
143 |
<dependency> |
|
144 |
<groupId>org.scala-lang</groupId> |
|
145 |
<artifactId>scalap</artifactId> |
|
146 |
<scope>runtime</scope> |
|
147 |
</dependency> |
|
148 |
<dependency> |
|
149 |
<groupId>jline</groupId> |
|
150 |
<artifactId>jline</artifactId> |
|
151 |
<scope>runtime</scope> |
|
152 |
</dependency> |
|
153 |
|
|
154 |
</dependencies> |
|
155 |
|
|
156 |
|
|
157 |
<properties> |
|
158 |
<gvsig.package.info.name>Scripting framework</gvsig.package.info.name> |
|
159 |
<gvsig.package.info.dependencies>required: org.gvsig.app.document.table.app.mainplugin -ge 2</gvsig.package.info.dependencies> |
|
160 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-scripting/pool</gvsig.package.info.poolURL> |
|
161 |
<gvsig.package.info.sourcesURL>https://devel.gvsig.org/svn/gvsig-scripting</gvsig.package.info.sourcesURL> |
|
162 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
163 |
<gvsig.package.info.categories>Development</gvsig.package.info.categories> |
|
164 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
165 |
|
|
166 |
</properties> |
|
167 |
|
|
168 |
<build> |
|
169 |
<plugins> |
|
170 |
|
|
171 |
<plugin> |
|
172 |
<groupId>org.apache.maven.plugins</groupId> |
|
173 |
<artifactId>maven-dependency-plugin</artifactId> |
|
174 |
<executions> |
|
175 |
<execution> |
|
176 |
<id>unpack</id> |
|
177 |
<phase>process-sources</phase> |
|
178 |
<goals> |
|
179 |
<goal>unpack</goal> |
|
180 |
</goals> |
|
181 |
<configuration> |
|
182 |
<artifactItems> |
|
183 |
<artifactItem> |
|
184 |
<groupId>com.jeta</groupId> |
|
185 |
<artifactId>abeille</artifactId> |
|
186 |
<version>2.1.0.M3</version> |
|
187 |
<type>tar.gz</type> |
|
188 |
<overWrite>true</overWrite> |
|
189 |
<outputDirectory>target/abeille</outputDirectory> |
|
190 |
</artifactItem> |
|
191 |
</artifactItems> |
|
192 |
</configuration> |
|
193 |
</execution> |
|
194 |
</executions> |
|
195 |
</plugin> |
|
196 |
|
|
197 |
</plugins> |
|
198 |
</build> |
|
199 |
|
|
200 |
</project> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Sun Jul 03 14:45:26 CEST 2016 |
|
2 |
buildNumber=68 |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/test/java/org/gvsig/scripting/app/extension/AppTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.scripting.app.extension; |
|
24 |
|
|
25 |
import junit.framework.Test; |
|
26 |
import junit.framework.TestCase; |
|
27 |
import junit.framework.TestSuite; |
|
28 |
|
|
29 |
/** |
|
30 |
* Unit test for simple App. |
|
31 |
*/ |
|
32 |
public class AppTest |
|
33 |
extends TestCase |
|
34 |
{ |
|
35 |
/** |
|
36 |
* Create the test case |
|
37 |
* |
|
38 |
* @param testName name of the test case |
|
39 |
*/ |
|
40 |
public AppTest( String testName ) |
|
41 |
{ |
|
42 |
super( testName ); |
|
43 |
} |
|
44 |
|
|
45 |
/** |
|
46 |
* @return the suite of tests being tested |
|
47 |
*/ |
|
48 |
public static Test suite() |
|
49 |
{ |
|
50 |
return new TestSuite( AppTest.class ); |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* Rigourous Test :-) |
|
55 |
*/ |
|
56 |
public void testApp() |
|
57 |
{ |
|
58 |
assertTrue( true ); |
|
59 |
} |
|
60 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/ScriptLaunchExtension.java | ||
---|---|---|
1 |
package org.gvsig.scripting.app.extension; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.Arrays; |
|
6 |
import java.util.List; |
|
7 |
import javax.swing.JOptionPane; |
|
8 |
import org.gvsig.andami.PluginsLocator; |
|
9 |
import org.gvsig.andami.PluginsManager; |
|
10 |
import org.gvsig.andami.plugins.Extension; |
|
11 |
import org.gvsig.app.ApplicationLocator; |
|
12 |
import org.gvsig.app.ApplicationManager; |
|
13 |
import org.gvsig.scripting.ScriptingLocator; |
|
14 |
import org.gvsig.scripting.ScriptingManager; |
|
15 |
import org.gvsig.scripting.ScriptingScript; |
|
16 |
import org.slf4j.Logger; |
|
17 |
import org.slf4j.LoggerFactory; |
|
18 |
|
|
19 |
public class ScriptLaunchExtension extends Extension { |
|
20 |
|
|
21 |
private static final Logger logger = LoggerFactory.getLogger(ScriptLaunchExtension.class); |
|
22 |
|
|
23 |
@Override |
|
24 |
public void initialize() { |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public boolean isEnabled() { |
|
29 |
return true; |
|
30 |
} |
|
31 |
|
|
32 |
@Override |
|
33 |
public boolean isVisible() { |
|
34 |
return true; |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public boolean canQueryByAction() { |
|
39 |
return true; |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public void execute(String action) { |
|
44 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
45 |
ScriptingScript script = getScript(action); |
|
46 |
if( script == null ) { |
|
47 |
application.messageDialog( |
|
48 |
"Can't locate script '"+action+"'", |
|
49 |
"Warning", |
|
50 |
JOptionPane.WARNING_MESSAGE |
|
51 |
); |
|
52 |
return; |
|
53 |
} |
|
54 |
try { |
|
55 |
script.runAsTask(null); |
|
56 |
} catch (Throwable th) { |
|
57 |
logger.warn("Can't execute '" + action + "' script.", th); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public void execute(String action, Object[] args) { |
|
63 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
64 |
ScriptingScript script = getScript(action); |
|
65 |
if( script == null ) { |
|
66 |
application.messageDialog( |
|
67 |
"Can't locate script '"+action+"'", |
|
68 |
"Warning", |
|
69 |
JOptionPane.WARNING_MESSAGE |
|
70 |
); |
|
71 |
return; |
|
72 |
} |
|
73 |
try { |
|
74 |
script.runAsTask(args); |
|
75 |
} catch (Throwable th) { |
|
76 |
logger.warn("Can't execute '" + action + "' script.", th); |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public boolean isVisible(String action) { |
|
82 |
ScriptingScript script = getScript(action); |
|
83 |
try { |
|
84 |
Boolean value = (Boolean) script.invokeFunction("isVisible", null); |
|
85 |
return value; |
|
86 |
} catch (Throwable th) { |
|
87 |
logger.warn("Can't execute isVisible in '" + action + "' script.", th); |
|
88 |
} |
|
89 |
return false; |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public boolean isEnabled(String action) { |
|
94 |
ScriptingScript script = getScript(action); |
|
95 |
try { |
|
96 |
Boolean value = (Boolean) script.invokeFunction("isEnabled", null); |
|
97 |
return value; |
|
98 |
} catch (Throwable th) { |
|
99 |
logger.warn("Can't execute isEnabled in '" + action + "' script.", th); |
|
100 |
} |
|
101 |
return false; |
|
102 |
} |
|
103 |
|
|
104 |
private ScriptingScript getScript(String scriptpathname) { |
|
105 |
final ScriptingManager manager = ScriptingLocator.getManager(); |
|
106 |
final PluginsManager pluginManager = PluginsLocator.getManager(); |
|
107 |
|
|
108 |
File scriptfile; |
|
109 |
ScriptingScript script; |
|
110 |
|
|
111 |
String s = manager.getRootUserFolder().getAbsolutePath().replace("\\", "/"); |
|
112 |
scriptfile = new File(s+"/"+scriptpathname); |
|
113 |
if (scriptfile.exists()) { |
|
114 |
script = (ScriptingScript) manager.getScript(scriptfile); |
|
115 |
return script; |
|
116 |
} |
|
117 |
|
|
118 |
final List<File> pluginsFolders = new ArrayList<>(); |
|
119 |
for (File f : pluginManager.getPluginsFolders()) { |
|
120 |
pluginsFolders.addAll(Arrays.asList(f.listFiles())); |
|
121 |
} |
|
122 |
|
|
123 |
for (File pluginFolder : pluginsFolders) { |
|
124 |
s = pluginFolder.getAbsolutePath().replace("\\", "/"); |
|
125 |
scriptfile = new File(s+"/scripting/scripts/"+scriptpathname); |
|
126 |
if (scriptfile.exists()) { |
|
127 |
script = (ScriptingScript) manager.getScript(scriptfile); |
|
128 |
return script; |
|
129 |
} |
|
130 |
} |
|
131 |
return (ScriptingScript) manager.getScript(scriptpathname); |
|
132 |
} |
|
133 |
|
|
134 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/ScriptingExtension.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.scripting.app.extension; |
|
23 |
|
|
24 |
import java.io.File; |
|
25 |
import java.io.IOException; |
|
26 |
import java.nio.file.FileVisitOption; |
|
27 |
import static java.nio.file.FileVisitOption.FOLLOW_LINKS; |
|
28 |
import java.nio.file.FileVisitResult; |
|
29 |
import java.nio.file.Files; |
|
30 |
import java.nio.file.Path; |
|
31 |
import java.nio.file.Paths; |
|
32 |
import java.nio.file.SimpleFileVisitor; |
|
33 |
import java.nio.file.attribute.BasicFileAttributes; |
|
34 |
import java.util.ArrayList; |
|
35 |
import java.util.Arrays; |
|
36 |
import java.util.EnumSet; |
|
37 |
import java.util.List; |
|
38 |
|
|
39 |
import javax.swing.JOptionPane; |
|
40 |
import org.apache.commons.io.FileUtils; |
|
41 |
|
|
42 |
import org.gvsig.andami.IconThemeHelper; |
|
43 |
import org.gvsig.andami.PluginServices; |
|
44 |
import org.gvsig.andami.PluginsLocator; |
|
45 |
import org.gvsig.andami.PluginsManager; |
|
46 |
import org.gvsig.andami.plugins.Extension; |
|
47 |
import org.gvsig.app.ApplicationLocator; |
|
48 |
import org.gvsig.app.ApplicationManager; |
|
49 |
import org.gvsig.installer.lib.api.InstallerLocator; |
|
50 |
import org.gvsig.installer.lib.api.InstallerManager; |
|
51 |
import org.gvsig.scripting.ScriptingBaseScript; |
|
52 |
import org.gvsig.scripting.ScriptingFolder; |
|
53 |
import org.gvsig.scripting.ScriptingLocator; |
|
54 |
import org.gvsig.scripting.ScriptingManager; |
|
55 |
import org.gvsig.scripting.swing.api.JScriptingComposer; |
|
56 |
import org.gvsig.scripting.swing.api.ScriptingSwingLocator; |
|
57 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
58 |
import org.gvsig.tools.dynobject.DynObject; |
|
59 |
import org.gvsig.tools.service.spi.ProviderFactory; |
|
60 |
import org.gvsig.tools.service.spi.ProviderManager; |
|
61 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
62 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
63 |
import org.gvsig.tools.swing.impl.windowmanager.DefaultWindowManager; |
|
64 |
import org.slf4j.Logger; |
|
65 |
import org.slf4j.LoggerFactory; |
|
66 |
import org.gvsig.installer.lib.spi.InstallerProviderLocator; |
|
67 |
import org.gvsig.tools.ToolsLocator; |
|
68 |
import org.gvsig.tools.i18n.I18nManager; |
|
69 |
|
|
70 |
public class ScriptingExtension extends Extension { |
|
71 |
|
|
72 |
private static final Logger logger = LoggerFactory.getLogger(ScriptingExtension.class); |
|
73 |
|
|
74 |
private PluginServices plugin = null; |
|
75 |
|
|
76 |
/* |
|
77 |
* la funcion log y las constantes estan pensadas para usarlas desde los scripts. |
|
78 |
*/ |
|
79 |
public static final int INFO = 0; |
|
80 |
public static final int TRACE = 1; |
|
81 |
public static final int WARN = 2; |
|
82 |
public static final int ERROR = 3; |
|
83 |
|
|
84 |
public static void log(String message) { |
|
85 |
log(INFO,message,null); |
|
86 |
} |
|
87 |
|
|
88 |
public static void log(int level, String message) { |
|
89 |
log(level,message,null); |
|
90 |
} |
|
91 |
|
|
92 |
public static void log(int level, String message, Throwable th) { |
|
93 |
switch(level) { |
|
94 |
case TRACE: |
|
95 |
logger.trace(message, th); |
|
96 |
break; |
|
97 |
case ERROR: |
|
98 |
logger.error(message, th); |
|
99 |
break; |
|
100 |
case WARN: |
|
101 |
logger.warn(message, th); |
|
102 |
break; |
|
103 |
default: |
|
104 |
case INFO: |
|
105 |
logger.info(message, th); |
|
106 |
break; |
|
107 |
} |
|
108 |
} |
|
109 |
|
|
110 |
@Override |
|
111 |
public PluginServices getPlugin() { |
|
112 |
if( this.plugin == null ) { |
|
113 |
this.plugin = PluginsLocator.getManager().getPlugin(ScriptingExtension.class); |
|
114 |
} |
|
115 |
return this.plugin; |
|
116 |
} |
|
117 |
|
|
118 |
@Override |
|
119 |
public void execute(String actionCommand) { |
|
120 |
this.execute(actionCommand, null); |
|
121 |
} |
|
122 |
|
|
123 |
@Override |
|
124 |
public void execute(String command, Object[] args) { |
|
125 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
126 |
WindowManager winmanager = ToolsSwingLocator.getWindowManager(); |
|
127 |
|
|
128 |
if ("tools-scripting-launcher".equalsIgnoreCase(command)) { |
|
129 |
winmanager.showWindow(uimanager.createLauncher().asJComponent(), uimanager.getTranslation("Scripting_Launcher"), WindowManager.MODE.TOOL); |
|
130 |
|
|
131 |
} else if ("tools-scripting-composer".equalsIgnoreCase(command)) { |
|
132 |
DynObject preferences = this.getPlugin().getPluginProperties(); |
|
133 |
Boolean composerUseHisWindowManager = (Boolean) preferences.getDynValue("ComposerUseHisWindowManager"); |
|
134 |
ScriptingUIManager uiManager = ScriptingSwingLocator.getUIManager(); |
|
135 |
if (composerUseHisWindowManager) { |
|
136 |
winmanager = new DefaultWindowManager(); |
|
137 |
uiManager.setWindowManager(winmanager); |
|
138 |
} |
|
139 |
JScriptingComposer composer = uimanager.createComposer(); |
|
140 |
uiManager.showWindow(composer.asJComponent(), uimanager.getTranslation("Scripting_Composer")); |
|
141 |
|
|
142 |
} else { |
|
143 |
ScriptingBaseScript script = uimanager.getManager().getScript(command); |
|
144 |
if (script != null) { |
|
145 |
script.run(args); |
|
146 |
} else { |
|
147 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
148 |
application.messageDialog("Can't locate script '" + command + "'.", "ScriptLaunch", JOptionPane.OK_OPTION); |
|
149 |
} |
|
150 |
} |
|
151 |
} |
|
152 |
|
|
153 |
public void initialize() { |
|
154 |
IconThemeHelper.registerIcon("action", "tools-scripting-launcher", this); |
|
155 |
IconThemeHelper.registerIcon("action", "tools-scripting-composer", this); |
|
156 |
IconThemeHelper.registerIcon("action", "tools-scripting-console-jython", this); |
|
157 |
} |
|
158 |
|
|
159 |
private void addLinkToPreviousVersion(ScriptingManager manager) { |
|
160 |
|
|
161 |
String contents = "[Unit]\n" |
|
162 |
+ "type = Folder\n" |
|
163 |
+ "name = Previous version\n" |
|
164 |
+ "description =\n" |
|
165 |
+ "createdBy =\n" |
|
166 |
+ "version =\n" |
|
167 |
+ "\n" |
|
168 |
+ "[Folder]\n" |
|
169 |
+ "path = ../../org.gvsig.scripting.app.extension/scripts\n\n\n"; |
|
170 |
File previousVersion = new File(manager.getUserFolder().getFile(), "previous_version.inf"); |
|
171 |
if (!previousVersion.exists()) { |
|
172 |
try { |
|
173 |
FileUtils.writeStringToFile(previousVersion, contents); |
|
174 |
} catch (IOException ex) { |
|
175 |
logger.warn("Can't create ScriptingFolder file in '" + previousVersion.getAbsolutePath() + "'.", ex); |
|
176 |
} |
|
177 |
} |
|
178 |
} |
|
179 |
|
|
180 |
@Override |
|
181 |
public void postInitialize() { |
|
182 |
super.postInitialize(); |
|
183 |
ScriptingManager manager = ScriptingLocator.getManager(); |
|
184 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
|
185 |
|
|
186 |
File home = this.getPlugin().getPluginHomeFolder(); |
|
187 |
manager.setHomeFolder(home); |
|
188 |
|
|
189 |
this.addLinkToPreviousVersion(manager); |
|
190 |
|
|
191 |
List<File> pluginsFolders = new ArrayList<>(); |
|
192 |
for (File f : pluginManager.getPluginsFolders()) { |
|
193 |
pluginsFolders.addAll(Arrays.asList(f.listFiles())); |
|
194 |
} |
|
195 |
|
|
196 |
for (File pluginFolder : pluginsFolders) { |
|
197 |
File scriptsFolder = new File(pluginFolder, "scripting/scripts"); |
|
198 |
if (scriptsFolder.exists()) { |
|
199 |
manager.registerSystemFolder(pluginFolder.getName(), scriptsFolder); |
|
200 |
} |
|
201 |
File libFolder = new File(pluginFolder, "scripting/lib"); |
|
202 |
if (libFolder.exists()) { |
|
203 |
manager.addLibFolder(libFolder); |
|
204 |
} |
|
205 |
} |
|
206 |
pluginManager.addStartupTask( |
|
207 |
"ExecuteAutorunScripts", |
|
208 |
new ExecuteAutorunScriptsOnStartup(), |
|
209 |
true, |
|
210 |
600 |
|
211 |
); |
|
212 |
|
|
213 |
manager.setPackagesFolder(pluginManager.getInstallFolder()); |
|
214 |
|
|
215 |
File localAddonRepositoryFolder = new File(manager.getRootUserFolder(), "addons"); |
|
216 |
if (!localAddonRepositoryFolder.exists()) { |
|
217 |
try { |
|
218 |
FileUtils.forceMkdir(localAddonRepositoryFolder); |
|
219 |
} catch (IOException ex) { |
|
220 |
logger.info("Can't create addons folder in '" + localAddonRepositoryFolder.getAbsolutePath() + "'.", ex); |
|
221 |
} |
|
222 |
} |
|
223 |
ProviderManager providerManager = InstallerProviderLocator.getProviderManager(); |
|
224 |
InstallerManager installerManager = InstallerLocator.getInstallerManager(); |
|
225 |
|
|
226 |
ProviderFactory factory = manager.getInstallerFactory(); |
|
227 |
providerManager.addProviderFactory(factory); |
|
228 |
installerManager.setDefaultLocalAddonRepository( |
|
229 |
localAddonRepositoryFolder, |
|
230 |
factory.getName() |
|
231 |
); |
|
232 |
factory = manager.getHelpInstallerFactory(); |
|
233 |
providerManager.addProviderFactory(factory); |
|
234 |
installerManager.setDefaultLocalAddonRepository( |
|
235 |
manager.getHelpManager().getHelpRoots().get(0), |
|
236 |
factory.getName() |
|
237 |
); |
|
238 |
} |
|
239 |
|
|
240 |
@Override |
|
241 |
public boolean isEnabled() { |
|
242 |
return true; |
|
243 |
} |
|
244 |
|
|
245 |
@Override |
|
246 |
public boolean isVisible() { |
|
247 |
return true; |
|
248 |
} |
|
249 |
|
|
250 |
private static class ExecuteAutorunScriptsOnStartup implements Runnable { |
|
251 |
|
|
252 |
@Override |
|
253 |
public void run() { |
|
254 |
Thread th = new Thread(new ExecuteAutorunScripts()); |
|
255 |
th.start(); |
|
256 |
} |
|
257 |
} |
|
258 |
|
|
259 |
private static class ExecuteAutorunScripts implements Runnable { |
|
260 |
|
|
261 |
@Override |
|
262 |
public void run() { |
|
263 |
final ScriptingManager manager = ScriptingLocator.getManager(); |
|
264 |
manager.loadEngines(); |
|
265 |
|
|
266 |
final PluginsManager pluginManager = PluginsLocator.getManager(); |
|
267 |
final ApplicationManager application = ApplicationLocator.getManager(); |
|
268 |
final I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
269 |
|
|
270 |
// try { |
|
271 |
// ScriptingHelpManager helpmanager = manager.getHelpManager(); |
|
272 |
// PluginServices plugin = pluginManager.getPlugin(this); |
|
273 |
// File scriptingfolder = new File(plugin.getPluginDirectory(), "scripting"); |
|
274 |
// File helpfolder = new File(scriptingfolder, "help"); |
|
275 |
// for (File folder : helpfolder.listFiles()) { |
|
276 |
// File helpindex = new File(folder, "help-index.xml"); |
|
277 |
// try { |
|
278 |
// if( helpindex.exists() ) { |
|
279 |
// helpmanager.addMethods(helpindex.toURI().toURL()); |
|
280 |
// } |
|
281 |
// } catch (Exception e) { |
|
282 |
// logger.info("Can't add metothods from '" + helpindex.getAbsolutePath() + "'.", e); |
|
283 |
// } |
|
284 |
// } |
|
285 |
// } catch (Exception e) { |
|
286 |
// logger.info("Can't add metothods.", e); |
|
287 |
// } |
|
288 |
try { |
|
289 |
List<File> pluginsFolders = new ArrayList<>(); |
|
290 |
for (File f : pluginManager.getPluginsFolders()) { |
|
291 |
pluginsFolders.addAll(Arrays.asList(f.listFiles())); |
|
292 |
} |
|
293 |
|
|
294 |
File autorun_file = null; |
|
295 |
ScriptingBaseScript autorun; |
|
296 |
application.message( |
|
297 |
i18nManager.getTranslation("_Searching_autorun_scripts_Xhorizontal_ellipsisX"), |
|
298 |
JOptionPane.INFORMATION_MESSAGE |
|
299 |
); |
|
300 |
for (File pluginFolder : pluginsFolders) { |
|
301 |
autorun_file = new File(pluginFolder, "scripting/scripts/autorun.inf"); |
|
302 |
if (autorun_file.exists()) { |
|
303 |
autorun = manager.getScript(autorun_file); |
|
304 |
if (autorun.isEnabled()) { |
|
305 |
logger.info("running autorun script '" + autorun_file.getAbsolutePath() + "'."); |
|
306 |
try { |
|
307 |
application.message( |
|
308 |
i18nManager.getTranslation( |
|
309 |
"_Running_autorun_script_from_XnameX", |
|
310 |
new String[]{autorun.getFile().getParentFile().getName()} |
|
311 |
), |
|
312 |
JOptionPane.INFORMATION_MESSAGE |
|
313 |
); |
|
314 |
} catch (Exception ex) { |
|
315 |
// Ignore it |
|
316 |
} |
|
317 |
try { |
|
318 |
autorun.run(); |
|
319 |
} catch (Exception ex) { |
|
320 |
logger.warn("Can't execute autorun from '" + autorun_file.getAbsolutePath() + "'.", ex); |
|
321 |
} |
|
322 |
|
|
323 |
} else { |
|
324 |
logger.info("Skip autorun script '" + autorun_file.getAbsolutePath() + "'."); |
|
325 |
} |
|
326 |
} |
|
327 |
} |
|
328 |
|
|
329 |
SimpleFileVisitor<Path> visitor = new SimpleFileVisitor<Path>() { |
|
330 |
@Override |
|
331 |
public FileVisitResult visitFile(Path path, BasicFileAttributes bfa) throws IOException { |
|
332 |
File file = path.toFile(); |
|
333 |
if ("autorun.inf".equalsIgnoreCase(file.getName())) { |
|
334 |
if (file.exists()) { |
|
335 |
ScriptingBaseScript autorun = manager.getScript(file); |
|
336 |
if( autorun.isEnabled() ) { |
|
337 |
logger.info("running autorun script '" + file.getAbsolutePath() + "'."); |
|
338 |
try { |
|
339 |
application.message( |
|
340 |
i18nManager.getTranslation( |
|
341 |
"_Running_autorun_script_from_XnameX", |
|
342 |
new String[]{autorun.getFile().getParentFile().getName()} |
|
343 |
), |
|
344 |
JOptionPane.INFORMATION_MESSAGE |
|
345 |
); |
|
346 |
} catch (Exception ex) { |
|
347 |
// Ignore |
|
348 |
} |
|
349 |
try { |
|
350 |
autorun.run(); |
|
351 |
} catch (Exception ex) { |
|
352 |
logger.warn("Can't execute autorun from '" + file.getAbsolutePath() + "'.", ex); |
|
353 |
} |
|
354 |
} else { |
|
355 |
logger.info("Skip autorun script '" + file.getAbsolutePath() + "'."); |
|
356 |
} |
|
357 |
} |
|
358 |
} |
|
359 |
return FileVisitResult.CONTINUE; |
|
360 |
} |
|
361 |
}; |
|
362 |
try { |
|
363 |
EnumSet<FileVisitOption> opts = EnumSet.of(FOLLOW_LINKS); |
|
364 |
Files.walkFileTree(Paths.get(manager.getRootUserFolder().toURI()), opts, Integer.MAX_VALUE, visitor); |
|
365 |
List<ScriptingFolder> folders = manager.getAlternativeUserFolders(); |
|
366 |
for (ScriptingFolder folder : folders) { |
|
367 |
Files.walkFileTree(Paths.get(folder.getFile().toURI()), opts, Integer.MAX_VALUE, visitor); |
|
368 |
} |
|
369 |
} catch (Exception ex) { |
|
370 |
logger.warn("Can't execute autoruns in home.", ex); |
|
371 |
} |
|
372 |
} finally { |
|
373 |
logger.info("Running autorun scripts terminated."); |
|
374 |
application.message("", JOptionPane.INFORMATION_MESSAGE); |
|
375 |
} |
|
376 |
} |
|
377 |
|
|
378 |
} |
|
379 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/gvsigsh | ||
---|---|---|
1 |
#!/bin/sh |
|
2 |
|
|
3 |
#set -x |
|
4 |
|
|
5 |
cd $(dirname $0) |
|
6 |
|
|
7 |
if [ -f lib/org.gvsig.andami-2* ] ; then |
|
8 |
GVSIG_HOME=`dirname "$0"` |
|
9 |
else |
|
10 |
if [ -f lib/org.gvsig.scripting.main-* ] ; then |
|
11 |
GVSIG_HOME=`dirname "$0"`/../../.. |
|
12 |
else |
|
13 |
echo "Can't locate gvSIG installation folder" |
|
14 |
exit 1 |
|
15 |
fi |
|
16 |
fi |
|
17 |
|
|
18 |
cd "${GVSIG_HOME}" |
|
19 |
GVSIG_HOME=$PWD |
|
20 |
|
|
21 |
for d in gvSIG/extensiones/org.gvsig.app/lib \ |
|
22 |
gvSIG/extensiones/org.gvsig.scripting.app.extension/lib \ |
|
23 |
gvSIG/extensiones/org.gvsig.geometry.app.generalpath/lib \ |
|
24 |
gvSIG/extensiones/org.gvsig.projection.app.proj4j/lib \ |
|
25 |
gvSIG/extensiones/org.gvsig.projection.app.jcrs/lib ; |
|
26 |
do |
|
27 |
for i in $d/*.jar ; do |
|
28 |
LIBRARIES="$LIBRARIES:$i" |
|
29 |
done |
|
30 |
for i in $d/*.zip ; do |
|
31 |
LIBRARIES="$LIBRARIES:$i" |
|
32 |
done |
|
33 |
done |
|
34 |
|
|
35 |
GVSIG_LAUNCHER=org.gvsig.scripting.main.Main |
|
36 |
GVSIG_CLASSPATH="$LIBRARIES" |
|
37 |
GVSIG_PARAMS=" --plugins-folder=gvSIG/extensiones $@" |
|
38 |
. ./gvSIG.sh |
|
39 |
|
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/plugin-persistence.def | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
Definitions of plugin persistence org.gvsig.scripting.app.mainplugin. |
|
4 |
--> |
|
5 |
<definitions> |
|
6 |
<version>1.0.0</version> |
|
7 |
<classes> |
|
8 |
<class name="org.gvsig.scripting.app.mainplugin"> |
|
9 |
<description>Persistence of scripting plugin</description> |
|
10 |
<fields> |
|
11 |
<field name="ComposerUseHisWindowManager" type="boolean" mandatory="true" defaultValue="true"> |
|
12 |
<description>When true the composer use his window manager instead of the gvSIG Window manager.</description> |
|
13 |
</field> |
|
14 |
</fields> |
|
15 |
</class> |
|
16 |
</classes> |
|
17 |
</definitions> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
1 |
_Scripting=Scripting |
|
2 |
_Show_scripting_launcher=Abrir lanzador de scripts |
|
3 |
_Show_scripting_composer=Abrir editor de scripts |
|
4 |
_Show_scripting_jython_console=Abrir consola Jython |
|
5 |
|
|
6 |
User=Usuario |
|
7 |
System=Sistema |
|
8 |
|
|
9 |
Accept=Aceptar |
|
10 |
Cancel=Cancelar |
|
11 |
Apply=Aplicar |
|
12 |
|
|
13 |
Retrieving_data=Recibiendo datos... |
|
14 |
|
|
15 |
File=Fichero |
|
16 |
New=Nuevo |
|
17 |
Close_document=Cerrar documento |
|
18 |
Close_all_documents=Cerrar todos los documentos |
|
19 |
Run=Ejecutar |
|
20 |
Save=Guardar |
|
21 |
Close=Cerrar |
|
22 |
Close_current_tab=Cerrar pesta\u00f1a actual |
|
23 |
Open_edition_mode=Abrir modo edici\u00f3n |
|
24 |
Run_selected_script=Ejecutar script seleccionado |
|
25 |
Delete_selected_script=Borrar script seleccionado |
|
26 |
Refresh_directories=Actualizar carpetas |
|
27 |
Move_files=Mover ficheros |
|
28 |
Set_file_preferences=Editar preferencias de fichero |
|
29 |
|
|
30 |
|
|
31 |
Edit=Editar |
|
32 |
Cut=Cortar |
|
33 |
Copy=Copiar |
|
34 |
Paste=Pegar |
|
35 |
Select_all=Seleccionar todo |
|
36 |
|
|
37 |
Tools=Herramientas |
|
38 |
Launcher=Lanzador de scripts |
|
39 |
Scripting_Launcher=Lanzador de scripts |
|
40 |
Scripting_Composer=Editor de scripts |
|
41 |
Jython_Console=Consola Jython |
|
42 |
Import_JavaDoc=Importar JavaDoc |
|
43 |
JavaDoc=Ayuda de Java (JavaDoc) |
|
44 |
Remove_JavaDoc=Eliminar JavaDoc |
|
45 |
Help_contents=Contenido de la ayuda |
|
46 |
About_scripts_editor=Acerca del editor de scripts |
|
47 |
Get_help=Ayuda |
|
48 |
Help=Ayuda |
|
49 |
_Package_script=Empaquetar script... |
|
50 |
_Package_help=Empaquetar ayuda... |
|
51 |
|
|
52 |
Problems=Errores |
|
53 |
Console=Consola |
|
54 |
|
|
55 |
Description=Descripci\u00f3n |
|
56 |
Resource=Recurso |
|
57 |
Location=Ubicaci\u00f3n |
|
58 |
|
|
59 |
no_line=sin l\u00ednea |
|
60 |
Line=L\u00ednea |
|
61 |
|
|
62 |
Welcome_message=Bienvenido al entorno de scripting |
|
63 |
|
|
64 |
Error_opening_in_edition_mode_title=Error al abrir fichero |
|
65 |
Error_opening_in_edition_mode=No se pudo abrir el fichero en modo edici\u00f3n |
|
66 |
|
|
67 |
New_Script=Nuevo elemento |
|
68 |
New_Script_Description=Crea un nuevo script, di\u00e1logo, proyecto, directorio |
|
69 |
|
|
70 |
Deleting_JavaDocs_successfully_title=Operaci\u00f3n realizada con \u00e9xito |
|
71 |
Deleting_JavaDocs_successfully=Eliminaci\u00f3n de los JavaDocs exitosa |
|
72 |
|
|
73 |
Import_JavaDoc_title=Importar JavaDocs desde los directorios de sistema al ScriptingFramework JavaDoc |
|
74 |
Remove_JavaDoc_title=Eliminar JavaDocs del ScriptingFramework JavaDoc |
|
75 |
|
|
76 |
projects_modified_title=Proyectos sin guardar |
|
77 |
projects_modified=Algunos proyectos han sido modificados.\u00bfSalvar cambios? |
|
78 |
project_modified=ha sido modificado.\u00bfSalvar cambios? |
|
79 |
|
|
80 |
Delete_all_title=Borrar el proyecto |
|
81 |
Delete_all_message=Esta acci\u00f3n elimina el directorio y todo su contenido. \u00bfContinuar? |
|
82 |
|
|
83 |
About_us_title=Informaci\u00f3n de todos los contribuidores al proyecto gvSIG |
|
84 |
|
|
85 |
Success=Operaci\u00f3n realizada con \u00e9xito |
|
86 |
Error=Error |
|
87 |
Error_renaming=Inesperado error renombrando el fichero |
|
88 |
Error_moving=Inesperado error moviendo el fichero |
|
89 |
Error_help=Selecciona una ayuda |
|
90 |
Rename_succesfully=Renombrado del fichero realizado con \u00e9xito |
|
91 |
Select_first=Debe seleccionar un fichero primero |
|
92 |
help_key=No hay ayuda para el texto |
|
93 |
|
|
94 |
|
|
95 |
script_filesystem=script en el \u00e1rbol de directorio |
|
96 |
Move=Mover |
|
97 |
move_desc=Cambia la ubicaci\u00f3n del fichero seleccionado |
|
98 |
Rename=Renombrar |
|
99 |
rename_desc=Cambia el nombre y otras propiedades del fichero seleccionado |
|
100 |
Moving_succesfully=Reubicaci\u00f3n del fichero realizado con \u00e9xito |
|
101 |
|
|
102 |
Dialog=Di\u00e1logo |
|
103 |
Code=C\u00f3digo |
|
104 |
Properties=Propiedades |
|
105 |
|
|
106 |
current_name=Nombre actual |
|
107 |
new_name=Nuevo name |
|
108 |
rename_name_title=Cambiar el nombre del fichero |
|
109 |
more_properties=M\u00e1s propiedades |
|
110 |
|
|
111 |
Javadoc_remove=Selecciona el JavaDoc a eliminar |
|
112 |
no_Javadoc_remove=No hay JavaDoc para eliminar |
|
113 |
|
|
114 |
Name=Nombre |
|
115 |
Version=Versi\u00f3n |
|
116 |
Created_by=Creado por |
|
117 |
Description=Descripci\u00f3n |
|
118 |
Type=Tipo |
|
119 |
Language=Lenguaje |
|
120 |
Author=Autor |
|
121 |
Move_from=Mover desde |
|
122 |
Move_to=Destino |
|
123 |
Browse=Abrir |
|
124 |
Import_from=Importar desde |
|
125 |
|
|
126 |
Name_blank=El nombre no puede estar en blanco |
|
127 |
Name_exists=Este nombre ya existe. Debe elegir otro |
|
128 |
Import_success=Los JavaDocs se han importado satisfactoriamente |
|
129 |
JavaDoc_Error=Selecciona JavaDoc a importar |
|
130 |
|
|
131 |
go_to_line_Xhorizontal_ellipsisX=Ir a la l\u00ednea\u2026 |
|
132 |
find_Xhorizontal_ellipsisX=Buscar\u2026 |
|
133 |
replace_Xhorizontal_ellipsisX=Reemplazar\u2026 |
|
134 |
_Searching_autorun_scripts_Xhorizontal_ellipsisX=Buscando scripts de autoarranque... |
|
135 |
_Running_autorun_script_from_XnameX=Ejecutando script de autoarranque desde "{0}" |
|
136 |
_The_script_XscriptnameX_is_modified=El script "{0}" ha sido modificado. |
|
137 |
_Save_changes_XquestionX=\u00bf Guardar cambios ? |
|
138 |
_Do_you_want_to_save_changes_XquestionX=\u00bf Desea guardar los cambios ? |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
1 |
_Scripting=Scripting |
|
2 |
_Show_scripting_launcher=Show scripting launcher |
|
3 |
_Show_scripting_composer=Show scripting composer |
|
4 |
_Show_scripting_jython_console=Show Jython console |
|
5 |
|
|
6 |
User=User |
|
7 |
System=System |
|
8 |
|
|
9 |
Accept=Accept |
|
10 |
Cancel=Cancel |
|
11 |
Apply=Apply |
|
12 |
|
|
13 |
Retrieving_data=Retrieving data... |
|
14 |
|
|
15 |
File=File |
|
16 |
New=New |
|
17 |
Close_document=Close document |
|
18 |
Close_all_documents=Cloase all documents |
|
19 |
Run=Run |
|
20 |
Save=Save |
|
21 |
Close=Close |
|
22 |
Close_current_tab=Close current tab |
|
23 |
Open_edition_mode=Open edition mode |
|
24 |
Run_selected_script=Run selected script |
|
25 |
Delete_selected_script=Delete selected script |
|
26 |
Refresh_directories=Refresh directories |
|
27 |
Move_files=Move files |
|
28 |
Set_file_preferences=Set file preferences |
|
29 |
_Running_autorun_script_from_XnameX=Running autorun script from {0} |
|
30 |
|
|
31 |
Edit=Edit |
|
32 |
Cut=Cut |
|
33 |
Copy=Copy |
|
34 |
Paste=Paste |
|
35 |
Select_all=Select all |
|
36 |
|
|
37 |
Tools=Tools |
|
38 |
Launcher=Scripting Launcher |
|
39 |
Scripting_Launcher=Scripting Launcher |
|
40 |
Scripting_Composer=Scripting Composer |
|
41 |
Jython_Console=Jython console |
|
42 |
Import_JavaDoc=Import JavaDoc |
|
43 |
JavaDoc=Java Help (JavaDoc) |
|
44 |
Remove_JavaDoc=Remove JavaDoc |
|
45 |
Help_contents=Help contents |
|
46 |
About_scripts_editor=About scripts editor |
|
47 |
Get_help=Help |
|
48 |
Help=Help |
|
49 |
_Package_script=Package script... |
|
50 |
_Package_help=Package help... |
|
51 |
|
|
52 |
Problems=Errors |
|
53 |
Console=Console |
|
54 |
|
|
55 |
Description=Description |
|
56 |
Resource=Resource |
|
57 |
Location=Location |
|
58 |
|
|
59 |
no_line=no line |
|
60 |
Line=Line |
|
61 |
|
|
62 |
Welcome_message=Welcome to the scripting framework |
|
63 |
|
|
64 |
Error_opening_in_edition_mode_title=Error opening file in edition mode |
|
65 |
Error_opening_in_edition_mode=The file can't be opened in edition mode |
|
66 |
|
|
67 |
New_Script=New element |
|
68 |
New_Script_Description=Create a new script, dialog, project, directory |
|
69 |
|
|
70 |
Deleting_JavaDocs_successfully_title=Operation successful |
|
71 |
Deleting_JavaDocs_successfully=Deleting JavaDocs successfully |
|
72 |
|
|
73 |
Import_JavaDoc_title=Import JavaDocs from filesystem to ScriptingFramework JavaDoc |
|
74 |
Remove_JavaDoc_title=Remove JavaDocs from ScriptingFramework JavaDoc |
|
75 |
|
|
76 |
projects_modified_title=Projects without saving |
|
77 |
projects_modified=Some projects have been modified. Save changes? |
|
78 |
project_modified=has been modified. Save changes? |
|
79 |
|
|
80 |
Delete_all_title=Delete project |
|
81 |
Delete_all_message=This action removes the directory and all its content. Continue? |
|
82 |
|
|
83 |
About_us_title=Information about all the gvSIG's contributors |
|
84 |
|
|
85 |
Success=Operation done successfully |
|
86 |
Error=Error |
|
87 |
Error_renaming=Unexpected error renaming the file |
|
88 |
Error_moving=Unexpected error moving the file |
|
89 |
Error_help=Select help |
|
90 |
Rename_succesfully=Renaming successfully |
|
91 |
Select_first=Select a file first |
|
92 |
help_key=There isn't any help to this text |
|
93 |
|
|
94 |
|
|
95 |
script_filesystem=script filesystem |
|
96 |
Move=Move |
|
97 |
move_desc=Change location of selected file |
|
98 |
Rename=Rename |
|
99 |
rename_desc=Change the name and more properties of the selected file |
|
100 |
Moving_succesfully=File moved succesfully |
|
101 |
|
|
102 |
Dialog=Dialog |
|
103 |
Code=Code |
|
104 |
Properties=Properties |
|
105 |
|
|
106 |
current_name=Current name |
|
107 |
new_name=New name |
|
108 |
rename_name_title=Change filename |
|
109 |
more_properties=more properties |
|
110 |
|
|
111 |
Javadoc_remove=Choose JavaDoc to delete |
|
112 |
no_Javadoc_remove=There's no JavaDoc to delete |
|
113 |
|
|
114 |
Name=Name |
|
115 |
Version=Version |
|
116 |
Created_by=Create by |
|
117 |
Description=Description |
|
118 |
Type=Type |
|
119 |
Language=Language |
|
120 |
Author=Author |
|
121 |
Move_from=Move from |
|
122 |
Move_to=Move to |
|
123 |
Browse=Browse |
|
124 |
Import_from=Import from |
|
125 |
|
|
126 |
Name_blank=Name can't be blank |
|
127 |
Name_exists=This name already exists. Choose another one |
|
128 |
Import_success=JavaDocs imported successfully |
|
129 |
JavaDoc_Error=Select JavaDoc to import |
|
130 |
|
|
131 |
|
|
132 |
go_to_line_Xhorizontal_ellipsisX=Go To Line\u2026 |
|
133 |
find_Xhorizontal_ellipsisX=Find\u2026 |
|
134 |
replace_Xhorizontal_ellipsisX=Replace\u2026 |
|
135 |
|
|
136 |
_Searching_autorun_scripts_Xhorizontal_ellipsisX=Searching autorun scripts... |
|
137 |
_Running_autorun_script_from_XnameX=Running autorun script from "{0}" |
|
138 |
_The_script_XscriptnameX_is_modified=The script "{0}" has been modified. |
|
139 |
_Save_changes_XquestionX=Save changes ? |
|
140 |
_Do_you_want_to_save_changes_XquestionX=Do you want to save changes ? |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/License_Chalkwork_icons.txt | ||
---|---|---|
1 |
---------------------------------------------- |
|
2 |
CHALKWORK BASIC |
|
3 |
by Dave Shea |
|
4 |
mezzoblue.com/icons/chalkwork/basic |
|
5 |
---------------------------------------------- |
|
6 |
CHALKWORK COMMERCE |
|
7 |
by Dave Shea |
|
8 |
mezzoblue.com/icons/chalkwork/commerce |
|
9 |
---------------------------------------------- |
|
10 |
CHALKWORK EDITING CONTROLS |
|
11 |
by Dave Shea |
|
12 |
mezzoblue.com/icons/chalkwork/editing-controls |
|
13 |
---------------------------------------------- |
|
14 |
CHALKWORK INFORMATION MANAGEMENT |
|
15 |
by Dave Shea |
|
16 |
mezzoblue.com/icons/chalkwork/information-management |
|
17 |
---------------------------------------------- |
|
18 |
CHALKWORK HTML (Free Version) |
|
19 |
by Dave Shea |
|
20 |
mezzoblue.com/icons/chalkwork/html |
|
21 |
---------------------------------------------- |
|
22 |
|
|
23 |
Thanks for your interest in the Chalkwork Family. Please consider subscribing to the Chalkwork news feed, which will announce new releases in the family as well as inform existing users of updates if any occur. |
|
24 |
|
|
25 |
http://mezzoblue.com/icons/chalkwork/news.xml |
|
26 |
|
|
27 |
- Dave Shea |
|
28 |
mezzoblue.com |
|
29 |
@mezzoblue on Twitter |
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
LICENSE AGREEMENT |
|
35 |
---------------------------------------------- |
|
36 |
By downloading this icon set, you agree to abide by the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License under which these icons are being made available for non-commercial use. |
|
37 |
|
|
38 |
Applicable Creative Commons License: http://creativecommons.org/licenses/by-nc-sa/3.0/ |
|
39 |
Attribution and additional license information: http://www.mezzoblue.com/icons/license/#license-cc |
|
40 |
|
|
41 |
By purchasing a Chalkwork Commercial License, you agree to abide by the Chalkwork Royalty-Free Stock Icon License Agreement under which these icons are being made available for commercial use. |
|
42 |
|
|
43 |
Chalkwork Commercial License: http://www.mezzoblue.com/icons/license/#license-cc |
|
44 |
|
|
45 |
This notice must be included any time these icons are redistributed. |
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
---------------------------------------------- |
|
51 |
ICON FOLDER INDEX |
|
52 |
---------------------------------------------- |
|
53 |
The icon files are broken down by file format. Due to some formats resulting in higher quality results, those are considered the preferred files and are located in the folder titled 'High Quality'. This package should contain the following folders in this hierarchy: |
|
54 |
|
|
55 |
High Quality |
|
56 |
ICNS (Mac) |
|
57 |
ICO (Windows) |
|
58 |
PNG |
|
59 |
TIF |
|
60 |
Lower Quality |
|
61 |
BMP |
|
62 |
GIF |
|
63 |
|
|
64 |
Within each of the second-level folders, you'll find 102 further folders, one for each icon and its variations. Depending on the file format, you may find multiple sizes within these folders along with any icon variations that may exist. Please note that ICO and ICNS files contain all applicable sizes within a single file, and that ICNS files do not support the 24x24 icon size. |
|
65 |
|
|
66 |
|
|
67 |
---------------------------------------------- |
|
68 |
CHALKWORK INFORMATION MANAGEMENT ICON INDEX |
|
69 |
* indicates that variations of this icon are provided within this set |
|
70 |
--------------------------------------------------------------------- |
|
71 |
|
|
72 |
Ad |
|
73 |
- Ad (Dollars) * |
|
74 |
- Ad (Euros) * |
|
75 |
- Ad (Pounds) * |
|
76 |
Address Book * |
|
77 |
Announcement * |
|
78 |
API |
|
79 |
Archive * |
|
80 |
Attachment * |
|
81 |
Authenticate |
|
82 |
Blog * |
|
83 |
Bookmark * |
|
84 |
Briefcase * |
|
85 |
Category * |
|
86 |
Chart (Area) * |
|
87 |
Chart (Bar) * |
|
88 |
Chart (Pie) * |
|
89 |
Collapse |
|
90 |
Colour Palette * |
|
91 |
Continue |
|
92 |
Control Panel |
|
93 |
Conversation * |
|
94 |
Create |
|
95 |
Dashboard * |
|
96 |
Database * |
|
97 |
Dictionary * |
|
98 |
Document (Area Chart) * |
|
99 |
Document (Bar Chart) * |
|
100 |
Document (Blank) * |
|
101 |
Document (Form) * |
|
102 |
Document (Photo) * |
|
103 |
Document (Pie Chart) * |
|
104 |
Document (Secure) * |
|
105 |
Document (Shred) |
|
106 |
Documents (x2) * |
|
107 |
Documents (x3) * |
|
108 |
Download |
|
109 |
Draw |
|
110 |
Entry * |
|
111 |
Excerpt * |
|
112 |
Expand |
|
113 |
Export |
|
114 |
Fax * |
|
115 |
File * |
|
116 |
- File (Closed) |
|
117 |
- File (Open) |
|
118 |
Filter * |
|
119 |
Flag * |
|
120 |
Flag (Black) * |
|
121 |
Flag (Blue) * |
|
122 |
Flag (Brown) * |
|
123 |
Flag (Green) * |
|
124 |
Flag (Light Blue) * |
|
125 |
Flag (Orange) * |
|
126 |
Flag (Pink) * |
|
127 |
Flag (Purple) * |
|
128 |
Flag (Red) * |
|
129 |
Flag (White) * |
|
130 |
Flag (Yellow) * |
|
131 |
Formatting |
|
132 |
Hierarchy * |
|
133 |
Import |
|
134 |
Inbox * |
|
135 |
Index * |
|
136 |
List * |
|
137 |
Log * |
|
138 |
Map * |
|
139 |
Mobile Phone * |
|
140 |
Moderate |
|
141 |
Module * |
|
142 |
News * |
|
143 |
Notes * |
|
144 |
Notification * |
|
145 |
Office * |
|
146 |
Package * |
|
147 |
Password |
|
148 |
Phone * |
|
149 |
- Phone (Batphone) * |
|
150 |
- Phone (Office) * |
|
151 |
Plugin * |
|
152 |
Preview |
|
153 |
Publish |
|
154 |
Read More |
|
155 |
Rebuild |
|
156 |
Relationship (Data) * |
|
157 |
Relationship (People) * |
|
158 |
Rotate Left |
|
159 |
Rotate Right |
|
160 |
Schedule * |
|
161 |
- Schedule (Noun) |
|
162 |
- Schedule (Verb) |
|
163 |
Script * |
|
164 |
Security * |
|
165 |
Sign In |
|
166 |
Sign Out |
|
167 |
Sort Down |
|
168 |
Sort Up |
|
169 |
Spam * |
|
170 |
Statistics * |
|
171 |
Status * |
|
172 |
- Status (Green) |
|
173 |
- Status (Off) |
|
174 |
- Status (On) |
|
175 |
- Status (Red) |
|
176 |
- Status (Yellow) |
|
177 |
Support * |
|
178 |
Sync |
|
179 |
Template * |
|
180 |
Ticket * |
|
181 |
Time Zone * |
|
182 |
Tools * |
|
183 |
Trackback |
|
184 |
View (Columns) |
|
185 |
View (Lists) |
|
186 |
View (Thumbnails) |
|
187 |
Weather * |
|
188 |
Write |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.19/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib-2_0_0/gvsig.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
# |
|
3 |
# File: gvsig.py |
|
4 |
# |
|
5 |
# Copyright (c) 2011 by Model Driven Development sl and Antonio Carrasco Valero |
|
6 |
# |
|
7 |
# GNU General Public License (GPL) |
|
8 |
# |
|
9 |
# This program is free software; you can redistribute it and/or |
|
10 |
# modify it under the terms of the GNU General Public License |
|
11 |
# as published by the Free Software Foundation; either version 2 |
|
12 |
# of the License, or (at your option) any later version. |
|
13 |
# |
|
14 |
# This program is distributed in the hope that it will be useful, |
|
15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
# GNU General Public License for more details. |
|
18 |
# |
|
19 |
# You should have received a copy of the GNU General Public License |
|
20 |
# along with this program; if not, write to the Free Software |
|
21 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
22 |
# 02110-1301, USA. |
|
23 |
# |
|
24 |
# |
|
25 |
|
|
26 |
""" |
|
27 |
This module contains classes and functions to manage gvSIG Project, |
|
28 |
gvSIG DocumentView, gvSIG TableDocument and Layers. |
|
29 |
Also contais functions to manage vectorial data and other utility |
|
30 |
functions |
|
31 |
""" |
|
32 |
|
|
33 |
__author__ = """Antonio Carrasco Valero |
|
34 |
Model Driven Development sl and Antonio Carrasco Valero |
|
35 |
<carrasco@modeldd.org> |
|
36 |
Victor Acevedo Royer <vacevedor@gvsig.com>, <vacevedor@gmail.com> |
|
37 |
""" |
|
38 |
|
|
39 |
__docformat__ = 'plaintext' |
|
40 |
|
|
41 |
from java.awt import Color |
|
42 |
|
|
43 |
from java.lang import RuntimeException |
|
44 |
from java.lang import Throwable |
|
45 |
import java.lang.IndexOutOfBoundsException |
|
46 |
|
|
47 |
from java.util.prefs import Preferences |
|
48 |
|
|
49 |
from org.gvsig.app import ApplicationLocator |
|
50 |
from org.gvsig.app.project.documents.view import ViewDocument |
|
51 |
from org.gvsig.app.project.documents.table import TableDocument |
|
52 |
|
|
53 |
from org.gvsig.fmap.crs import CRSFactory |
|
54 |
|
|
55 |
from org.gvsig.fmap.mapcontext import MapContextLocator |
|
56 |
from org.gvsig.fmap.mapcontext.layers import FLayers |
|
57 |
|
|
58 |
from org.gvsig.fmap.dal import DALLocator, DataTypes |
|
59 |
from org.gvsig.fmap.dal.feature import EditableFeature, \ |
|
60 |
EditableFeatureType, FeatureQueryOrder |
|
61 |
from org.gvsig.fmap.dal.feature.impl import DefaultEditableFeature |
|
62 |
|
|
63 |
from org.gvsig.fmap.geom import Geometry |
|
64 |
|
|
65 |
from org.gvsig.tools import ToolsLocator |
|
66 |
|
|
67 |
import thread |
|
68 |
import random |
|
69 |
|
|
70 |
|
|
71 |
def runTask(name, function, *args): |
|
72 |
manager = ToolsLocator.getTaskStatusManager() |
|
73 |
status = manager.createDefaultSimpleTaskStatus(name) |
|
74 |
status.add() |
|
75 |
args = list(args) |
|
76 |
args.append(status) |
|
77 |
try: |
|
78 |
thread.start_new_thread(function, tuple(args)) |
|
79 |
status.terminate() |
|
80 |
except Exception,e: |
|
81 |
status.abort() |
|
82 |
raise e |
|
83 |
|
|
84 |
|
|
85 |
class WrapperToJava(object): |
|
86 |
"""Creates a wrapper that allows python object access to the Java object |
|
87 |
properties and methods |
|
88 |
""" |
|
89 |
def __init__(self, javaobj): |
|
90 |
if javaobj == None: |
|
91 |
raise RuntimeException("Can't create "+ self.__class__.__name__) |
|
92 |
self._javaobj = javaobj |
|
93 |
|
|
94 |
def __call__(self): |
|
95 |
return self._javaobj |
|
96 |
|
|
97 |
def __getattr__(self,name): |
|
98 |
return getattr(self._javaobj,name) |
|
99 |
|
|
100 |
class Project(WrapperToJava): |
|
101 |
"""Represents a gvSIG project (org.gvsig.app.project.DefaultProject)""" |
|
102 |
|
|
103 |
def __init__(self, project): |
|
104 |
WrapperToJava.__init__(self, project) |
|
105 |
|
|
106 |
def getView(self, name=None): |
|
107 |
""" |
|
108 |
Returns active view, or view called 'name' or None |
|
109 |
:param name: view name |
|
110 |
:type name: string |
|
111 |
""" |
|
112 |
if name == None: |
|
113 |
try: |
|
114 |
activeDocument = self.getActiveDocument() |
|
115 |
if activeDocument == None: |
|
116 |
return None |
|
117 |
if isinstance(activeDocument, ViewDocument): |
|
118 |
return View(activeDocument) |
|
119 |
except Exception, ex: |
|
120 |
raise Exception("%s"%repr(ex)) |
|
121 |
else: |
|
122 |
views = self.getViews() |
|
123 |
if len(views) >0: |
|
124 |
for view in views: |
|
125 |
if name == view.getName(): |
|
126 |
return View(view) |
|
127 |
|
|
128 |
return None |
|
129 |
|
|
130 |
def getTable(self, name=None): |
|
131 |
""" |
|
132 |
Returns active Table Document, or Table Document called 'name' or None |
|
133 |
:param name: Table Document name |
|
134 |
:type name: string |
|
135 |
""" |
|
136 |
if name == None: |
|
137 |
try: |
|
138 |
activeDocument = self.getActiveDocument() |
|
139 |
if activeDocument == None: |
|
140 |
return None |
|
141 |
if isinstance(activeDocument, TableDocument): |
|
142 |
return Table(activeDocument) |
|
143 |
except Exception, ex: |
|
144 |
raise Exception("%s"%repr(ex)) |
|
145 |
else: |
|
146 |
tables = self.getDocuments("project.document.table") |
Also available in: Unified diff