Revision 53

View differences:

trunk/org.gvsig.scripting/org.gvsig.scripting.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingManager.java
12 12
import java.util.Map;
13 13

  
14 14
import javax.script.ScriptEngine;
15
import javax.script.ScriptEngineFactory;
16 15
import javax.script.ScriptEngineManager;
17 16
import javax.swing.ImageIcon;
18 17

  
......
33 32
	
34 33
	public DefaultScriptingManager(){
35 34
		this.rootUserFolder = System.getProperty("user.home") + File.separator + "scripts";
36
		this.icons = new HashMap();
37
		
38
		ClassLoader loader = this.getClass().getClassLoader();
39
		this.icons.put("scripting_python", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/python.gif")));
40
		this.icons.put("scripting_folder", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/folder.gif")));
41
		this.icons.put("scripting_folder_open", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/expandedfolder.gif")));
42
		this.icons.put("scripting_javascript", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/javascript.gif")));
43
		this.icons.put("scripting_groovy", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/javascript.gif")));
44
		this.icons.put("scripting_beanshell", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/javascript.gif")));
45
		this.icons.put("scripting_project", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/folder.gif")));
46
		this.icons.put("scripting_project_open", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/expandedfolder.gif")));
47
		this.icons.put("scripting_dialog", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/python.gif")));
48
		this.icons.put("scripting_userFolder", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/user.jpg")));
49
		this.icons.put("scripting_systemFolder", new ImageIcon(loader.getResource("org/gvsig/scripting/impl/images/computer.gif")));
50
		
51 35
	}
52 36
	
53 37
	protected ScriptEngineManager getEngineManager(){
trunk/org.gvsig.scripting/org.gvsig.scripting.impl/src/main/java/org/gvsig/scripting/impl/AbstractUnit.java
17 17
	protected String id;
18 18
	protected String name = null;
19 19
	protected String description;
20
	protected String createdBy;
21
	protected String version;
20 22
	protected ScriptingFolder parent;	
21 23
	
22 24
	public AbstractUnit(ScriptingManager manager){
......
47 49
		return this.description;
48 50
	}
49 51

  
52
	public String getCreatedBy() {
53
		return this.createdBy;
54
	}
55
	
56
	public String getVersion() {
57
		return this.version;
58
	}
59
	
50 60
	/* (non-Javadoc)
51 61
	 * @see org.gvsig.scripting.impl.Unit#getId()
52 62
	 */
......
71 81
		this.description = description;		
72 82
	}
73 83

  
84
	public void setCreatedBy(String createdBy) {
85
		this.createdBy = createdBy;	
86
	}
87
	
88
	public void setVersion(String version) {
89
		this.version = version;	
90
	}
91
	
74 92
	/* (non-Javadoc)
75 93
	 * @see org.gvsig.scripting.impl.Unit#setId(java.lang.String)
76 94
	 */
......
162 180
		}else {
163 181
			prefs.put("Unit", "description",this.getDescription());
164 182
		}
183
		
184
		if (this.getCreatedBy() == null){
185
			prefs.put("Unit", "createdBy","");
186
		}else {
187
			prefs.put("Unit", "createdBy",this.getCreatedBy());
188
		}
165 189
	
190
		if (this.getVersion() == null){
191
			prefs.put("Unit", "version","");
192
		}else {
193
			prefs.put("Unit", "version",this.getVersion());
194
		}
195
		
166 196
		try {
167 197
			prefs.store();
168 198
		} catch (IOException e) {
......
180 210
			description = null;
181 211
		}
182 212
		this.setDescription(description);
213
		
214
		String createdBy = (String) getInfValue(prefs,"Unit","createdBy", null);
215
		if (createdBy != null && createdBy.length() == 0){
216
			createdBy = null;
217
		}
218
		this.setCreatedBy(createdBy);
219
		
220
		String version = (String) getInfValue(prefs,"Unit","version", null);
221
		if (version != null && version.length() == 0){
222
			version = null;
223
		}
224
		this.setVersion(version);
183 225

  
184 226
	}
185 227
	
trunk/org.gvsig.scripting/org.gvsig.scripting.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingScript.java
32 32
	protected Invocable engine = null;
33 33
	public String code = null;
34 34
	public String mainName = "main";
35
	public boolean saved;
35 36
	
36 37
	/* Para la captura de excepciones de ejecución*/
37 38
	protected ActionListener syntaxActionlistener = null;
......
57 58
	public DefaultScriptingScript(ScriptingManager manager) {
58 59
		super(manager);
59 60
		this.setLangName("python");
61
		this.setSaved(true);
60 62
	}
61 63

  
64
	public void setSaved(boolean saved) {
65
		this.saved = saved;
66
	}
62 67
	public static String getStringFromFile(String filename) throws FileNotFoundException,IOException {
63 68

  
64 69
		BufferedReader b=new BufferedReader(new FileReader(filename));
......
203 208
		}catch (Exception e){
204 209
			System.err.println("Error: " + e.getMessage());
205 210
		}
211
		this.setSaved(true);
206 212
	}
207 213

  
208 214
	
......
274 280
		this.run(null);
275 281
		
276 282
	}
283
	public boolean isSaved() {
284
		return this.saved;
285
	}
277 286

  
278 287

  
279 288
}
trunk/org.gvsig.scripting/org.gvsig.scripting.impl/src/main/java/org/gvsig/scripting/impl/Unit.java
8 8
	public abstract void load(ScriptingFolder folder, String id);
9 9

  
10 10
	public abstract String getDescription();
11
	
12
	public abstract String getCreatedBy();
13
	
14
	public abstract String getVersion();
11 15

  
12 16
	public abstract String getId();
13 17

  
14 18
	public abstract String getName();
15 19

  
16 20
	public abstract void setDescription(String description);
21
	
22
	public abstract void setCreatedBy(String createdBy);
23
	
24
	public abstract void setVersion(String version);
17 25

  
18 26
	public abstract void setId(String id);
19 27

  

Also available in: Unified diff