root / trunk / extensions / extScripting / src / org / gvsig / scripting / ScriptingAppAccesor.java @ 5892
History | View | Annotate | Download (2.5 KB)
1 |
package org.gvsig.scripting; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.util.Hashtable; |
5 |
import java.util.Map; |
6 |
|
7 |
import com.iver.andami.PluginServices; |
8 |
|
9 |
public class ScriptingAppAccesor { |
10 |
private static String scriptsDirectory = null; |
11 |
|
12 |
public Object getActiveDocument() { |
13 |
return PluginServices.getMDIManager().getActiveView();
|
14 |
} |
15 |
|
16 |
public String getScriptsDirectory() { |
17 |
if (scriptsDirectory == null) { |
18 |
File file = new File(PluginServices.getPluginServices("org.gvsig.scripting").getClassLoader().getBaseDir(),"scripts"); |
19 |
scriptsDirectory = file.getAbsolutePath(); |
20 |
} |
21 |
return scriptsDirectory;
|
22 |
} |
23 |
|
24 |
|
25 |
public String translate(String str) { |
26 |
return PluginServices.getText(this,str); |
27 |
} |
28 |
|
29 |
public Object show(Map params) { |
30 |
return ScriptingExtension.show(params);
|
31 |
|
32 |
} |
33 |
|
34 |
public Object show(String fileName,String language) { |
35 |
Hashtable params = new Hashtable(); |
36 |
params.put("fileName",fileName);
|
37 |
params.put("language",language);
|
38 |
return ScriptingExtension.show(params);
|
39 |
} |
40 |
|
41 |
public Object show(String fileName,String language,Map aParams) { |
42 |
Hashtable params = new Hashtable(); |
43 |
params.putAll(aParams); |
44 |
params.put("fileName",fileName);
|
45 |
params.put("language",language);
|
46 |
return ScriptingExtension.show(params);
|
47 |
} |
48 |
|
49 |
public Object show(String fileName,String language,int width, int height) { |
50 |
Hashtable params = new Hashtable(); |
51 |
params.put("fileName",fileName);
|
52 |
params.put("language",language);
|
53 |
params.put("width",new Integer(width)); |
54 |
params.put("height",new Integer(height)); |
55 |
return ScriptingExtension.show(params);
|
56 |
} |
57 |
|
58 |
public Object show(String fileName,String language,int width, int height, Map aParams) { |
59 |
Hashtable params = new Hashtable(); |
60 |
params.putAll(aParams); |
61 |
params.put("fileName",fileName);
|
62 |
params.put("language",language);
|
63 |
params.put("width",new Integer(width)); |
64 |
params.put("height",new Integer(height)); |
65 |
return ScriptingExtension.show(params);
|
66 |
} |
67 |
|
68 |
public void run(Map params) { |
69 |
ScriptingExtension.run(params); |
70 |
} |
71 |
|
72 |
public void run(String fileName, String language) { |
73 |
Hashtable params = new Hashtable(); |
74 |
params.put("fileName",fileName);
|
75 |
params.put("language",language);
|
76 |
ScriptingExtension.run(params); |
77 |
} |
78 |
|
79 |
public void run(String fileName, String language,Map aParams) { |
80 |
Hashtable params = new Hashtable(); |
81 |
params.putAll(aParams); |
82 |
params.put("fileName",fileName);
|
83 |
params.put("language",language);
|
84 |
ScriptingExtension.run(params); |
85 |
} |
86 |
|
87 |
public Class classForName(String className) throws ClassNotFoundException { |
88 |
return Class.forName(className); |
89 |
} |
90 |
} |