Revision 1138
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.77/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Mon Oct 14 12:43:56 CEST 2019 |
|
2 |
buildNumber=157 |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.77/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/InstallCert.java | ||
---|---|---|
1 |
package org.gvsig.scripting.app; |
|
2 |
|
|
3 |
/* |
|
4 |
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. |
|
5 |
* |
|
6 |
* Redistribution and use in source and binary forms, with or without |
|
7 |
* modification, are permitted provided that the following conditions |
|
8 |
* are met: |
|
9 |
* |
|
10 |
* - Redistributions of source code must retain the above copyright |
|
11 |
* notice, this list of conditions and the following disclaimer. |
|
12 |
* |
|
13 |
* - Redistributions in binary form must reproduce the above copyright |
|
14 |
* notice, this list of conditions and the following disclaimer in the |
|
15 |
* documentation and/or other materials provided with the distribution. |
|
16 |
* |
|
17 |
* - Neither the name of Sun Microsystems nor the names of its |
|
18 |
* contributors may be used to endorse or promote products derived |
|
19 |
* from this software without specific prior written permission. |
|
20 |
* |
|
21 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
|
22 |
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
|
23 |
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
24 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
|
25 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
26 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
27 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|
28 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|
29 |
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
30 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
31 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 |
*/ |
|
33 |
/** |
|
34 |
* Originally from: |
|
35 |
* http://blogs.sun.com/andreas/resource/InstallCert.java |
|
36 |
* Use: |
|
37 |
* java InstallCert hostname |
|
38 |
* Example: |
|
39 |
*% java InstallCert ecc.fedora.redhat.com |
|
40 |
*/ |
|
41 |
|
|
42 |
import java.io.BufferedReader; |
|
43 |
import java.io.File; |
|
44 |
import java.io.FileInputStream; |
|
45 |
import java.io.FileOutputStream; |
|
46 |
import java.io.InputStream; |
|
47 |
import java.io.InputStreamReader; |
|
48 |
import java.io.OutputStream; |
|
49 |
import java.security.KeyStore; |
|
50 |
import java.security.MessageDigest; |
|
51 |
import java.security.cert.CertificateException; |
|
52 |
import java.security.cert.X509Certificate; |
|
53 |
|
|
54 |
import javax.net.ssl.SSLContext; |
|
55 |
import javax.net.ssl.SSLException; |
|
56 |
import javax.net.ssl.SSLSocket; |
|
57 |
import javax.net.ssl.SSLSocketFactory; |
|
58 |
import javax.net.ssl.TrustManager; |
|
59 |
import javax.net.ssl.TrustManagerFactory; |
|
60 |
import javax.net.ssl.X509TrustManager; |
|
61 |
|
|
62 |
/** |
|
63 |
* Class used to add the server's certificate to the KeyStore |
|
64 |
* with your trusted certificates. |
|
65 |
* |
|
66 |
* NOTE: modified to install the certificate always into the main cacerts |
|
67 |
* keystore. |
|
68 |
*/ |
|
69 |
public class InstallCert { |
|
70 |
|
|
71 |
public static void install(String host, Integer port, String passphrase) throws Exception { |
|
72 |
if( passphrase==null ) { |
|
73 |
passphrase = "changeit"; |
|
74 |
} |
|
75 |
if( port == null || port <1) { |
|
76 |
port = 443; |
|
77 |
} |
|
78 |
main( |
|
79 |
new String[] { |
|
80 |
host +":"+port, |
|
81 |
passphrase |
|
82 |
} |
|
83 |
); |
|
84 |
} |
|
85 |
|
|
86 |
public static void main(String[] args) throws Exception { |
|
87 |
String host; |
|
88 |
int port; |
|
89 |
char[] passphrase; |
|
90 |
if ((args.length == 1) || (args.length == 2)) { |
|
91 |
String[] c = args[0].split(":"); |
|
92 |
host = c[0]; |
|
93 |
port = (c.length == 1) ? 443 : Integer.parseInt(c[1]); |
|
94 |
String p = (args.length == 1) ? "changeit" : args[1]; |
|
95 |
passphrase = p.toCharArray(); |
|
96 |
} else { |
|
97 |
System.out.println("Usage: java InstallCert [:port] [passphrase]"); |
|
98 |
return; |
|
99 |
} |
|
100 |
|
|
101 |
File file = null; |
|
102 |
// File file = new File("jssecacerts"); |
|
103 |
// if (file.isFile() == false) { |
|
104 |
char SEP = File.separatorChar; |
|
105 |
File dir = |
|
106 |
new File(System.getProperty("java.home") + SEP + "lib" + SEP |
|
107 |
+ "security"); |
|
108 |
// file = new File(dir, "jssecacerts"); |
|
109 |
// if (file.isFile() == false) { |
|
110 |
file = new File(dir, "cacerts"); |
|
111 |
|
|
112 |
if (!file.canWrite()) { |
|
113 |
System.err |
|
114 |
.println("Unable to write in the file " |
|
115 |
+ file |
|
116 |
+ ".\nRun InstallCert as an administrator or a user with " |
|
117 |
+ "privileges to write in the cacerts file"); |
|
118 |
|
|
119 |
System.exit(-1); |
|
120 |
} |
|
121 |
// } |
|
122 |
// } |
|
123 |
System.out.println("Loading KeyStore " + file + "..."); |
|
124 |
InputStream in = new FileInputStream(file); |
|
125 |
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); |
|
126 |
ks.load(in, passphrase); |
|
127 |
in.close(); |
|
128 |
|
|
129 |
SSLContext context = SSLContext.getInstance("TLS"); |
|
130 |
TrustManagerFactory tmf = |
|
131 |
TrustManagerFactory.getInstance(TrustManagerFactory |
|
132 |
.getDefaultAlgorithm()); |
|
133 |
tmf.init(ks); |
|
134 |
X509TrustManager defaultTrustManager = |
|
135 |
(X509TrustManager) tmf.getTrustManagers()[0]; |
|
136 |
SavingTrustManager tm = new SavingTrustManager(defaultTrustManager); |
|
137 |
context.init(null, new TrustManager[] { tm }, null); |
|
138 |
SSLSocketFactory factory = context.getSocketFactory(); |
|
139 |
|
|
140 |
System.out |
|
141 |
.println("Opening connection to " + host + ":" + port + "..."); |
|
142 |
SSLSocket socket = (SSLSocket) factory.createSocket(host, port); |
|
143 |
socket.setSoTimeout(10000); |
|
144 |
try { |
|
145 |
System.out.println("Starting SSL handshake..."); |
|
146 |
socket.startHandshake(); |
|
147 |
socket.close(); |
|
148 |
System.out.println(); |
|
149 |
System.out.println("No errors, certificate is already trusted"); |
|
150 |
} catch (SSLException e) { |
|
151 |
System.out.println(); |
|
152 |
e.printStackTrace(System.out); |
|
153 |
} |
|
154 |
|
|
155 |
X509Certificate[] chain = tm.chain; |
|
156 |
if (chain == null) { |
|
157 |
System.out.println("Could not obtain server certificate chain"); |
|
158 |
return; |
|
159 |
} |
|
160 |
|
|
161 |
BufferedReader reader = |
|
162 |
new BufferedReader(new InputStreamReader(System.in)); |
|
163 |
|
|
164 |
System.out.println(); |
|
165 |
System.out.println("Server sent " + chain.length + " certificate(s):"); |
|
166 |
System.out.println(); |
|
167 |
MessageDigest sha1 = MessageDigest.getInstance("SHA1"); |
|
168 |
MessageDigest md5 = MessageDigest.getInstance("MD5"); |
|
169 |
for (int i = 0; i < chain.length; i++) { |
|
170 |
X509Certificate cert = chain[i]; |
|
171 |
System.out.println(" " + (i + 1) + " Subject " |
|
172 |
+ cert.getSubjectDN()); |
|
173 |
System.out.println(" Issuer " + cert.getIssuerDN()); |
|
174 |
sha1.update(cert.getEncoded()); |
|
175 |
System.out.println(" sha1 " + toHexString(sha1.digest())); |
|
176 |
md5.update(cert.getEncoded()); |
|
177 |
System.out.println(" md5 " + toHexString(md5.digest())); |
|
178 |
System.out.println(); |
|
179 |
} |
|
180 |
|
|
181 |
// int k=0; |
|
182 |
// System.out |
|
183 |
// .println("Enter certificate to add to trusted keystore or 'q' to quit: [1]"); |
|
184 |
// String line = reader.readLine().trim(); |
|
185 |
// try { |
|
186 |
// k = (line.length() == 0) ? 0 : Integer.parseInt(line) - 1; |
|
187 |
// } catch (NumberFormatException e) { |
|
188 |
// System.out.println("KeyStore not changed"); |
|
189 |
// return; |
|
190 |
// } |
|
191 |
|
|
192 |
for( int k=0; k<chain.length; k++ ) { |
|
193 |
X509Certificate cert = chain[k]; |
|
194 |
String alias = host + "-" + (k + 1); |
|
195 |
ks.setCertificateEntry(alias, cert); |
|
196 |
|
|
197 |
// OutputStream out = new FileOutputStream("jssecacerts"); |
|
198 |
OutputStream out = new FileOutputStream(file); |
|
199 |
ks.store(out, passphrase); |
|
200 |
out.close(); |
|
201 |
|
|
202 |
System.out.println(); |
|
203 |
System.out.println(cert); |
|
204 |
System.out.println(); |
|
205 |
System.out |
|
206 |
.println("Added certificate to keystore '" + |
|
207 |
file + "' using alias '" + alias + "'"); |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
private static final char[] HEXDIGITS = "0123456789abcdef".toCharArray(); |
|
212 |
|
|
213 |
private static String toHexString(byte[] bytes) { |
|
214 |
StringBuilder sb = new StringBuilder(bytes.length * 3); |
|
215 |
for (int b : bytes) { |
|
216 |
b &= 0xff; |
|
217 |
sb.append(HEXDIGITS[b >> 4]); |
|
218 |
sb.append(HEXDIGITS[b & 15]); |
|
219 |
sb.append(' '); |
|
220 |
} |
|
221 |
return sb.toString(); |
|
222 |
} |
|
223 |
|
|
224 |
private static class SavingTrustManager implements X509TrustManager { |
|
225 |
|
|
226 |
private final X509TrustManager tm; |
|
227 |
private X509Certificate[] chain; |
|
228 |
|
|
229 |
SavingTrustManager(X509TrustManager tm) { |
|
230 |
this.tm = tm; |
|
231 |
} |
|
232 |
|
|
233 |
public X509Certificate[] getAcceptedIssuers() { |
|
234 |
throw new UnsupportedOperationException(); |
|
235 |
} |
|
236 |
|
|
237 |
public void checkClientTrusted(X509Certificate[] chain, String authType) |
|
238 |
throws CertificateException { |
|
239 |
throw new UnsupportedOperationException(); |
|
240 |
} |
|
241 |
|
|
242 |
public void checkServerTrusted(X509Certificate[] chain, String authType) |
|
243 |
throws CertificateException { |
|
244 |
this.chain = chain; |
|
245 |
tm.checkServerTrusted(chain, authType); |
|
246 |
} |
|
247 |
} |
|
248 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.77/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.InputStream; |
|
26 |
import java.net.MalformedURLException; |
|
27 |
import java.net.URL; |
|
28 |
import java.util.List; |
|
29 |
import org.apache.commons.io.IOUtils; |
|
30 |
import org.apache.commons.lang3.StringUtils; |
|
31 |
|
|
32 |
import org.gvsig.andami.IconThemeHelper; |
|
33 |
import org.gvsig.andami.PluginServices; |
|
34 |
import org.gvsig.andami.PluginsLocator; |
|
35 |
import org.gvsig.andami.PluginsManager; |
|
36 |
import org.gvsig.andami.plugins.Extension; |
|
37 |
import org.gvsig.andami.plugins.PluginClassLoader; |
|
38 |
import org.gvsig.scripting.ScriptingLocator; |
|
39 |
import org.gvsig.scripting.ScriptingManager; |
|
40 |
import org.gvsig.scripting.swing.api.ScriptingSwingLocator; |
|
41 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
42 |
import org.gvsig.tools.dynobject.DynObject; |
|
43 |
import org.gvsig.tools.swing.impl.windowmanager.DefaultWindowManager; |
|
44 |
import org.slf4j.Logger; |
|
45 |
import org.slf4j.LoggerFactory; |
|
46 |
import org.gvsig.tools.script.Script; |
|
47 |
import org.gvsig.tools.util.Invocable; |
|
48 |
|
|
49 |
@SuppressWarnings("UseSpecificCatch") |
|
50 |
public class ScriptingExtension extends Extension { |
|
51 |
|
|
52 |
@SuppressWarnings("FieldNameHidesFieldInSuperclass") |
|
53 |
private static final Logger LOGGER = LoggerFactory.getLogger(ScriptingExtension.class); |
|
54 |
|
|
55 |
private ScriptingUtils utils; |
|
56 |
|
|
57 |
@Deprecated |
|
58 |
public static void log(String message) { |
|
59 |
ScriptingUtils.log(ScriptingUtils.INFO, message, null); |
|
60 |
} |
|
61 |
|
|
62 |
@Deprecated |
|
63 |
public static void log(int level, String message) { |
|
64 |
ScriptingUtils.log(level, message, null); |
|
65 |
} |
|
66 |
|
|
67 |
@Deprecated |
|
68 |
public static void log(int level, String message, Throwable th) { |
|
69 |
ScriptingUtils.log(level, message, th); |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public void initialize() { |
|
74 |
IconThemeHelper.registerIcon("action", "tools-scripting-launcher", this); |
|
75 |
IconThemeHelper.registerIcon("action", "tools-scripting-composer", this); |
|
76 |
IconThemeHelper.registerIcon("action", "tools-scripting-console-jython", this); |
|
77 |
|
|
78 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
|
79 |
this.utils = new ScriptingUtils(); |
|
80 |
|
|
81 |
this.utils.initializaPaths( |
|
82 |
pluginManager.getPluginsFolders(), |
|
83 |
pluginManager.getInstallFolder(), |
|
84 |
this.getPlugin().getPluginHomeFolder(), |
|
85 |
pluginManager.getApplicationVersion().format(ScriptsInstallerInitializer.VERSION_FORMAT) |
|
86 |
); |
|
87 |
|
|
88 |
Thread th = new Thread(new Runnable() { |
|
89 |
@Override |
|
90 |
public void run() { |
|
91 |
preloadPythonEngine(); |
|
92 |
} |
|
93 |
}, "ScriptEnginesInitializer"); |
|
94 |
th.start(); |
|
95 |
try { |
|
96 |
th.join(1000); // force change to other thread |
|
97 |
} catch (InterruptedException ex) { |
|
98 |
// Ignore. |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
@Override |
|
103 |
public void execute(String actionCommand) { |
|
104 |
this.execute(actionCommand, null); |
|
105 |
} |
|
106 |
|
|
107 |
@Override |
|
108 |
public void execute(String command, Object[] args) { |
|
109 |
|
|
110 |
|
|
111 |
if( "tools-scripting-launcher".equalsIgnoreCase(command) ) { |
|
112 |
utils.runLauncher(); |
|
113 |
|
|
114 |
} else if( "tools-scripting-composer".equalsIgnoreCase(command) ) { |
|
115 |
|
|
116 |
DynObject preferences = getPlugin().getPluginProperties(); |
|
117 |
Boolean composerUseHisWindowManager = (Boolean) preferences.getDynValue("ComposerUseHisWindowManager"); |
|
118 |
if( composerUseHisWindowManager ) { |
|
119 |
DefaultWindowManager winmanager = new DefaultWindowManager(); |
|
120 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
121 |
uimanager.setWindowManager(winmanager); |
|
122 |
} |
|
123 |
utils.runComposer(); |
|
124 |
|
|
125 |
} else { |
|
126 |
utils.runScript(command, args); |
|
127 |
} |
|
128 |
} |
|
129 |
|
|
130 |
private void preloadPythonEngine() { |
|
131 |
ScriptingManager manager = (ScriptingManager) ScriptingLocator.getManager(); |
|
132 |
synchronized (manager) { |
|
133 |
String respath = "/scripting/langs/python/preload.py"; |
|
134 |
InputStream res = this.getClass().getResourceAsStream(respath); |
|
135 |
if( res != null ) { |
|
136 |
LOGGER.info("Scan for script engines"); |
|
137 |
List<String> lines; |
|
138 |
try { |
|
139 |
lines = IOUtils.readLines(res); |
|
140 |
String code = StringUtils.join(lines, "\n"); |
|
141 |
LOGGER.info("Preload python script engine"); |
|
142 |
Script script = manager.createScript( |
|
143 |
"preload", |
|
144 |
code, |
|
145 |
ScriptingManager.PYTHON_LANGUAGE_NAME |
|
146 |
); |
|
147 |
LOGGER.info("Preload python modules"); |
|
148 |
script.invokeFunction("main", null); |
|
149 |
|
|
150 |
} catch (Exception ex) { |
|
151 |
LOGGER.warn("Can't run preload script for python.", ex); |
|
152 |
} |
|
153 |
LOGGER.info("Preload of script engines finished"); |
|
154 |
} |
|
155 |
} |
|
156 |
} |
|
157 |
|
|
158 |
|
|
159 |
@Override |
|
160 |
public void postInitialize() { |
|
161 |
super.postInitialize(); |
|
162 |
|
|
163 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
|
164 |
|
|
165 |
pluginManager.addStartupTask( |
|
166 |
"ExecuteAutorunScripts", |
|
167 |
utils.getAutorunScriptsOnStartup(pluginManager.getPluginsFolders()), |
|
168 |
false, |
|
169 |
200 |
|
170 |
); |
|
171 |
|
|
172 |
Invocable initializer = new ScriptsInstallerInitializer(); |
|
173 |
initializer.call(this.getPlugin().getPluginName()); |
|
174 |
} |
|
175 |
|
|
176 |
@Override |
|
177 |
public boolean isEnabled() { |
|
178 |
return true; |
|
179 |
} |
|
180 |
|
|
181 |
@Override |
|
182 |
public boolean isVisible() { |
|
183 |
return true; |
|
184 |
} |
|
185 |
|
|
186 |
public static void add_classpath(URL url) { |
|
187 |
if( url==null ) { |
|
188 |
LOGGER.warn("Can't add to the plugin classloader a null URL."); |
|
189 |
return; |
|
190 |
} |
|
191 |
try { |
|
192 |
PluginsManager manager = PluginsLocator.getManager(); |
|
193 |
PluginServices thePlugin = manager.getPlugin(ScriptingExtension.class); |
|
194 |
PluginClassLoader loader = thePlugin.getClassLoader(); |
|
195 |
loader.addURL(url); |
|
196 |
} catch(Throwable th) { |
|
197 |
LOGGER.warn("Can't add the url '"+url.toString()+"' to the plugin classloader.",th); |
|
198 |
} |
|
199 |
} |
|
200 |
|
|
201 |
public static void add_classpath(File path) { |
|
202 |
if( path==null ) { |
|
203 |
LOGGER.warn("Can't create a url from a null file."); |
|
204 |
return; |
|
205 |
} |
|
206 |
try { |
|
207 |
URL url = path.toURI().toURL(); |
|
208 |
add_classpath(url); |
|
209 |
} catch (MalformedURLException ex) { |
|
210 |
LOGGER.warn("Can't create a url from the path '"+path+"'.", ex); |
|
211 |
} |
|
212 |
} |
|
213 |
|
|
214 |
public static void add_classpath(String path) { |
|
215 |
if( path==null ) { |
|
216 |
LOGGER.warn("Can't create a url from a null path."); |
|
217 |
return; |
|
218 |
} |
|
219 |
File f = new File(path); |
|
220 |
add_classpath(f); |
|
221 |
} |
|
222 |
|
|
223 |
@Override |
|
224 |
public PluginServices getPlugin() { |
|
225 |
PluginServices thePlugin = super.getPlugin(); |
|
226 |
if (thePlugin == null) { |
|
227 |
thePlugin = PluginsLocator.getManager().getPlugin(ScriptingExtension.class); |
|
228 |
this.setPlugin(thePlugin); |
|
229 |
} |
|
230 |
return thePlugin; |
|
231 |
} |
|
232 |
|
|
233 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.77/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/ScriptingUtils.java | ||
---|---|---|
1 |
package org.gvsig.scripting.app.extension; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import java.io.File; |
|
6 |
import java.io.IOException; |
|
7 |
import java.nio.file.FileVisitOption; |
|
8 |
import static java.nio.file.FileVisitOption.FOLLOW_LINKS; |
|
9 |
import java.nio.file.FileVisitResult; |
|
10 |
import java.nio.file.Files; |
|
11 |
import java.nio.file.Path; |
|
12 |
import java.nio.file.Paths; |
|
13 |
import java.nio.file.SimpleFileVisitor; |
|
14 |
import java.nio.file.attribute.BasicFileAttributes; |
|
15 |
import java.text.MessageFormat; |
|
16 |
import java.util.ArrayList; |
|
17 |
import java.util.Arrays; |
|
18 |
import java.util.Collections; |
|
19 |
import java.util.Comparator; |
|
20 |
import java.util.EnumSet; |
|
21 |
import java.util.List; |
|
22 |
import java.util.function.Predicate; |
|
23 |
import javax.swing.JOptionPane; |
|
24 |
import javax.swing.SwingUtilities; |
|
25 |
import org.apache.commons.io.FileUtils; |
|
26 |
import org.apache.commons.io.FilenameUtils; |
|
27 |
import org.apache.commons.io.IOCase; |
|
28 |
import org.apache.commons.lang3.BooleanUtils; |
|
29 |
import org.gvsig.scripting.DataFolderFound; |
|
30 |
import org.gvsig.scripting.ScriptingBaseScript; |
|
31 |
import org.gvsig.scripting.ScriptingFolder; |
|
32 |
import org.gvsig.scripting.ScriptingLocator; |
|
33 |
import org.gvsig.scripting.ScriptingManager; |
|
34 |
import org.gvsig.scripting.ScriptingScript; |
|
35 |
import org.gvsig.scripting.ScriptingUnit; |
|
36 |
import org.gvsig.scripting.app.extension.messagewait.MessageWait; |
|
37 |
import org.gvsig.scripting.swing.api.JScriptingComposer; |
|
38 |
import org.gvsig.scripting.swing.api.ScriptingSwingLocator; |
|
39 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
40 |
import static org.gvsig.scripting.swing.api.ScriptingUIManager.SCRIPT_COMPOSER_AUTORUN; |
|
41 |
import org.gvsig.tools.ToolsLocator; |
|
42 |
import org.gvsig.tools.exception.BaseException; |
|
43 |
import org.gvsig.tools.i18n.I18nManager; |
|
44 |
import org.gvsig.tools.packageutils.PackageManager; |
|
45 |
import org.gvsig.tools.packageutils.Version; |
|
46 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
47 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
48 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
49 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
50 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
51 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
52 |
import org.gvsig.tools.visitor.VisitCanceledException; |
|
53 |
import org.gvsig.tools.visitor.Visitor; |
|
54 |
import org.slf4j.Logger; |
|
55 |
import org.slf4j.LoggerFactory; |
|
56 |
import org.gvsig.tools.util.FolderSet; |
|
57 |
import org.gvsig.tools.util.impl.DefaultFolderSet; |
|
58 |
/** |
|
59 |
* |
|
60 |
* @author jjdelcerro |
|
61 |
*/ |
|
62 |
@SuppressWarnings("UseSpecificCatch") |
|
63 |
public class ScriptingUtils { |
|
64 |
|
|
65 |
public static final String SKIP_AUTORUNS = "skipAutoruns"; |
|
66 |
|
|
67 |
private static final Logger LOGGER = LoggerFactory.getLogger(ScriptingExtension.class); |
|
68 |
|
|
69 |
private boolean executingAutorunScripts = false; |
|
70 |
private static boolean composer_initialized = false; |
|
71 |
private final MessageWait message; |
|
72 |
|
|
73 |
/* |
|
74 |
* la funcion log y las constantes estan pensadas para usarlas desde los scripts. |
|
75 |
*/ |
|
76 |
public static final int INFO = 0; |
|
77 |
public static final int TRACE = 1; |
|
78 |
public static final int WARN = 2; |
|
79 |
public static final int ERROR = 3; |
|
80 |
|
|
81 |
public static void log(String message) { |
|
82 |
log(INFO, message, null); |
|
83 |
} |
|
84 |
|
|
85 |
public static void log(int level, String message) { |
|
86 |
log(level, message, null); |
|
87 |
} |
|
88 |
|
|
89 |
public static void log(int level, String message, Throwable th) { |
|
90 |
switch( level ) { |
|
91 |
case TRACE: |
|
92 |
LOGGER.trace(message, th); |
|
93 |
break; |
|
94 |
case ERROR: |
|
95 |
LOGGER.error(message, th); |
|
96 |
break; |
|
97 |
case WARN: |
|
98 |
LOGGER.warn(message, th); |
|
99 |
break; |
|
100 |
default: |
|
101 |
case INFO: |
|
102 |
LOGGER.info(message, th); |
|
103 |
break; |
|
104 |
} |
|
105 |
} |
|
106 |
private String appversion; |
|
107 |
private File pluginHomeFolder; |
|
108 |
|
|
109 |
public ScriptingUtils() { |
|
110 |
message = new MessageWait(); |
|
111 |
} |
|
112 |
|
|
113 |
public static File getScriptsHomeFolder(File pluginHomeFolder, String appversion) { |
|
114 |
File scriptsHomeFolder; |
|
115 |
File f = FileUtils.getFile(pluginHomeFolder, "scripts-folder.txt"); |
|
116 |
if( f.exists() ) { |
|
117 |
try { |
|
118 |
List<String> lines = FileUtils.readLines(f); |
|
119 |
for( String line : lines ) { |
|
120 |
line = line.trim(); |
|
121 |
if( !line.startsWith("#") ) { |
|
122 |
scriptsHomeFolder = new File(line); |
|
123 |
if( !scriptsHomeFolder.isAbsolute() ) { |
|
124 |
scriptsHomeFolder = new File(pluginHomeFolder, line); |
|
125 |
} |
|
126 |
scriptsHomeFolder = new File( |
|
127 |
FilenameUtils.normalizeNoEndSeparator( |
|
128 |
scriptsHomeFolder.getAbsolutePath(), |
|
129 |
true |
|
130 |
) |
|
131 |
); |
|
132 |
if( scriptsHomeFolder.exists() ) { |
|
133 |
return scriptsHomeFolder; |
|
134 |
} |
|
135 |
} |
|
136 |
} |
|
137 |
} catch (IOException ex) { |
|
138 |
} |
|
139 |
} else { |
|
140 |
try { |
|
141 |
FileUtils.touch(f); |
|
142 |
} catch (IOException ex) { |
|
143 |
} |
|
144 |
} |
|
145 |
scriptsHomeFolder = FileUtils.getFile(pluginHomeFolder, appversion) ; |
|
146 |
return scriptsHomeFolder; |
|
147 |
} |
|
148 |
|
|
149 |
public void initializaPaths(List<File> pluginsFolder, File installFolder, File pluginHoneFolder, String appversion) { |
|
150 |
|
|
151 |
this.appversion = appversion; |
|
152 |
this.pluginHomeFolder = pluginHoneFolder; |
|
153 |
ScriptingManager manager = ScriptingLocator.getManager(); |
|
154 |
manager.setHomeFolder(getScriptsHomeFolder(pluginHoneFolder, appversion)); |
|
155 |
|
|
156 |
ScriptingFolder folder = manager.createLink( |
|
157 |
"Common", |
|
158 |
manager.getUserFolder(), |
|
159 |
"../../scripts" |
|
160 |
); |
|
161 |
folder.setProperty(ScriptingUtils.SKIP_AUTORUNS, BooleanUtils.toStringTrueFalse(true)); |
|
162 |
folder.save(); |
|
163 |
// manager.createLink( |
|
164 |
// "Previous version", |
|
165 |
// manager.getUserFolder(), |
|
166 |
// "../../../org.gvsig.scripting.app.extension/scripts" |
|
167 |
// ); |
|
168 |
|
|
169 |
List<File> pluginsFolders = new ArrayList<>(); |
|
170 |
for( File f : pluginsFolder ) { |
|
171 |
pluginsFolders.addAll(Arrays.asList(f.listFiles())); |
|
172 |
} |
|
173 |
|
|
174 |
for( File pluginFolder : pluginsFolders ) { |
|
175 |
File scriptsFolder = new File(pluginFolder, "scripting/scripts"); |
|
176 |
if( scriptsFolder.exists() ) { |
|
177 |
manager.registerSystemFolder(pluginFolder.getName(), scriptsFolder); |
|
178 |
} |
|
179 |
File libFolder = new File(pluginFolder, "scripting/lib"); |
|
180 |
if( libFolder.exists() ) { |
|
181 |
manager.addLibFolder(libFolder); |
|
182 |
} |
|
183 |
} |
|
184 |
manager.setPackagesFolder(installFolder); |
|
185 |
|
|
186 |
File localAddonRepositoryFolder = new File(manager.getRootUserFolder(), "addons"); |
|
187 |
if( !localAddonRepositoryFolder.exists() ) { |
|
188 |
try { |
|
189 |
FileUtils.forceMkdir(localAddonRepositoryFolder); |
|
190 |
} catch (IOException ex) { |
|
191 |
LOGGER.info("Can't create addons folder in '" + localAddonRepositoryFolder.getAbsolutePath() + "'.", ex); |
|
192 |
} |
|
193 |
} |
|
194 |
File initAddonFile = new File(localAddonRepositoryFolder, "__init__.py"); |
|
195 |
if( !initAddonFile.exists() ) { |
|
196 |
try { |
|
197 |
FileUtils.touch(initAddonFile); |
|
198 |
} catch (IOException ex) { |
|
199 |
LOGGER.info("Can't create addons __init__ file in '" + localAddonRepositoryFolder.getAbsolutePath() + "'.", ex); |
|
200 |
} |
|
201 |
} |
|
202 |
} |
|
203 |
|
|
204 |
|
|
205 |
public void runScript(String name, Object[] args) { |
|
206 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
207 |
WindowManager winmanager = ToolsSwingLocator.getWindowManager(); |
|
208 |
|
|
209 |
ScriptingBaseScript script = uimanager.getManager().getScript(name); |
|
210 |
if( script != null ) { |
|
211 |
script.run(args); |
|
212 |
} else { |
|
213 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
214 |
dialogs.messageDialog( |
|
215 |
"Can't locate script '" + name + "'.", |
|
216 |
"ScriptLaunch", |
|
217 |
JOptionPane.OK_OPTION |
|
218 |
); |
|
219 |
} |
|
220 |
} |
|
221 |
|
|
222 |
public void runLauncher() { |
|
223 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
224 |
WindowManager winmanager = ToolsSwingLocator.getWindowManager(); |
|
225 |
winmanager.showWindow(uimanager.createLauncher().asJComponent(), uimanager.getTranslation("Scripting_Launcher"), WindowManager.MODE.TOOL); |
|
226 |
} |
|
227 |
|
|
228 |
public void runComposer() { |
|
229 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
230 |
message.showMessage( |
|
231 |
i18n.getTranslation("_notice"), |
|
232 |
i18n.getTranslation("_Initializing_the_scripting_plugin_Xhorizontal_ellipsisX") + "\n" |
|
233 |
+ i18n.getTranslation("_Waiting_to_terminate"), |
|
234 |
new MessageWait.WaitingCondition() { |
|
235 |
private Thread th = null; |
|
236 |
|
|
237 |
@Override |
|
238 |
public boolean stopWaiting() { |
|
239 |
if (executingAutorunScripts) { |
|
240 |
return false; |
|
241 |
} |
|
242 |
if (composer_initialized) { |
|
243 |
return true; |
|
244 |
} |
|
245 |
if (th == null) { |
|
246 |
th = new Thread(new ExecuteScriptsFromScriptingFolders(null, "scautorun", SCRIPT_COMPOSER_AUTORUN), "StartupScriptingComposer"); |
|
247 |
th.start(); |
|
248 |
} |
|
249 |
return false; |
|
250 |
} |
|
251 |
}, |
|
252 |
new Runnable() { |
|
253 |
@Override |
|
254 |
public void run() { |
|
255 |
showScriptingComposer(); |
|
256 |
} |
|
257 |
} |
|
258 |
); |
|
259 |
|
|
260 |
} |
|
261 |
|
|
262 |
public Runnable getAutorunScriptsOnStartup(List<File> pluginsFolders) { |
|
263 |
return new ExecuteAutorunScriptsOnStartup(pluginsFolders); |
|
264 |
} |
|
265 |
|
|
266 |
private void showScriptingComposer() { |
|
267 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
268 |
JScriptingComposer composer = uimanager.createComposer(); |
|
269 |
uimanager.showWindow( |
|
270 |
composer.asJComponent(), |
|
271 |
uimanager.getTranslation("Scripting_Composer") |
|
272 |
); |
|
273 |
} |
|
274 |
|
|
275 |
private class ExecuteScriptsFromScriptingFolders extends AbstractExecuteScripts { |
|
276 |
|
|
277 |
public ExecuteScriptsFromScriptingFolders(List<File> pluginsFolders, String title, String patternName) { |
|
278 |
super(pluginsFolders, title, patternName); |
|
279 |
} |
|
280 |
|
|
281 |
@Override |
|
282 |
public void run() { |
|
283 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
284 |
SimpleTaskStatus status = ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus("Scripts startup"); |
|
285 |
status.setIndeterminate(); |
|
286 |
status.setAutoremove(true); |
|
287 |
status.add(); |
|
288 |
final I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
289 |
try { |
|
290 |
LOGGER.info("Searching "+title+" scripts..."); |
|
291 |
dialogs.message( |
|
292 |
i18nManager.getTranslation("_Searching_autorun_scripts_Xhorizontal_ellipsisX"), |
|
293 |
JOptionPane.INFORMATION_MESSAGE |
|
294 |
); |
|
295 |
ScriptingManager manager = ScriptingLocator.getManager(); |
|
296 |
final List<ScriptingScript> scripts = new ArrayList<>(); |
|
297 |
|
|
298 |
Visitor visitor = new Visitor() { |
|
299 |
@Override |
|
300 |
public void visit(Object o) throws VisitCanceledException, BaseException { |
|
301 |
ScriptingUnit unit = (ScriptingUnit) o; |
|
302 |
if( unit instanceof ScriptingScript && |
|
303 |
FilenameUtils.wildcardMatch(unit.getName(), patternName, IOCase.INSENSITIVE) ) { |
|
304 |
ScriptingScript script = (ScriptingScript) unit; |
|
305 |
if( script.isEnabled() ) { |
|
306 |
scripts.add(script); |
|
307 |
} else { |
|
308 |
LOGGER.info("Skip "+title+" script '" + script.getFile().getAbsolutePath() + "'."); |
|
309 |
} |
|
310 |
} |
|
311 |
} |
|
312 |
}; |
|
313 |
Predicate<ScriptingUnit> includeFilter = new Predicate<ScriptingUnit>() { |
|
314 |
@Override |
|
315 |
public boolean test(ScriptingUnit unit) { |
|
316 |
if( unit instanceof ScriptingFolder ) { |
|
317 |
return !BooleanUtils.toBoolean(unit.getProperty(SKIP_AUTORUNS)); |
|
318 |
} |
|
319 |
return false; |
|
320 |
} |
|
321 |
}; |
|
322 |
manager.getSystemFolder().accept(visitor, includeFilter); |
|
323 |
manager.getUserFolder().accept(visitor, includeFilter); |
|
324 |
sortScripts(scripts); |
|
325 |
executeScripts(scripts, status); |
|
326 |
} catch(Throwable th) { |
|
327 |
|
|
328 |
} finally { |
|
329 |
composer_initialized = true; |
|
330 |
LOGGER.info("Running "+title+" scripts terminated."); |
|
331 |
dialogs.message("", JOptionPane.INFORMATION_MESSAGE); |
|
332 |
status.terminate(); |
|
333 |
} |
|
334 |
} |
|
335 |
} |
|
336 |
|
|
337 |
public class ExecuteAutorunScriptsOnStartup implements Runnable { |
|
338 |
|
|
339 |
private final List<File> pluginsFolders; |
|
340 |
|
|
341 |
public ExecuteAutorunScriptsOnStartup(List<File> pluginsFolders) { |
|
342 |
this.pluginsFolders = pluginsFolders; |
|
343 |
} |
|
344 |
|
|
345 |
@Override |
|
346 |
public void run() { |
|
347 |
Runnable process = new ExecuteScriptsFromFilesystem( |
|
348 |
this.pluginsFolders, |
|
349 |
"autorun", |
|
350 |
"autorun.inf" |
|
351 |
); |
|
352 |
process.run(); |
|
353 |
} |
|
354 |
} |
|
355 |
|
|
356 |
private abstract class AbstractExecuteScripts implements Runnable { |
|
357 |
|
|
358 |
protected String patternName; |
|
359 |
protected String title; |
|
360 |
private final List<File> pluginsFolders; |
|
361 |
|
|
362 |
public AbstractExecuteScripts(List<File> pluginsFolders, String title, String patternName) { |
|
363 |
if( pluginsFolders==null ) { |
|
364 |
this.pluginsFolders = Collections.EMPTY_LIST; |
|
365 |
} else { |
|
366 |
this.pluginsFolders = pluginsFolders; |
|
367 |
} |
|
368 |
this.patternName = patternName; |
|
369 |
this.title = title; |
|
370 |
} |
|
371 |
|
|
372 |
protected List<File> getPluginsFolders() { |
|
373 |
return this.pluginsFolders; |
|
374 |
} |
|
375 |
|
|
376 |
private String getScriptOrderKey(ScriptingBaseScript o) { |
|
377 |
int groupOrder = 500; |
|
378 |
String groupName = "default"; |
|
379 |
int scriptOrder = 500; |
|
380 |
String s = o.getProperty("autorun.group.order"); |
|
381 |
if (s != null) { |
|
382 |
try { |
|
383 |
groupOrder = Integer.parseInt(s); |
|
384 |
} catch (Exception ex) { |
|
385 |
// Do nothing. |
|
386 |
} |
|
387 |
} |
|
388 |
s = o.getProperty("autorun.group.name"); |
|
389 |
if (s != null) { |
|
390 |
groupName = s; |
|
391 |
} |
|
392 |
s = o.getProperty("autorun.order"); |
|
393 |
if (s != null) { |
|
394 |
try { |
|
395 |
scriptOrder = Integer.parseInt(s); |
|
396 |
} catch (Exception ex) { |
|
397 |
// Do nothing. |
|
398 |
} |
|
399 |
} |
|
400 |
String key = MessageFormat.format( |
|
401 |
"{0,number,000000}.{1}.{2,number,000000}", |
|
402 |
groupOrder, |
|
403 |
groupName, |
|
404 |
scriptOrder |
|
405 |
); |
|
406 |
return key; |
|
407 |
} |
|
408 |
|
|
409 |
protected void sortScripts(List<ScriptingScript> scripts) { |
|
410 |
Collections.sort(scripts, new Comparator<ScriptingBaseScript>() { |
|
411 |
|
|
412 |
@Override |
|
413 |
public int compare(ScriptingBaseScript o1, ScriptingBaseScript o2) { |
|
414 |
return getScriptOrderKey(o2).compareToIgnoreCase(getScriptOrderKey(o1)); |
|
415 |
} |
|
416 |
}); |
|
417 |
} |
|
418 |
|
|
419 |
protected void executeScripts(List<ScriptingScript> scripts, SimpleTaskStatus status) { |
|
420 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
421 |
final I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
422 |
if (scripts != null && !scripts.isEmpty()) { |
|
423 |
if (status != null) { |
|
424 |
status.setRangeOfValues(0, scripts.size()); |
|
425 |
} |
|
426 |
int n = 0; |
|
427 |
for (ScriptingBaseScript script : scripts) { |
|
428 |
if (status != null) { |
|
429 |
status.setCurValue(n++); |
|
430 |
} |
|
431 |
try { |
|
432 |
LOGGER.info("running " + title + " script '" + script.getFile().getAbsolutePath() + "' (" + getScriptOrderKey(script) + ", " + script.getIsolationGroup() + ")."); |
|
433 |
dialogs.message( |
|
434 |
i18nManager.getTranslation( |
|
435 |
"_Running_autorun_script_from_XnameX", |
|
436 |
new String[]{ |
|
437 |
script.getFile().getParentFile().getName()} |
|
438 |
), |
|
439 |
JOptionPane.INFORMATION_MESSAGE |
|
440 |
); |
|
441 |
} catch (Exception ex) { |
|
442 |
// Ignore it |
|
443 |
} |
|
444 |
try { |
|
445 |
// Hacemos un reload por si un sript deshabilito a otro. |
|
446 |
script.reload(); |
|
447 |
if( script.isEnabled() ) { |
|
448 |
script.run(); |
|
449 |
} else { |
|
450 |
LOGGER.info("Skip " + title + " script '" + script.getFile().getAbsolutePath() + "' (" + getScriptOrderKey(script) + ", " + script.getIsolationGroup() + ")."); |
|
451 |
} |
|
452 |
} catch (Exception ex) { |
|
453 |
LOGGER.warn("Can't execute " + title + " from '" + script.getFile().getAbsolutePath() + "'.", ex); |
|
454 |
} |
|
455 |
} |
|
456 |
} |
|
457 |
|
|
458 |
} |
|
459 |
} |
|
460 |
|
|
461 |
private class ExecuteScriptsFromFilesystem extends AbstractExecuteScripts { |
|
462 |
|
|
463 |
public ExecuteScriptsFromFilesystem(List<File> pluginsFolder, String title, String patternName) { |
|
464 |
super(pluginsFolder, title, patternName); |
|
465 |
} |
|
466 |
|
|
467 |
@Override |
|
468 |
public void run() { |
|
469 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
470 |
executingAutorunScripts = true; |
|
471 |
try { |
|
472 |
final ScriptingManager manager = ScriptingLocator.getManager(); |
|
473 |
manager.loadEngines(); |
|
474 |
|
|
475 |
// final PluginsManager pluginManager = PluginsLocator.getManager(); |
|
476 |
final I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
477 |
|
|
478 |
final List<ScriptingScript> scripts = new ArrayList<>(); |
|
479 |
|
|
480 |
List<File> pluginsFolders = new ArrayList<>(); |
|
481 |
for (File pluginsFolders2 : this.getPluginsFolders()) { |
|
482 |
for (File pluginFolder : pluginsFolders2.listFiles()) { |
|
483 |
File f = FileUtils.getFile(pluginFolder, "scripting", "scripts"); |
|
484 |
if (f.exists()) { |
|
485 |
pluginsFolders.add(f); |
|
486 |
} |
|
487 |
} |
|
488 |
} |
|
489 |
|
|
490 |
dialogs.message( |
|
491 |
i18nManager.getTranslation("_Searching_autorun_scripts_Xhorizontal_ellipsisX"), |
|
492 |
JOptionPane.INFORMATION_MESSAGE |
|
493 |
); |
|
494 |
|
|
495 |
SimpleFileVisitor<Path> visitor = new SimpleFileVisitor<Path>() { |
|
496 |
@Override |
|
497 |
public FileVisitResult visitFile(Path path, BasicFileAttributes bfa) throws IOException { |
|
498 |
File file = path.toFile(); |
|
499 |
if (FilenameUtils.wildcardMatch(file.getName(), patternName, IOCase.INSENSITIVE)) { |
|
500 |
if (file.exists()) { |
|
501 |
ScriptingScript script = (ScriptingScript) manager.getScript(file); |
|
502 |
if (script.isEnabled()) { |
|
503 |
scripts.add(script); |
|
504 |
} else { |
|
505 |
LOGGER.info("Skip " + title + " script '" + file.getAbsolutePath() + "'."); |
|
506 |
} |
|
507 |
} |
|
508 |
} |
|
509 |
return FileVisitResult.CONTINUE; |
|
510 |
} |
|
511 |
}; |
|
512 |
try { |
|
513 |
EnumSet<FileVisitOption> opts = EnumSet.of(FOLLOW_LINKS); |
|
514 |
for (File pluginFolder : pluginsFolders) { |
|
515 |
Files.walkFileTree(Paths.get(pluginFolder.toURI()), opts, Integer.MAX_VALUE, visitor); |
|
516 |
} |
|
517 |
Files.walkFileTree(Paths.get(manager.getRootUserFolder().toURI()), opts, Integer.MAX_VALUE, visitor); |
|
518 |
List<ScriptingFolder> folders = manager.getAlternativeUserFolders(); |
|
519 |
for (ScriptingFolder folder : folders) { |
|
520 |
Files.walkFileTree(Paths.get(folder.getFile().toURI()), opts, Integer.MAX_VALUE, visitor); |
|
521 |
} |
|
522 |
} catch (Exception ex) { |
|
523 |
LOGGER.warn("Can't execute " + title + " in home.", ex); |
|
524 |
} |
|
525 |
sortScripts(scripts); |
|
526 |
executeScripts(scripts, null); |
|
527 |
|
|
528 |
} finally { |
|
529 |
LOGGER.info("Running " + title + " scripts terminated."); |
|
530 |
dialogs.message("", JOptionPane.INFORMATION_MESSAGE); |
|
531 |
executingAutorunScripts = false; |
|
532 |
} |
|
533 |
checkDataFoldersVersions(); |
|
534 |
} |
|
535 |
|
|
536 |
} |
|
537 |
|
|
538 |
private void checkDataFoldersVersions() { |
|
539 |
final ScriptingManager manager = ScriptingLocator.getManager(); |
|
540 |
PackageManager versionFactory = ToolsLocator.getPackageManager(); |
|
541 |
Version currentVersion = versionFactory.createVersion(this.appversion); |
|
542 |
FolderSet folders = new DefaultFolderSet(); |
|
543 |
folders.add(this.pluginHomeFolder); |
|
544 |
final List<DataFolderFound> dataFoldersFound = manager.searchOldVersions(currentVersion, folders); |
|
545 |
if( dataFoldersFound == null || dataFoldersFound.isEmpty() ) { |
|
546 |
return; |
|
547 |
} |
|
548 |
Runnable askUser = new Runnable() { |
|
549 |
@Override |
|
550 |
public void run() { |
|
551 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
552 |
final DataFoldersRecoverPanel panel = new DataFoldersRecoverPanel(dataFoldersFound); |
|
553 |
final Dialog dialog = winManager.createDialog( |
|
554 |
panel, |
|
555 |
"Recuperacion de preferencias", |
|
556 |
null, |
|
557 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
558 |
); |
|
559 |
dialog.addActionListener(new ActionListener() { |
|
560 |
@Override |
|
561 |
public void actionPerformed(ActionEvent e) { |
|
562 |
if (dialog.getAction() == WindowManager_v2.BUTTON_OK) { |
|
563 |
List<DataFolderFound> toRestore = panel.getSelectedDataFolders(); |
|
564 |
for (DataFolderFound dataFolderFound : dataFoldersFound) { |
|
565 |
if (toRestore.contains(dataFolderFound)) { |
|
566 |
dataFolderFound.restore(); |
|
567 |
} else { |
|
568 |
dataFolderFound.leave(); |
|
569 |
} |
|
570 |
} |
|
571 |
} |
|
572 |
} |
|
573 |
}); |
|
574 |
dialog.show(WindowManager.MODE.WINDOW); |
|
575 |
} |
|
576 |
}; |
|
577 |
if( SwingUtilities.isEventDispatchThread() ) { |
|
578 |
askUser.run(); |
|
579 |
} else { |
|
580 |
SwingUtilities.invokeLater(askUser); |
|
581 |
} |
|
582 |
} |
|
583 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.77/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/ScriptingMain.java | ||
---|---|---|
1 |
package org.gvsig.scripting.app.extension; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import java.util.ArrayList; |
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.List; |
|
8 |
import java.util.Map; |
|
9 |
import javax.swing.UIManager; |
|
10 |
import org.apache.commons.cli.CommandLine; |
|
11 |
import org.apache.commons.cli.CommandLineParser; |
|
12 |
import org.apache.commons.cli.Options; |
|
13 |
import org.apache.commons.cli.PosixParser; |
|
14 |
import org.apache.commons.io.FileUtils; |
|
15 |
import org.gvsig.about.AboutLocator; |
|
16 |
import org.gvsig.about.AboutManager; |
|
17 |
import org.gvsig.scripting.ScriptingManager; |
|
18 |
import org.gvsig.scripting.swing.api.ScriptingSwingLocator; |
|
19 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
20 |
import org.gvsig.tools.ToolsLocator; |
|
21 |
import org.gvsig.tools.exception.BaseException; |
|
22 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
23 |
import org.gvsig.tools.packageutils.PackageInfo; |
|
24 |
import org.gvsig.tools.packageutils.PackageManager; |
|
25 |
import org.gvsig.tools.packageutils.Version; |
|
26 |
|
|
27 |
/** |
|
28 |
* |
|
29 |
* @author jjdelcerro |
|
30 |
*/ |
|
31 |
public class ScriptingMain { |
|
32 |
|
|
33 |
private File applicationFolder = null; |
|
34 |
private Version applicacionVersion = null; |
|
35 |
private List<File> pluginsFolder = null; |
|
36 |
private File applicationHomeFolder; |
|
37 |
private File installFolder; |
|
38 |
private int applicacionBuildNumber; |
|
39 |
|
|
40 |
private ScriptingUtils utils; |
|
41 |
|
|
42 |
public static void main(String args[]) throws Exception { |
|
43 |
ScriptingMain main = new ScriptingMain(); |
|
44 |
main.doMain(args); |
|
45 |
} |
|
46 |
|
|
47 |
public File getApplicationFolder() { |
|
48 |
if (applicationFolder == null) { |
|
49 |
applicationFolder = new File(System.getProperty("user.dir")); |
|
50 |
} |
|
51 |
return applicationFolder; |
|
52 |
} |
|
53 |
|
|
54 |
public File getApplicationHomeFolder() { |
|
55 |
if (applicationHomeFolder == null) { |
|
56 |
applicationHomeFolder = new File(System.getProperty("user.home")); |
|
57 |
} |
|
58 |
return applicationHomeFolder; |
|
59 |
} |
|
60 |
|
|
61 |
public File getInstallFolder() { |
|
62 |
if (installFolder == null) { |
|
63 |
installFolder = FileUtils.getFile(getApplicationFolder(), "install"); |
|
64 |
} |
|
65 |
return this.installFolder; |
|
66 |
} |
|
67 |
|
|
68 |
public Version getApplicationVersion() throws BaseException { |
|
69 |
if (applicacionVersion == null) { |
|
70 |
PackageManager packageManager = ToolsLocator.getPackageManager(); |
|
71 |
PackageInfo packageInfo = packageManager.createPackageInfo( |
|
72 |
new File(this.applicationFolder, "package.info") |
|
73 |
); |
|
74 |
applicacionVersion = (Version) packageInfo.getVersion(); |
|
75 |
} |
|
76 |
return applicacionVersion; |
|
77 |
} |
|
78 |
|
|
79 |
public int getApplicationBuildNumber() throws BaseException { |
|
80 |
if (applicacionBuildNumber == 0) { |
|
81 |
applicacionBuildNumber = getApplicationVersion().getBuild(); |
|
82 |
} |
|
83 |
return this.applicacionBuildNumber; |
|
84 |
} |
|
85 |
|
|
86 |
public List<File> getPluginsFolder() { |
|
87 |
List<File> folders = new ArrayList<>(); |
|
88 |
folders.add(FileUtils.getFile(this.getApplicationFolder(), "gvSIG", "extensiones")); |
|
89 |
folders.add(FileUtils.getFile(this.getApplicationHomeFolder(), "gvSIG", "installation", "gvSIG", "extensiones")); |
|
90 |
return folders; |
|
91 |
} |
|
92 |
|
|
93 |
public File getPluginHomeFolder() { |
|
94 |
File f = this.getApplicationHomeFolder(); |
|
95 |
f = FileUtils.getFile(f, "gvSIG", "plugins", "org.gvsig.scripting.app.mainplugin"); |
|
96 |
return f; |
|
97 |
} |
|
98 |
|
|
99 |
private void initializeAbout() throws Exception { |
|
100 |
AboutManager aboutManager = AboutLocator.getManager(); |
|
101 |
|
|
102 |
String build = String.valueOf(this.getApplicationBuildNumber()); |
|
103 |
String version = this.getApplicationVersion().toString(); |
|
104 |
|
|
105 |
Map<String, String> gvsig_vars = new HashMap<>(); |
|
106 |
gvsig_vars.put("version", version); |
|
107 |
gvsig_vars.put("build", build); |
|
108 |
aboutManager.setProject( |
|
109 |
"gvSIG Desktop", |
|
110 |
getResource("gvsig.html"), |
|
111 |
null, |
|
112 |
gvsig_vars); |
|
113 |
aboutManager.getProject().set("build", build); |
|
114 |
|
|
115 |
aboutManager.addSponsor( |
|
116 |
"Generalitat Valenciana", |
|
117 |
getResource("gva.html"), |
|
118 |
1); |
|
119 |
|
|
120 |
aboutManager.addDeveloper( |
|
121 |
"gvSIG Asocicion", |
|
122 |
getResource("gvSIG-asociacion.html"), |
|
123 |
2); |
|
124 |
|
|
125 |
} |
|
126 |
|
|
127 |
public void doMain(String args[]) throws Exception { |
|
128 |
|
|
129 |
String lookAndFeel = "com.jgoodies.looks.plastic.PlasticXPLookAndFeel"; |
|
130 |
try { |
|
131 |
UIManager.setLookAndFeel(lookAndFeel); |
|
132 |
} catch(Throwable th) { |
|
133 |
|
|
134 |
} |
|
135 |
|
|
136 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
137 |
|
|
138 |
initializeAbout(); |
|
139 |
|
|
140 |
this.utils = new ScriptingUtils(); |
|
141 |
this.utils.initializaPaths( |
|
142 |
this.getPluginsFolder(), |
|
143 |
this.getInstallFolder(), |
|
144 |
this.getPluginHomeFolder(), |
|
145 |
this.getApplicationVersion().format("%M.%m.%r") |
|
146 |
); |
|
147 |
|
|
148 |
ScriptingUIManager uimanager = ScriptingSwingLocator.getUIManager(); |
|
149 |
ScriptingManager manager = uimanager.getManager(); |
|
150 |
|
|
151 |
Options options = new Options(); |
|
152 |
options.addOption("d", |
|
153 |
"debug", |
|
154 |
false, |
|
155 |
""); |
|
156 |
options.addOption("p", |
|
157 |
"pause", |
|
158 |
false, |
|
159 |
""); |
|
160 |
options.addOption("l", |
|
161 |
"launcher", |
|
162 |
false, |
|
163 |
"Show the launcher window"); |
|
164 |
options.addOption("c", |
|
165 |
"composer", |
|
166 |
false, |
|
167 |
"Show the composer window"); |
|
168 |
options.addOption("r", |
|
169 |
"run", |
|
170 |
true, |
|
171 |
"Run the specified script"); |
|
172 |
options.addOption("h", |
|
173 |
"home", |
|
174 |
true, |
|
175 |
"Specify for the home of the script framework"); |
|
176 |
CommandLineParser parser = new PosixParser(); |
|
177 |
CommandLine line = null; |
|
178 |
boolean runLauncherAtEnd = true; |
|
179 |
|
|
180 |
line = parser.parse(options, args); |
|
181 |
if (line.hasOption("home")) { |
|
182 |
manager.setHomeFolder(new File(line.getOptionValue("home"))); |
|
183 |
} |
|
184 |
if (line.hasOption("composer")) { |
|
185 |
runLauncherAtEnd = false; |
|
186 |
utils.runComposer(); |
|
187 |
} |
|
188 |
if (line.hasOption("run")) { |
|
189 |
runLauncherAtEnd = false; |
|
190 |
utils.runScript(line.getOptionValue("run"), line.getArgs()); |
|
191 |
} |
|
192 |
if( runLauncherAtEnd ) { |
|
193 |
utils.runLauncher(); |
|
194 |
} |
|
195 |
} |
|
196 |
|
|
197 |
private URL getResource(String name) { |
|
198 |
URL resource = this.getClass().getResource(name); |
|
199 |
return resource; |
|
200 |
} |
|
201 |
|
|
202 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.77/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/DataFoldersRecoverPanelView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">/home/jjdelcerro/datos/devel/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/java/org/gvsig/scripting/app/extension/DataFoldersRecoverPanelView.xml</at> |
|
28 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at> |
|
29 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE</at> |
|
30 |
<at name="components"> |
|
31 |
<object classname="java.util.LinkedList"> |
|
32 |
<item > |
|
33 |
<at name="value"> |
|
34 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
35 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
36 |
<at name="cellconstraints"> |
|
37 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
38 |
<at name="column">2</at> |
|
39 |
<at name="row">2</at> |
|
40 |
<at name="colspan">1</at> |
|
41 |
<at name="rowspan">1</at> |
|
42 |
<at name="halign">default</at> |
|
43 |
<at name="valign">default</at> |
|
44 |
<at name="insets" object="insets">0,0,0,0</at> |
|
45 |
</object> |
|
46 |
</at> |
|
47 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
48 |
</super> |
|
49 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
50 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
51 |
<at name="beanproperties"> |
|
52 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
53 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
54 |
<at name="properties"> |
|
55 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
56 |
<at name="border"> |
|
57 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
58 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
59 |
<at name="name">border</at> |
|
60 |
</super> |
|
61 |
<at name="borders"> |
|
62 |
<object classname="java.util.LinkedList"> |
|
63 |
<item > |
|
64 |
<at name="value"> |
|
65 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
66 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
67 |
<at name="name">border</at> |
|
68 |
</super> |
|
69 |
</object> |
|
70 |
</at> |
|
71 |
</item> |
|
72 |
</object> |
|
73 |
</at> |
|
74 |
</object> |
|
75 |
</at> |
|
76 |
<at name="name">lblMsg1</at> |
|
77 |
<at name="width">583</at> |
|
78 |
<at name="text"><html>Han sido encontradas preferencias de versiones anteriores para algunos complementos.</html></at> |
|
79 |
<at name="fill"> |
|
80 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
81 |
<at name="name">fill</at> |
|
82 |
</object> |
|
83 |
</at> |
|
84 |
<at name="height">14</at> |
|
85 |
</object> |
|
86 |
</at> |
|
87 |
</object> |
|
88 |
</at> |
|
89 |
</object> |
|
90 |
</at> |
|
91 |
</item> |
|
92 |
<item > |
|
93 |
<at name="value"> |
|
94 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
95 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
96 |
<at name="cellconstraints"> |
|
97 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
98 |
<at name="column">2</at> |
|
99 |
<at name="row">4</at> |
|
100 |
<at name="colspan">1</at> |
|
101 |
<at name="rowspan">1</at> |
|
102 |
<at name="halign">default</at> |
|
103 |
<at name="valign">default</at> |
|
104 |
<at name="insets" object="insets">0,0,0,0</at> |
|
105 |
</object> |
|
106 |
</at> |
|
107 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
108 |
</super> |
|
109 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
110 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
111 |
<at name="beanproperties"> |
|
112 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
113 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
114 |
<at name="properties"> |
|
115 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
116 |
<at name="border"> |
|
117 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
118 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
119 |
<at name="name">border</at> |
|
120 |
</super> |
|
121 |
<at name="borders"> |
|
122 |
<object classname="java.util.LinkedList"> |
|
123 |
<item > |
|
124 |
<at name="value"> |
|
125 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
126 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
127 |
<at name="name">border</at> |
|
128 |
</super> |
|
129 |
</object> |
|
130 |
</at> |
|
131 |
</item> |
|
132 |
</object> |
|
133 |
</at> |
|
134 |
</object> |
|
135 |
</at> |
|
136 |
<at name="name">lblMsg2</at> |
|
137 |
<at name="width">583</at> |
|
138 |
<at name="text"><html>Seleccione los complementos para los que desea recuperar las preferencias de versiones anteriores</html></at> |
|
139 |
<at name="fill"> |
|
140 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
141 |
<at name="name">fill</at> |
|
142 |
</object> |
|
143 |
</at> |
|
144 |
<at name="height">14</at> |
|
145 |
</object> |
|
146 |
</at> |
|
147 |
</object> |
|
148 |
</at> |
|
149 |
</object> |
|
150 |
</at> |
|
151 |
</item> |
|
152 |
<item > |
|
153 |
<at name="value"> |
|
154 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
155 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
156 |
<at name="cellconstraints"> |
|
157 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
158 |
<at name="column">2</at> |
|
159 |
<at name="row">6</at> |
|
160 |
<at name="colspan">1</at> |
|
161 |
<at name="rowspan">1</at> |
|
162 |
<at name="halign">default</at> |
|
163 |
<at name="valign">default</at> |
|
164 |
<at name="insets" object="insets">0,0,0,0</at> |
|
165 |
</object> |
|
166 |
</at> |
|
167 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
168 |
</super> |
|
169 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
170 |
<at name="beanclass">javax.swing.JList</at> |
|
171 |
<at name="beanproperties"> |
|
172 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
173 |
<at name="classname">javax.swing.JList</at> |
|
174 |
<at name="properties"> |
|
175 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
176 |
<at name="border"> |
|
177 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
178 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
179 |
<at name="name">border</at> |
|
180 |
</super> |
|
181 |
<at name="borders"> |
|
182 |
<object classname="java.util.LinkedList"> |
|
183 |
<item > |
|
184 |
<at name="value"> |
|
185 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
186 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
187 |
<at name="name">border</at> |
|
188 |
</super> |
|
189 |
</object> |
|
190 |
</at> |
|
191 |
</item> |
|
192 |
</object> |
|
193 |
</at> |
|
194 |
</object> |
|
195 |
</at> |
|
196 |
<at name="scrollableTracksViewportHeight">true</at> |
|
197 |
<at name="scrollableTracksViewportWidth">true</at> |
|
198 |
<at name="name">lstDataFolders</at> |
|
199 |
<at name="width">581</at> |
|
200 |
<at name="items"> |
|
201 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
202 |
<at name="name">items</at> |
|
203 |
</object> |
Also available in: Unified diff