root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / imp / DefaultAppgvSIGManager.java @ 38781
History | View | Annotate | Download (14.7 KB)
1 | 26919 | jmvivo | /* 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 | |||
23 | /*
|
||
24 | * AUTHORS (In addition to CIT):
|
||
25 | * 2009 IVER T.I {{Task}}
|
||
26 | */
|
||
27 | |||
28 | /**
|
||
29 | *
|
||
30 | */
|
||
31 | 29598 | jpiera | package org.gvsig.app.imp; |
32 | 26919 | jmvivo | |
33 | 38634 | jjdelcerro | import java.awt.Component; |
34 | 26919 | jmvivo | import java.util.ArrayList; |
35 | import java.util.Iterator; |
||
36 | import java.util.List; |
||
37 | |||
38 | 31496 | jjdelcerro | import org.cresques.cts.IProjection; |
39 | 34002 | jjdelcerro | import org.gvsig.about.AboutLocator; |
40 | import org.gvsig.about.AboutManager; |
||
41 | 35974 | jjdelcerro | import org.gvsig.andami.Launcher; |
42 | 31496 | jjdelcerro | import org.gvsig.andami.PluginServices; |
43 | 38634 | jjdelcerro | import org.gvsig.andami.ui.mdiFrame.MainFrame; |
44 | 35153 | jjdelcerro | import org.gvsig.andami.ui.mdiManager.IWindow; |
45 | 31496 | jjdelcerro | import org.gvsig.andami.ui.mdiManager.MDIManager; |
46 | import org.gvsig.app.ApplicationManager; |
||
47 | import org.gvsig.app.PreferencesNode; |
||
48 | import org.gvsig.app.extension.Version; |
||
49 | 29598 | jpiera | import org.gvsig.app.gui.WizardPanel; |
50 | 31496 | jjdelcerro | import org.gvsig.app.prepareAction.PrepareContext; |
51 | import org.gvsig.app.prepareAction.PrepareContextView; |
||
52 | import org.gvsig.app.prepareAction.PrepareDataStore; |
||
53 | import org.gvsig.app.prepareAction.PrepareDataStoreParameters; |
||
54 | import org.gvsig.app.prepareAction.PrepareLayer; |
||
55 | import org.gvsig.app.project.DefaultProject; |
||
56 | import org.gvsig.app.project.Project; |
||
57 | import org.gvsig.app.project.ProjectManager; |
||
58 | 35191 | jjdelcerro | import org.gvsig.app.project.documents.Document; |
59 | import org.gvsig.app.project.documents.gui.IDocumentWindow; |
||
60 | 31496 | jjdelcerro | import org.gvsig.fmap.crs.CRSFactory; |
61 | import org.gvsig.fmap.dal.DALLocator; |
||
62 | import org.gvsig.fmap.dal.DataManager; |
||
63 | 26919 | jmvivo | import org.gvsig.fmap.dal.DataStore; |
64 | import org.gvsig.fmap.dal.DataStoreParameters; |
||
65 | 31496 | jjdelcerro | import org.gvsig.fmap.geom.GeometryLocator; |
66 | import org.gvsig.fmap.geom.GeometryManager; |
||
67 | import org.gvsig.fmap.mapcontext.MapContextLocator; |
||
68 | import org.gvsig.fmap.mapcontext.MapContextManager; |
||
69 | 26932 | jmvivo | import org.gvsig.fmap.mapcontext.layers.FLayer; |
70 | 38371 | nbrodin | import org.gvsig.gui.ColorTablesFactory; |
71 | 35974 | jjdelcerro | import org.gvsig.symbology.swing.SymbologySwingLocator; |
72 | 29197 | jmvivo | import org.gvsig.tools.ToolsLocator; |
73 | 36476 | jjdelcerro | import org.gvsig.tools.dataTypes.DataTypesManager; |
74 | 31496 | jjdelcerro | import org.gvsig.tools.dispose.DisposableManager; |
75 | import org.gvsig.tools.dynobject.DynObjectManager; |
||
76 | 29197 | jmvivo | import org.gvsig.tools.extensionpoint.ExtensionPoint; |
77 | 34441 | cordinyana | import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension; |
78 | 29197 | jmvivo | import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
79 | 31496 | jjdelcerro | import org.gvsig.tools.persistence.PersistenceManager; |
80 | 38564 | jjdelcerro | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
81 | import org.gvsig.tools.swing.icontheme.IconThemeManager; |
||
82 | import org.slf4j.Logger; |
||
83 | import org.slf4j.LoggerFactory; |
||
84 | 26919 | jmvivo | |
85 | |||
86 | |||
87 | 29197 | jmvivo | |
88 | 26919 | jmvivo | /**
|
89 | * @author jmvivo
|
||
90 | *
|
||
91 | */
|
||
92 | 31496 | jjdelcerro | public class DefaultAppgvSIGManager implements ApplicationManager { |
93 | 26919 | jmvivo | |
94 | 38634 | jjdelcerro | @SuppressWarnings("unused") |
95 | private static Logger logger = LoggerFactory.getLogger(DefaultAppgvSIGManager.class); |
||
96 | |||
97 | 31496 | jjdelcerro | private static final String EPNAME_PREPARE_OPEN_DATASTORE = "org.gvsig.datastore.open.prepare"; //"PrepareOpenDataStore"; |
98 | private static final String EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS = "org.gvsig.datastoreparameters.open.prepare"; //"PrepareOpenDataStoreParameters"; |
||
99 | private static final String EPNAME_PREPARE_OPEN_LAYER = "org.gvsig.layer.open.prepare"; // "PrepareOpenLayer"; |
||
100 | 26919 | jmvivo | |
101 | 29197 | jmvivo | private static final String EPNAME_ADD_TABLE_WIZARD = "AddLayerWizard"; |
102 | |||
103 | private ExtensionPointManager epManager;
|
||
104 | |||
105 | 34441 | cordinyana | private Version version;
|
106 | 29197 | jmvivo | |
107 | 31496 | jjdelcerro | public DefaultAppgvSIGManager() {
|
108 | 29197 | jmvivo | epManager = ToolsLocator.getExtensionPointManager(); |
109 | epManager.add(EPNAME_PREPARE_OPEN_DATASTORE, |
||
110 | "Actions to do when open a DataStore");
|
||
111 | epManager.add(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS, |
||
112 | "Actions to do before open a DataStore with parameters");
|
||
113 | epManager.add(EPNAME_PREPARE_OPEN_LAYER, |
||
114 | "Actions to do after create a Layer");
|
||
115 | epManager.add(EPNAME_ADD_TABLE_WIZARD, |
||
116 | "Wizards to add new document table");
|
||
117 | |||
118 | 34441 | cordinyana | version = new Version();
|
119 | 26919 | jmvivo | } |
120 | |||
121 | /* (non-Javadoc)
|
||
122 | * @see org.gvsig.appGvSigManager#pepareOpenDataSource(org.gvsig.fmap.dal.DataStore)
|
||
123 | */
|
||
124 | 31496 | jjdelcerro | @SuppressWarnings("unchecked") |
125 | 26919 | jmvivo | public DataStore pepareOpenDataSource(DataStore store,
|
126 | 29197 | jmvivo | PrepareContext context) throws Exception { |
127 | ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_DATASTORE); |
||
128 | if (ep.getCount() == 0) { |
||
129 | 26919 | jmvivo | return store;
|
130 | } |
||
131 | DataStore result = store; |
||
132 | 29197 | jmvivo | Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
133 | PrepareDataStore prepare; |
||
134 | 26919 | jmvivo | while (iter.hasNext()) {
|
135 | 29197 | jmvivo | prepare = (PrepareDataStore) iter.next().create(); |
136 | result = prepare.prepare(store, context); |
||
137 | 26919 | jmvivo | } |
138 | return result;
|
||
139 | } |
||
140 | |||
141 | /* (non-Javadoc)
|
||
142 | * @see org.gvsig.appGvSigManager#prepareOpenDataStoreParameters(org.gvsig.fmap.dal.DataStoreParameters)
|
||
143 | */
|
||
144 | 31496 | jjdelcerro | @SuppressWarnings("unchecked") |
145 | 26919 | jmvivo | public DataStoreParameters prepareOpenDataStoreParameters(
|
146 | 29197 | jmvivo | DataStoreParameters storeParameters, PrepareContext context) |
147 | throws Exception { |
||
148 | |||
149 | ExtensionPoint ep = epManager |
||
150 | .get(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS); |
||
151 | if (ep.getCount() == 0) { |
||
152 | 26919 | jmvivo | return storeParameters;
|
153 | } |
||
154 | DataStoreParameters result = storeParameters; |
||
155 | 29197 | jmvivo | Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
156 | PrepareDataStoreParameters prepare; |
||
157 | 26919 | jmvivo | while (iter.hasNext()) {
|
158 | 29197 | jmvivo | prepare = (PrepareDataStoreParameters) iter.next().create(); |
159 | result = prepare.prepare(storeParameters, context); |
||
160 | 26919 | jmvivo | } |
161 | 29197 | jmvivo | |
162 | 26919 | jmvivo | return result;
|
163 | } |
||
164 | 36767 | nbrodin | |
165 | /*
|
||
166 | * (non-Javadoc)
|
||
167 | * @see org.gvsig.app.ApplicationManager#prepareOpenDataStoreParameters(java.util.List, org.gvsig.app.prepareAction.PrepareContext)
|
||
168 | */
|
||
169 | @SuppressWarnings("unchecked") |
||
170 | public List<DataStoreParameters> prepareOpenDataStoreParameters( |
||
171 | List<DataStoreParameters> storeParameters, PrepareContext context)
|
||
172 | throws Exception { |
||
173 | 26919 | jmvivo | |
174 | 36767 | nbrodin | ExtensionPoint ep = epManager |
175 | .get(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS); |
||
176 | if (ep.getCount() == 0) { |
||
177 | return storeParameters;
|
||
178 | } |
||
179 | |||
180 | List<DataStoreParameters> result = new ArrayList<DataStoreParameters>(); |
||
181 | |||
182 | Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
||
183 | List<PrepareDataStoreParameters> prepareList = new ArrayList<PrepareDataStoreParameters>(); |
||
184 | while (iter.hasNext()) {
|
||
185 | prepareList.add((PrepareDataStoreParameters) iter.next().create()); |
||
186 | } |
||
187 | |||
188 | for (int i = 0; i < storeParameters.size(); i++) { |
||
189 | DataStoreParameters param = storeParameters.get(i); |
||
190 | for (int j = 0; j < prepareList.size(); j++) { |
||
191 | prepareList.get(j).pre(param, context); |
||
192 | } |
||
193 | } |
||
194 | |||
195 | for (int i = 0; i < storeParameters.size(); i++) { |
||
196 | DataStoreParameters param = storeParameters.get(i); |
||
197 | if(param != null) { |
||
198 | for (int j = 0; j < prepareList.size(); j++) { |
||
199 | param = prepareList.get(j).prepare(param, context); |
||
200 | if(param == null) |
||
201 | break;
|
||
202 | } |
||
203 | if(param != null) |
||
204 | result.add(param); |
||
205 | } |
||
206 | } |
||
207 | |||
208 | for (int i = 0; i < storeParameters.size(); i++) { |
||
209 | DataStoreParameters param = storeParameters.get(i); |
||
210 | for (int j = 0; j < prepareList.size(); j++) { |
||
211 | prepareList.get(j).post(param, context); |
||
212 | } |
||
213 | } |
||
214 | |||
215 | return result;
|
||
216 | } |
||
217 | |||
218 | 26919 | jmvivo | public void registerPrepareOpenDataStore(PrepareDataStore action) { |
219 | 29197 | jmvivo | ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_DATASTORE); |
220 | ep.append(action.getName(), action.getDescription(), action); |
||
221 | 26919 | jmvivo | } |
222 | |||
223 | public void registerPrepareOpenDataStoreParameters( |
||
224 | PrepareDataStoreParameters action) { |
||
225 | 29197 | jmvivo | ExtensionPoint ep = epManager |
226 | .get(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS); |
||
227 | ep.append(action.getName(), action.getDescription(), action); |
||
228 | 26919 | jmvivo | |
229 | 29197 | jmvivo | |
230 | 26919 | jmvivo | } |
231 | |||
232 | 31496 | jjdelcerro | @SuppressWarnings("unchecked") |
233 | 26932 | jmvivo | public FLayer prepareOpenLayer(FLayer layer,
|
234 | 29197 | jmvivo | PrepareContextView context) |
235 | throws Exception { |
||
236 | |||
237 | ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_LAYER); |
||
238 | |||
239 | if (ep.getCount() == 0) { |
||
240 | 26932 | jmvivo | return layer;
|
241 | } |
||
242 | FLayer result = layer; |
||
243 | 29197 | jmvivo | Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
244 | PrepareLayer prepare; |
||
245 | 26932 | jmvivo | while (iter.hasNext()) {
|
246 | 29197 | jmvivo | prepare = (PrepareLayer) iter.next().create(); |
247 | 38537 | nbrodin | result = prepare.prepare(result, context); |
248 | 26932 | jmvivo | } |
249 | 29197 | jmvivo | |
250 | 26932 | jmvivo | return result;
|
251 | |||
252 | } |
||
253 | |||
254 | public void registerPrepareOpenLayer(PrepareLayer action) { |
||
255 | 29197 | jmvivo | ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_LAYER); |
256 | ep.append(action.getName(), action.getDescription(), action); |
||
257 | 26932 | jmvivo | } |
258 | |||
259 | 29197 | jmvivo | public void registerAddTableWizard(String name, String description, |
260 | Class<? extends WizardPanel> wpClass) { |
||
261 | ExtensionPoint ep = epManager.get(EPNAME_ADD_TABLE_WIZARD); |
||
262 | ep.append(name, description, wpClass); |
||
263 | } |
||
264 | |||
265 | 31496 | jjdelcerro | @SuppressWarnings("unchecked") |
266 | 29197 | jmvivo | public List<WizardPanel> getWizardPanels() throws Exception { |
267 | ExtensionPoint ep = epManager.get(EPNAME_ADD_TABLE_WIZARD); |
||
268 | List<WizardPanel> result = new ArrayList<WizardPanel>(); |
||
269 | Iterator<Extension> iter = ep.iterator();
|
||
270 | while (iter.hasNext()) {
|
||
271 | result.add((WizardPanel) iter.next().create()); |
||
272 | } |
||
273 | return result;
|
||
274 | } |
||
275 | 31496 | jjdelcerro | |
276 | public DataManager getDataManager() {
|
||
277 | return DALLocator.getDataManager();
|
||
278 | } |
||
279 | |||
280 | public GeometryManager getGeometryManager() {
|
||
281 | return GeometryLocator.getGeometryManager();
|
||
282 | } |
||
283 | |||
284 | public PersistenceManager getPersistenceManager() {
|
||
285 | return ToolsLocator.getPersistenceManager();
|
||
286 | } |
||
287 | |||
288 | public DisposableManager getDisposableManager() {
|
||
289 | return ToolsLocator.getDisposableManager();
|
||
290 | } |
||
291 | |||
292 | public DynObjectManager getDynObjectManager() {
|
||
293 | return ToolsLocator.getDynObjectManager();
|
||
294 | } |
||
295 | |||
296 | public ExtensionPointManager getExtensionPointManager() {
|
||
297 | return ToolsLocator.getExtensionPointManager();
|
||
298 | } |
||
299 | |||
300 | public ProjectManager getProjectManager() {
|
||
301 | return ProjectManager.getInstance();
|
||
302 | } |
||
303 | |||
304 | public MDIManager getUIManager() {
|
||
305 | return PluginServices.getMDIManager();
|
||
306 | } |
||
307 | |||
308 | public MapContextManager getMapContextManager() {
|
||
309 | return MapContextLocator.getMapContextManager();
|
||
310 | } |
||
311 | |||
312 | 36476 | jjdelcerro | public DataTypesManager getDataTypesManager() {
|
313 | return ToolsLocator.getDataTypesManager();
|
||
314 | } |
||
315 | |||
316 | 31496 | jjdelcerro | public IProjection getCRS(String code) { |
317 | return CRSFactory.getCRS(code);
|
||
318 | } |
||
319 | |||
320 | public IconThemeManager getIconThemeManager() {
|
||
321 | 38564 | jjdelcerro | return ToolsSwingLocator.getIconThemeManager();
|
322 | 31496 | jjdelcerro | } |
323 | |||
324 | public String getArgument(String name) { |
||
325 | return PluginServices.getArgumentByName(name);
|
||
326 | } |
||
327 | |||
328 | public String[] getArguments() { |
||
329 | return PluginServices.getArguments();
|
||
330 | } |
||
331 | |||
332 | public String getFromClipboard() { |
||
333 | return PluginServices.getFromClipboard();
|
||
334 | } |
||
335 | |||
336 | public void putInClipboard(String data) { |
||
337 | PluginServices.putInClipboard(data); |
||
338 | } |
||
339 | |||
340 | public Project getCurrentProject() {
|
||
341 | return ProjectManager.getInstance().getCurrentProject();
|
||
342 | } |
||
343 | |||
344 | public PreferencesNode getPreferences(String node) { |
||
345 | if( node.equalsIgnoreCase("project")) { |
||
346 | return DefaultProject.getPreferences();
|
||
347 | } |
||
348 | return new DefaultPreferencesNode(node); |
||
349 | } |
||
350 | |||
351 | public PreferencesNode getPreferences() {
|
||
352 | return new DefaultPreferencesNode(); |
||
353 | } |
||
354 | |||
355 | public Version getVersion() {
|
||
356 | 34441 | cordinyana | return version;
|
357 | 31496 | jjdelcerro | } |
358 | |||
359 | 34002 | jjdelcerro | public AboutManager getAbout() {
|
360 | AboutManager manager = AboutLocator.getManager(); |
||
361 | return manager;
|
||
362 | } |
||
363 | 34300 | fdiaz | |
364 | 38371 | nbrodin | public ColorTablesFactory getColorTablesFactory() {
|
365 | 35974 | jjdelcerro | return SymbologySwingLocator.getSwingManager().getColorTablesFactory();
|
366 | 34300 | fdiaz | } |
367 | |||
368 | 38371 | nbrodin | public void registerColorTablesFactory(ColorTablesFactory factory) { |
369 | 35974 | jjdelcerro | SymbologySwingLocator.getSwingManager().setColorTablesFactory(factory); |
370 | 34300 | fdiaz | |
371 | } |
||
372 | 35153 | jjdelcerro | |
373 | public IWindow getActiveWindow() {
|
||
374 | try {
|
||
375 | 35191 | jjdelcerro | IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
376 | 35153 | jjdelcerro | return window;
|
377 | } catch (Exception ex) { |
||
378 | return null; |
||
379 | } |
||
380 | } |
||
381 | 35191 | jjdelcerro | |
382 | public Document getActiveDocument() { |
||
383 | Project project = this.getCurrentProject();
|
||
384 | if( project == null ) { |
||
385 | return null; |
||
386 | } |
||
387 | return project.getActiveDocument();
|
||
388 | } |
||
389 | 35153 | jjdelcerro | |
390 | 35191 | jjdelcerro | public Document getActiveDocument(String documentTypeName) { |
391 | Document document = this.getActiveDocument(); |
||
392 | 36007 | fdiaz | if( document!= null && document.getTypeName().equalsIgnoreCase(documentTypeName) ) { |
393 | 35191 | jjdelcerro | return document;
|
394 | } |
||
395 | return null; |
||
396 | } |
||
397 | |||
398 | 36443 | cordinyana | public Document getActiveDocument(Class<? extends Document> documentClass) { |
399 | 35191 | jjdelcerro | Document document = this.getActiveDocument(); |
400 | if( documentClass.isInstance(document) ) {
|
||
401 | return document;
|
||
402 | } |
||
403 | return null; |
||
404 | } |
||
405 | |||
406 | public IDocumentWindow getDocumentWindow(Document document) { |
||
407 | 36443 | cordinyana | Class<? extends IDocumentWindow> defaultDocumentClass = |
408 | document.getFactory().getMainWindowClass(); |
||
409 | 35191 | jjdelcerro | return (IDocumentWindow) this.getUIManager().getSingletonWindow(defaultDocumentClass, document); |
410 | } |
||
411 | 35974 | jjdelcerro | |
412 | public String getLocaleLanguage() { |
||
413 | return Launcher.getAndamiConfig().getLocaleLanguage();
|
||
414 | } |
||
415 | |||
416 | 38242 | jldominguez | public void message(String message, int message_type) { |
417 | 38634 | jjdelcerro | MainFrame main = PluginServices.getMainFrame(); |
418 | main.message(message, message_type); |
||
419 | 38242 | jldominguez | } |
420 | 38634 | jjdelcerro | |
421 | public void messageDialog(String message, String title, int messageType) { |
||
422 | MainFrame main = PluginServices.getMainFrame(); |
||
423 | main.messageDialog(message, title, messageType); |
||
424 | } |
||
425 | |||
426 | public void messageDialog(String message, String[] messageArgs, |
||
427 | String title, int messageType) { |
||
428 | MainFrame main = PluginServices.getMainFrame(); |
||
429 | main.messageDialog(message, messageArgs, title, messageType); |
||
430 | } |
||
431 | |||
432 | public int confirmDialog(String message, String title, int optionType, |
||
433 | int messageType) {
|
||
434 | MainFrame main = PluginServices.getMainFrame(); |
||
435 | return main.confirmDialog(message, title, optionType, messageType);
|
||
436 | } |
||
437 | |||
438 | public String inputDialog(String message, String title, int messageType, |
||
439 | String initialValue) {
|
||
440 | MainFrame main = PluginServices.getMainFrame(); |
||
441 | return main.inputDialog(message, title, messageType, initialValue);
|
||
442 | } |
||
443 | |||
444 | public String inputDialog(String message, String title) { |
||
445 | MainFrame main = PluginServices.getMainFrame(); |
||
446 | return main.inputDialog(message, title);
|
||
447 | } |
||
448 | |||
449 | public void showDialog(Component contents, String title) { |
||
450 | MainFrame main = PluginServices.getMainFrame(); |
||
451 | main.showDialog(contents, title); |
||
452 | } |
||
453 | |||
454 | public Component createComponent(Class<? extends Component> theClass, |
||
455 | Object... parameters) {
|
||
456 | MainFrame main = PluginServices.getMainFrame(); |
||
457 | return main.createComponentWithParams(theClass, parameters);
|
||
458 | } |
||
459 | |||
460 | public Component createComponentWithParams( |
||
461 | Class<? extends Component> theClass, Object[] parameters) { |
||
462 | MainFrame main = PluginServices.getMainFrame(); |
||
463 | return main.createComponentWithParams(theClass, parameters);
|
||
464 | } |
||
465 | 38781 | jjdelcerro | |
466 | public String translate(String message, String... args) { |
||
467 | String msg = message;
|
||
468 | if (msg == null) { |
||
469 | return ""; |
||
470 | } |
||
471 | msg = org.gvsig.i18n.Messages.getText(msg, args); |
||
472 | if (msg == null) { |
||
473 | msg = "_" + message.replace("_", " "); |
||
474 | } |
||
475 | return msg;
|
||
476 | } |
||
477 | |||
478 | public Component getRootComponent() { |
||
479 | return (Component) PluginServices.getMainFrame(); |
||
480 | } |
||
481 | 35974 | jjdelcerro | } |