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