svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / imp / DefaultApplicationManager.java @ 41312
History | View | Annotate | Download (16.5 KB)
1 | 40558 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright (C) 2007-2013 gvSIG Association.
|
||
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 3
|
||
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 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 40435 | jjdelcerro | |
25 | package org.gvsig.app.imp; |
||
26 | |||
27 | import java.awt.Component; |
||
28 | import java.io.File; |
||
29 | import java.util.ArrayList; |
||
30 | import java.util.Iterator; |
||
31 | import java.util.List; |
||
32 | 41264 | jjdelcerro | import javax.swing.JComponent; |
33 | 40435 | jjdelcerro | |
34 | import javax.swing.JFileChooser; |
||
35 | import javax.swing.filechooser.FileFilter; |
||
36 | |||
37 | import org.cresques.cts.IProjection; |
||
38 | import org.gvsig.about.AboutLocator; |
||
39 | import org.gvsig.about.AboutManager; |
||
40 | import org.gvsig.andami.Launcher; |
||
41 | import org.gvsig.andami.PluginServices; |
||
42 | 41080 | jjdelcerro | import org.gvsig.andami.actioninfo.ActionInfo; |
43 | 40435 | jjdelcerro | import org.gvsig.andami.ui.mdiFrame.MainFrame; |
44 | import org.gvsig.andami.ui.mdiManager.IWindow; |
||
45 | 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 | import org.gvsig.app.gui.WizardPanel; |
||
50 | 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 | import org.gvsig.app.project.documents.Document; |
||
59 | import org.gvsig.app.project.documents.gui.IDocumentWindow; |
||
60 | 41264 | jjdelcerro | import org.gvsig.app.project.documents.view.ViewDocument; |
61 | 40435 | jjdelcerro | import org.gvsig.fmap.crs.CRSFactory; |
62 | import org.gvsig.fmap.dal.DALLocator; |
||
63 | import org.gvsig.fmap.dal.DataManager; |
||
64 | import org.gvsig.fmap.dal.DataStore; |
||
65 | import org.gvsig.fmap.dal.DataStoreParameters; |
||
66 | import org.gvsig.fmap.geom.GeometryLocator; |
||
67 | import org.gvsig.fmap.geom.GeometryManager; |
||
68 | import org.gvsig.fmap.mapcontext.MapContextLocator; |
||
69 | import org.gvsig.fmap.mapcontext.MapContextManager; |
||
70 | import org.gvsig.fmap.mapcontext.layers.FLayer; |
||
71 | import org.gvsig.gui.ColorTablesFactory; |
||
72 | import org.gvsig.symbology.swing.SymbologySwingLocator; |
||
73 | import org.gvsig.tools.ToolsLocator; |
||
74 | import org.gvsig.tools.dataTypes.DataTypesManager; |
||
75 | import org.gvsig.tools.dispose.DisposableManager; |
||
76 | import org.gvsig.tools.dynobject.DynObjectManager; |
||
77 | import org.gvsig.tools.extensionpoint.ExtensionPoint; |
||
78 | import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension; |
||
79 | import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
||
80 | import org.gvsig.tools.persistence.PersistenceManager; |
||
81 | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
||
82 | import org.gvsig.tools.swing.icontheme.IconThemeManager; |
||
83 | import org.slf4j.Logger; |
||
84 | import org.slf4j.LoggerFactory; |
||
85 | |||
86 | |||
87 | |||
88 | |||
89 | /**
|
||
90 | * @author jmvivo
|
||
91 | *
|
||
92 | */
|
||
93 | 41312 | jjdelcerro | public class DefaultApplicationManager implements ApplicationManager { |
94 | 40435 | jjdelcerro | |
95 | @SuppressWarnings("unused") |
||
96 | 41312 | jjdelcerro | private static Logger logger = LoggerFactory.getLogger(DefaultApplicationManager.class); |
97 | 40435 | jjdelcerro | |
98 | private static final String EPNAME_PREPARE_OPEN_DATASTORE = "org.gvsig.datastore.open.prepare"; //"PrepareOpenDataStore"; |
||
99 | private static final String EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS = "org.gvsig.datastoreparameters.open.prepare"; //"PrepareOpenDataStoreParameters"; |
||
100 | private static final String EPNAME_PREPARE_OPEN_LAYER = "org.gvsig.layer.open.prepare"; // "PrepareOpenLayer"; |
||
101 | |||
102 | private static final String EPNAME_ADD_TABLE_WIZARD = "AddLayerWizard"; |
||
103 | |||
104 | private ExtensionPointManager epManager;
|
||
105 | |||
106 | private Version version;
|
||
107 | |||
108 | 41312 | jjdelcerro | public DefaultApplicationManager() {
|
109 | 40435 | jjdelcerro | epManager = ToolsLocator.getExtensionPointManager(); |
110 | epManager.add(EPNAME_PREPARE_OPEN_DATASTORE, |
||
111 | "Actions to do when open a DataStore");
|
||
112 | epManager.add(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS, |
||
113 | "Actions to do before open a DataStore with parameters");
|
||
114 | epManager.add(EPNAME_PREPARE_OPEN_LAYER, |
||
115 | "Actions to do after create a Layer");
|
||
116 | epManager.add(EPNAME_ADD_TABLE_WIZARD, |
||
117 | "Wizards to add new document table");
|
||
118 | |||
119 | version = new Version();
|
||
120 | } |
||
121 | |||
122 | /* (non-Javadoc)
|
||
123 | * @see org.gvsig.appGvSigManager#pepareOpenDataSource(org.gvsig.fmap.dal.DataStore)
|
||
124 | */
|
||
125 | @SuppressWarnings("unchecked") |
||
126 | public DataStore pepareOpenDataSource(DataStore store,
|
||
127 | PrepareContext context) throws Exception { |
||
128 | ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_DATASTORE); |
||
129 | if (ep.getCount() == 0) { |
||
130 | return store;
|
||
131 | } |
||
132 | DataStore result = store; |
||
133 | Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
||
134 | PrepareDataStore prepare; |
||
135 | while (iter.hasNext()) {
|
||
136 | prepare = (PrepareDataStore) iter.next().create(); |
||
137 | result = prepare.prepare(store, context); |
||
138 | } |
||
139 | return result;
|
||
140 | } |
||
141 | |||
142 | /* (non-Javadoc)
|
||
143 | * @see org.gvsig.appGvSigManager#prepareOpenDataStoreParameters(org.gvsig.fmap.dal.DataStoreParameters)
|
||
144 | */
|
||
145 | @SuppressWarnings("unchecked") |
||
146 | public DataStoreParameters prepareOpenDataStoreParameters(
|
||
147 | DataStoreParameters storeParameters, PrepareContext context) |
||
148 | throws Exception { |
||
149 | |||
150 | ExtensionPoint ep = epManager |
||
151 | .get(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS); |
||
152 | if (ep.getCount() == 0) { |
||
153 | return storeParameters;
|
||
154 | } |
||
155 | DataStoreParameters result = storeParameters; |
||
156 | Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
||
157 | PrepareDataStoreParameters prepare; |
||
158 | while (iter.hasNext()) {
|
||
159 | prepare = (PrepareDataStoreParameters) iter.next().create(); |
||
160 | result = prepare.prepare(storeParameters, context); |
||
161 | } |
||
162 | |||
163 | return result;
|
||
164 | } |
||
165 | |||
166 | /*
|
||
167 | * (non-Javadoc)
|
||
168 | * @see org.gvsig.app.ApplicationManager#prepareOpenDataStoreParameters(java.util.List, org.gvsig.app.prepareAction.PrepareContext)
|
||
169 | */
|
||
170 | @SuppressWarnings("unchecked") |
||
171 | public List<DataStoreParameters> prepareOpenDataStoreParameters( |
||
172 | List<DataStoreParameters> storeParameters, PrepareContext context)
|
||
173 | throws Exception { |
||
174 | |||
175 | ExtensionPoint ep = epManager |
||
176 | .get(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS); |
||
177 | if (ep.getCount() == 0) { |
||
178 | return storeParameters;
|
||
179 | } |
||
180 | |||
181 | List<DataStoreParameters> result = new ArrayList<DataStoreParameters>(); |
||
182 | |||
183 | Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
||
184 | List<PrepareDataStoreParameters> prepareList = new ArrayList<PrepareDataStoreParameters>(); |
||
185 | while (iter.hasNext()) {
|
||
186 | prepareList.add((PrepareDataStoreParameters) iter.next().create()); |
||
187 | } |
||
188 | |||
189 | for (int i = 0; i < storeParameters.size(); i++) { |
||
190 | DataStoreParameters param = storeParameters.get(i); |
||
191 | for (int j = 0; j < prepareList.size(); j++) { |
||
192 | prepareList.get(j).pre(param, context); |
||
193 | } |
||
194 | } |
||
195 | |||
196 | for (int i = 0; i < storeParameters.size(); i++) { |
||
197 | DataStoreParameters param = storeParameters.get(i); |
||
198 | if(param != null) { |
||
199 | for (int j = 0; j < prepareList.size(); j++) { |
||
200 | param = prepareList.get(j).prepare(param, context); |
||
201 | if(param == null) |
||
202 | break;
|
||
203 | } |
||
204 | if(param != null) |
||
205 | result.add(param); |
||
206 | } |
||
207 | } |
||
208 | |||
209 | for (int i = 0; i < storeParameters.size(); i++) { |
||
210 | DataStoreParameters param = storeParameters.get(i); |
||
211 | for (int j = 0; j < prepareList.size(); j++) { |
||
212 | prepareList.get(j).post(param, context); |
||
213 | } |
||
214 | } |
||
215 | |||
216 | return result;
|
||
217 | } |
||
218 | |||
219 | public void registerPrepareOpenDataStore(PrepareDataStore action) { |
||
220 | ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_DATASTORE); |
||
221 | ep.append(action.getName(), action.getDescription(), action); |
||
222 | } |
||
223 | |||
224 | public void registerPrepareOpenDataStoreParameters( |
||
225 | PrepareDataStoreParameters action) { |
||
226 | ExtensionPoint ep = epManager |
||
227 | .get(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS); |
||
228 | ep.append(action.getName(), action.getDescription(), action); |
||
229 | |||
230 | |||
231 | } |
||
232 | |||
233 | @SuppressWarnings("unchecked") |
||
234 | public FLayer prepareOpenLayer(FLayer layer,
|
||
235 | PrepareContextView context) |
||
236 | throws Exception { |
||
237 | |||
238 | ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_LAYER); |
||
239 | |||
240 | if (ep.getCount() == 0) { |
||
241 | return layer;
|
||
242 | } |
||
243 | FLayer result = layer; |
||
244 | Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
||
245 | PrepareLayer prepare; |
||
246 | while (iter.hasNext()) {
|
||
247 | prepare = (PrepareLayer) iter.next().create(); |
||
248 | result = prepare.prepare(result, context); |
||
249 | } |
||
250 | |||
251 | return result;
|
||
252 | |||
253 | } |
||
254 | |||
255 | public void registerPrepareOpenLayer(PrepareLayer action) { |
||
256 | ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_LAYER); |
||
257 | ep.append(action.getName(), action.getDescription(), action); |
||
258 | } |
||
259 | |||
260 | public void registerAddTableWizard(String name, String description, |
||
261 | Class<? extends WizardPanel> wpClass) { |
||
262 | ExtensionPoint ep = epManager.get(EPNAME_ADD_TABLE_WIZARD); |
||
263 | ep.append(name, description, wpClass); |
||
264 | } |
||
265 | |||
266 | @SuppressWarnings("unchecked") |
||
267 | public List<WizardPanel> getWizardPanels() throws Exception { |
||
268 | ExtensionPoint ep = epManager.get(EPNAME_ADD_TABLE_WIZARD); |
||
269 | List<WizardPanel> result = new ArrayList<WizardPanel>(); |
||
270 | Iterator<Extension> iter = ep.iterator();
|
||
271 | while (iter.hasNext()) {
|
||
272 | result.add((WizardPanel) iter.next().create()); |
||
273 | } |
||
274 | return result;
|
||
275 | } |
||
276 | |||
277 | public DataManager getDataManager() {
|
||
278 | return DALLocator.getDataManager();
|
||
279 | } |
||
280 | |||
281 | public GeometryManager getGeometryManager() {
|
||
282 | return GeometryLocator.getGeometryManager();
|
||
283 | } |
||
284 | |||
285 | public PersistenceManager getPersistenceManager() {
|
||
286 | return ToolsLocator.getPersistenceManager();
|
||
287 | } |
||
288 | |||
289 | public DisposableManager getDisposableManager() {
|
||
290 | return ToolsLocator.getDisposableManager();
|
||
291 | } |
||
292 | |||
293 | public DynObjectManager getDynObjectManager() {
|
||
294 | return ToolsLocator.getDynObjectManager();
|
||
295 | } |
||
296 | |||
297 | public ExtensionPointManager getExtensionPointManager() {
|
||
298 | return ToolsLocator.getExtensionPointManager();
|
||
299 | } |
||
300 | |||
301 | public ProjectManager getProjectManager() {
|
||
302 | return ProjectManager.getInstance();
|
||
303 | } |
||
304 | |||
305 | public MDIManager getUIManager() {
|
||
306 | return PluginServices.getMDIManager();
|
||
307 | } |
||
308 | |||
309 | public MapContextManager getMapContextManager() {
|
||
310 | return MapContextLocator.getMapContextManager();
|
||
311 | } |
||
312 | |||
313 | public DataTypesManager getDataTypesManager() {
|
||
314 | return ToolsLocator.getDataTypesManager();
|
||
315 | } |
||
316 | |||
317 | public IProjection getCRS(String code) { |
||
318 | return CRSFactory.getCRS(code);
|
||
319 | } |
||
320 | |||
321 | public IconThemeManager getIconThemeManager() {
|
||
322 | return ToolsSwingLocator.getIconThemeManager();
|
||
323 | } |
||
324 | |||
325 | public String getArgument(String name) { |
||
326 | return PluginServices.getArgumentByName(name);
|
||
327 | } |
||
328 | |||
329 | public String[] getArguments() { |
||
330 | return PluginServices.getArguments();
|
||
331 | } |
||
332 | |||
333 | public String getFromClipboard() { |
||
334 | return PluginServices.getFromClipboard();
|
||
335 | } |
||
336 | |||
337 | public void putInClipboard(String data) { |
||
338 | PluginServices.putInClipboard(data); |
||
339 | } |
||
340 | |||
341 | public Project getCurrentProject() {
|
||
342 | return ProjectManager.getInstance().getCurrentProject();
|
||
343 | } |
||
344 | |||
345 | public PreferencesNode getPreferences(String node) { |
||
346 | if( node.equalsIgnoreCase("project")) { |
||
347 | return DefaultProject.getPreferences();
|
||
348 | } |
||
349 | return new DefaultPreferencesNode(node); |
||
350 | } |
||
351 | |||
352 | public PreferencesNode getPreferences() {
|
||
353 | return new DefaultPreferencesNode(); |
||
354 | } |
||
355 | |||
356 | public Version getVersion() {
|
||
357 | return version;
|
||
358 | } |
||
359 | |||
360 | public AboutManager getAbout() {
|
||
361 | AboutManager manager = AboutLocator.getManager(); |
||
362 | return manager;
|
||
363 | } |
||
364 | |||
365 | public ColorTablesFactory getColorTablesFactory() {
|
||
366 | return SymbologySwingLocator.getSwingManager().getColorTablesFactory();
|
||
367 | } |
||
368 | |||
369 | public void registerColorTablesFactory(ColorTablesFactory factory) { |
||
370 | SymbologySwingLocator.getSwingManager().setColorTablesFactory(factory); |
||
371 | |||
372 | } |
||
373 | |||
374 | public IWindow getActiveWindow() {
|
||
375 | try {
|
||
376 | IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
||
377 | return window;
|
||
378 | } catch (Exception ex) { |
||
379 | return null; |
||
380 | } |
||
381 | } |
||
382 | |||
383 | public Document getActiveDocument() { |
||
384 | return this.getActiveDocument((Class<? extends Document>)null); |
||
385 | } |
||
386 | |||
387 | public Document getActiveDocument(String documentTypeName) { |
||
388 | Document document = this.getActiveDocument(); |
||
389 | if( document!= null && document.getTypeName().equalsIgnoreCase(documentTypeName) ) { |
||
390 | return document;
|
||
391 | } |
||
392 | return null; |
||
393 | } |
||
394 | |||
395 | public Document getActiveDocument(Class<? extends Document> documentClass) { |
||
396 | Project project = this.getCurrentProject();
|
||
397 | if( project == null ) { |
||
398 | return null; |
||
399 | } |
||
400 | return project.getActiveDocument(documentClass);
|
||
401 | } |
||
402 | 41264 | jjdelcerro | |
403 | public JComponent getActiveComponent(Class<? extends Document> documentClass) { |
||
404 | Document document = this.getActiveDocument(documentClass); |
||
405 | if (document == null) { |
||
406 | return null; |
||
407 | } |
||
408 | return document.getMainComponent();
|
||
409 | } |
||
410 | 40435 | jjdelcerro | |
411 | 41264 | jjdelcerro | |
412 | 40435 | jjdelcerro | public IDocumentWindow getDocumentWindow(Document document) { |
413 | Class<? extends IDocumentWindow> defaultDocumentClass = |
||
414 | document.getFactory().getMainWindowClass(); |
||
415 | return (IDocumentWindow) this.getUIManager().getSingletonWindow(defaultDocumentClass, document); |
||
416 | } |
||
417 | |||
418 | public String getLocaleLanguage() { |
||
419 | return Launcher.getAndamiConfig().getLocaleLanguage();
|
||
420 | } |
||
421 | |||
422 | public void message(String message, int message_type) { |
||
423 | MainFrame main = PluginServices.getMainFrame(); |
||
424 | main.message(message, message_type); |
||
425 | } |
||
426 | |||
427 | public void messageDialog(String message, String title, int messageType) { |
||
428 | MainFrame main = PluginServices.getMainFrame(); |
||
429 | main.messageDialog(message, title, messageType); |
||
430 | } |
||
431 | |||
432 | public void messageDialog(String message, String[] messageArgs, |
||
433 | String title, int messageType) { |
||
434 | MainFrame main = PluginServices.getMainFrame(); |
||
435 | main.messageDialog(message, messageArgs, title, messageType); |
||
436 | } |
||
437 | |||
438 | public int confirmDialog(String message, String title, int optionType, |
||
439 | int messageType) {
|
||
440 | MainFrame main = PluginServices.getMainFrame(); |
||
441 | return main.confirmDialog(message, title, optionType, messageType);
|
||
442 | } |
||
443 | |||
444 | public String inputDialog(String message, String title, int messageType, |
||
445 | String initialValue) {
|
||
446 | MainFrame main = PluginServices.getMainFrame(); |
||
447 | return main.inputDialog(message, title, messageType, initialValue);
|
||
448 | } |
||
449 | |||
450 | public String inputDialog(String message, String title) { |
||
451 | MainFrame main = PluginServices.getMainFrame(); |
||
452 | return main.inputDialog(message, title);
|
||
453 | } |
||
454 | |||
455 | public void showDialog(Component contents, String title) { |
||
456 | MainFrame main = PluginServices.getMainFrame(); |
||
457 | main.showDialog(contents, title); |
||
458 | } |
||
459 | |||
460 | public Component createComponent(Class<? extends Component> theClass, |
||
461 | Object... parameters) {
|
||
462 | MainFrame main = PluginServices.getMainFrame(); |
||
463 | return main.createComponentWithParams(theClass, parameters);
|
||
464 | } |
||
465 | |||
466 | public Component createComponentWithParams( |
||
467 | Class<? extends Component> theClass, Object[] parameters) { |
||
468 | MainFrame main = PluginServices.getMainFrame(); |
||
469 | return main.createComponentWithParams(theClass, parameters);
|
||
470 | } |
||
471 | |||
472 | |||
473 | public File[] showChooserDialog( |
||
474 | final String title, |
||
475 | final int type, // SAVE_DIALOG / OPEN_DIALOG |
||
476 | final int selectionMode, // JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES |
||
477 | final boolean multiselection, |
||
478 | final File initialPath, |
||
479 | final FileFilter filter, |
||
480 | final boolean fileHidingEnabled |
||
481 | ) { |
||
482 | MainFrame main = PluginServices.getMainFrame(); |
||
483 | return main.showChooserDialog(title, type, selectionMode, multiselection, initialPath, filter, fileHidingEnabled);
|
||
484 | } |
||
485 | |||
486 | public File[] showOpenDirectoryDialog(String title, File initialPath) { |
||
487 | return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.DIRECTORIES_ONLY, false, initialPath, null, false); |
||
488 | } |
||
489 | |||
490 | |||
491 | public File[] showOpenFileDialog(String title, File initialPath) { |
||
492 | return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.FILES_ONLY, false, initialPath, null, false); |
||
493 | } |
||
494 | |||
495 | |||
496 | public File[] showSaveFileDialog(String title, File initialPath) { |
||
497 | return showChooserDialog(title, JFileChooser.SAVE_DIALOG, JFileChooser.FILES_ONLY, false, initialPath, null, false); |
||
498 | } |
||
499 | |||
500 | public String translate(String message, String... args) { |
||
501 | return org.gvsig.i18n.Messages.translate(message, args);
|
||
502 | } |
||
503 | |||
504 | public Component getRootComponent() { |
||
505 | return (Component) PluginServices.getMainFrame(); |
||
506 | } |
||
507 | |||
508 | public void refreshMenusAndToolBars() { |
||
509 | PluginServices.getMainFrame().refreshControls(); |
||
510 | } |
||
511 | |||
512 | 41080 | jjdelcerro | public MainFrame getMainFrame() {
|
513 | return PluginServices.getMainFrame();
|
||
514 | } |
||
515 | |||
516 | public void addMenu(ActionInfo action, String text) { |
||
517 | MainFrame f = this.getMainFrame();
|
||
518 | f.addMenu(action,text); |
||
519 | } |
||
520 | |||
521 | public void addTool(ActionInfo action, String toolBarName) { |
||
522 | MainFrame f = this.getMainFrame();
|
||
523 | f.addTool(action,toolBarName); |
||
524 | f.refreshControls(); |
||
525 | } |
||
526 | 40435 | jjdelcerro | } |