root / tags / v1_0_2_Build_899 / extensions / extScripting / src / org / gvsig / scripting / ScriptingAppAccesor.java @ 10517
History | View | Annotate | Download (4.07 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 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
9 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
10 |
|
11 |
public class ScriptingAppAccesor { |
12 |
private static String scriptsDirectory = null; |
13 |
private static ExtensionPoints extensionPoints = |
14 |
ExtensionPointsSingleton.getInstance(); |
15 |
|
16 |
public ExtensionPoints getExtensionPoints() {
|
17 |
return extensionPoints;
|
18 |
} |
19 |
|
20 |
public Object getActiveDocument() { |
21 |
return PluginServices.getMDIManager().getActiveWindow();
|
22 |
} |
23 |
|
24 |
public String getScriptsDirectory() { |
25 |
if (scriptsDirectory == null) { |
26 |
File file = new File(PluginServices.getPluginServices("org.gvsig.scripting").getClassLoader().getBaseDir(),"scripts"); |
27 |
scriptsDirectory = file.getAbsolutePath(); |
28 |
} |
29 |
return scriptsDirectory;
|
30 |
} |
31 |
|
32 |
|
33 |
public String translate(String str) { |
34 |
return PluginServices.getText(this,str); |
35 |
} |
36 |
|
37 |
public Object show(Map params) { |
38 |
return ScriptingExtension.show(params);
|
39 |
|
40 |
} |
41 |
|
42 |
public Object show(String fileName,String language) { |
43 |
Hashtable params = new Hashtable(); |
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, String title) { |
50 |
Hashtable params = new Hashtable(); |
51 |
params.put("fileName",fileName);
|
52 |
params.put("language",language);
|
53 |
params.put("title",title);
|
54 |
return ScriptingExtension.show(params);
|
55 |
} |
56 |
|
57 |
|
58 |
public Object show(String fileName,String language,Map aParams) { |
59 |
Hashtable params = new Hashtable(); |
60 |
params.putAll(aParams); |
61 |
params.put("fileName",fileName);
|
62 |
params.put("language",language);
|
63 |
return ScriptingExtension.show(params);
|
64 |
} |
65 |
|
66 |
public Object show(String fileName,String language, String title, Map aParams) { |
67 |
Hashtable params = new Hashtable(); |
68 |
params.putAll(aParams); |
69 |
params.put("fileName",fileName);
|
70 |
params.put("language",language);
|
71 |
params.put("title",title);
|
72 |
return ScriptingExtension.show(params);
|
73 |
} |
74 |
|
75 |
public Object show(String fileName,String language,int width, int height) { |
76 |
Hashtable params = new Hashtable(); |
77 |
params.put("fileName",fileName);
|
78 |
params.put("language",language);
|
79 |
params.put("width",new Integer(width)); |
80 |
params.put("height",new Integer(height)); |
81 |
return ScriptingExtension.show(params);
|
82 |
} |
83 |
|
84 |
public Object show(String fileName,String language, String title, int width, int height) { |
85 |
Hashtable params = new Hashtable(); |
86 |
params.put("fileName",fileName);
|
87 |
params.put("language",language);
|
88 |
params.put("width",new Integer(width)); |
89 |
params.put("height",new Integer(height)); |
90 |
params.put("title",title);
|
91 |
return ScriptingExtension.show(params);
|
92 |
} |
93 |
|
94 |
|
95 |
public Object show(String fileName,String language,int width, int height, Map aParams) { |
96 |
Hashtable params = new Hashtable(); |
97 |
params.putAll(aParams); |
98 |
params.put("fileName",fileName);
|
99 |
params.put("language",language);
|
100 |
params.put("width",new Integer(width)); |
101 |
params.put("height",new Integer(height)); |
102 |
return ScriptingExtension.show(params);
|
103 |
} |
104 |
|
105 |
public Object show(String fileName,String language, String title, int width, int height, Map aParams) { |
106 |
Hashtable params = new Hashtable(); |
107 |
params.putAll(aParams); |
108 |
params.put("fileName",fileName);
|
109 |
params.put("language",language);
|
110 |
params.put("width",new Integer(width)); |
111 |
params.put("height",new Integer(height)); |
112 |
params.put("title",title);
|
113 |
return ScriptingExtension.show(params);
|
114 |
} |
115 |
|
116 |
|
117 |
public void run(Map params) { |
118 |
ScriptingExtension.run(params); |
119 |
} |
120 |
|
121 |
public void run(String fileName, String language) { |
122 |
Hashtable params = new Hashtable(); |
123 |
params.put("fileName",fileName);
|
124 |
params.put("language",language);
|
125 |
ScriptingExtension.run(params); |
126 |
} |
127 |
|
128 |
public void run(String fileName, String language,Map aParams) { |
129 |
Hashtable params = new Hashtable(); |
130 |
params.putAll(aParams); |
131 |
params.put("fileName",fileName);
|
132 |
params.put("language",language);
|
133 |
ScriptingExtension.run(params); |
134 |
} |
135 |
|
136 |
public Class classForName(String className) throws ClassNotFoundException { |
137 |
return Class.forName(className); |
138 |
} |
139 |
} |