svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / plugins / Extension.java @ 40596
History | View | Annotate | Download (2.99 KB)
1 |
/**
|
---|---|
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 |
package org.gvsig.andami.plugins; |
25 |
|
26 |
import org.gvsig.andami.PluginServices; |
27 |
import org.gvsig.andami.PluginsLocator; |
28 |
import org.gvsig.andami.plugins.status.IExtensionStatus; |
29 |
import org.slf4j.Logger; |
30 |
import org.slf4j.LoggerFactory; |
31 |
|
32 |
/**
|
33 |
* Extensions are the way in which plugins extend Andami. Extensions
|
34 |
* can add controls to user interface (GUI) and execute some code
|
35 |
* when controls are activated. Every class implementing
|
36 |
* {@link IExtension} is an extension, but directly implementing
|
37 |
* that interface is discouraged. The preferred way to create
|
38 |
* an extension is extending this absctract class.
|
39 |
*
|
40 |
* @see IExtension
|
41 |
*
|
42 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
43 |
*/
|
44 |
public abstract class Extension implements IExtension, IExtensionQueryByAction, IExtensionExecuteWithArgs { |
45 |
|
46 |
private static Logger logger = LoggerFactory.getLogger(Extension.class); |
47 |
/*
|
48 |
* (non-Javadoc)
|
49 |
* @see com.iver.andami.plugins.IExtension#terminate()
|
50 |
*/
|
51 |
public void terminate(){ |
52 |
|
53 |
} |
54 |
/*
|
55 |
* (non-Javadoc)
|
56 |
* @see com.iver.andami.plugins.IExtension#postInitialize()
|
57 |
*/
|
58 |
public void postInitialize(){ |
59 |
|
60 |
} |
61 |
|
62 |
/*
|
63 |
* (non-Javadoc)
|
64 |
* @see com.iver.andami.plugins.IExtension#getStatus()
|
65 |
*/
|
66 |
public IExtensionStatus getStatus() {
|
67 |
return null; |
68 |
} |
69 |
|
70 |
/*
|
71 |
* (non-Javadoc)
|
72 |
* @see com.iver.andami.plugins.IExtension#getStatus(IExtension extension)
|
73 |
*/
|
74 |
public IExtensionStatus getStatus(IExtension extension) {
|
75 |
return extension.getStatus();
|
76 |
} |
77 |
|
78 |
public String getText(String msg) { |
79 |
return PluginsLocator.getManager().getText(this, msg); |
80 |
} |
81 |
|
82 |
public PluginServices getPlugin() {
|
83 |
return PluginsLocator.getManager().getPlugin(this.getClass()); |
84 |
} |
85 |
|
86 |
public boolean isEnabled(String action) { |
87 |
return isEnabled();
|
88 |
} |
89 |
|
90 |
public boolean isVisible(String action) { |
91 |
return isVisible();
|
92 |
} |
93 |
|
94 |
public boolean canQueryByAction() { |
95 |
return false; |
96 |
} |
97 |
|
98 |
public void execute(String command, Object[] args) { |
99 |
if( args!= null && args.length>0 ) { |
100 |
logger.info("callong execute with args in a extension that not support ("+this.getClass().getSimpleName()+")."); |
101 |
} |
102 |
execute(command); |
103 |
} |
104 |
} |
105 |
|