Package org.gvsig.andami
Class PluginServices
java.lang.Object
org.gvsig.andami.PluginServices
Provides services to Plugins. Each plugin has an associated PluginServices
object, which provides specific services. Main of them: translations,
logging, access to plugin's resources, background tasks, clipboard access
and data persistence.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassclassclass -
Constructor Summary
ConstructorsConstructorDescriptionPluginServices(PluginClassLoader loader) Creates a new PluginServices objetct.PluginServices(PluginClassLoader loader, String[] alternativeNames) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDependencyWithPlugin(PluginServices otherPlugin) static voidaddLoaders(ArrayList classLoaders) voidaddPopupMenuListener(String name, Component c, ActionListener listener) A�ade un listener a un popup menu registrado en el config.xml de alg�n pluginstatic ThreadRuns a background task.static voidcancelableBackgroundExecution(org.gvsig.utils.swing.threads.IMonitorableTask task) Runs a backbround task.static voidCloses the application.String[]static StringgetArgumentByName(String name) Returns the value of a command line named argument.static String[]Deprecated.Gets the plugin's classloader.static ExtensionDecoratorgetDecoratedExtension(Class extensionClass) Deprecated.static ExtensionDecorator[]Deprecated.static DlgPreferencesDeprecated.static ExclusiveUIExtensionDeprecated.static IExtensiongetExtension(Class extensionClass) Deprecated.static IteratorDeprecated.static StringDeprecated.static org.gvsig.tools.swing.icontheme.IconThemestatic org.gvsig.tools.swing.icontheme.IconThemeManagerstatic org.slf4j.LoggerDeprecated.static MainFrameDeprecated.Deprecated.static MDIManagerDeprecated.org.gvsig.utils.XMLEntityDeprecated.Gets the plugin's root directory.Returns the folder where the plugin stores its resources.Gets the plugin's nameorg.gvsig.tools.dynobject.DynObjectstatic PluginServicesgetPluginServices(Object pluginClassInstance) Deprecated.static PluginServicesgetPluginServices(String pluginName) Deprecated.static StringReturns the message in the current's locale language corresponding to the provided translation key.Returns the message in the current's locale language corresponding to the provided translation key.static voidputInClipboard(String data) Stores the provided text data on the clipboard.static voidstatic booleanTry to detect if the application is running in a development environment.voidstatic voidsetArguments(String[] arguments) Deprecated.static voidsetExclusiveUIExtension(ExclusiveUIExtension extension) Deprecated.voidsetPersistentXML(org.gvsig.utils.XMLEntity entity) Sets the XML data which should be saved on disk for this plugin.toString()static void
-
Constructor Details
-
PluginServices
Creates a new PluginServices objetct.- Parameters:
loader- The Plugin's ClassLoader.
-
PluginServices
-
-
Method Details
-
getAlternativeNames
-
getText
Returns the message in the current's locale language corresponding to the provided translation key. The key-message pairs are obtained from the plugin's translation files (text_xx.properties files).- Parameters:
key- Translation key whose associated message is to be obtained- Returns:
- The message associated with the provided key, in one of the current locale languages, or the key if the translation is not found.
-
getClassLoader
Gets the plugin's classloader.- Returns:
- Returns the loader.
-
getPluginName
Gets the plugin's name- Returns:
- The plugin's name
-
getPluginServices
Deprecated.Gets a reference to the PluginServices object associated with the plugin containing the provided class. Obtienen una referencia al PluginServices del plugin cuyo nombre se pasa como par�metro- Parameters:
pluginClassInstance- An instance of a class. This class is contained in a plugin, whose services are to be obtained- Returns:
- The PluginServices object associated to the containing plugin
- Throws:
RuntimeException- If the parameter was not loaded from a plugin
-
getPluginServices
Deprecated.Gets a reference to the PluginServices object associated with the provided plugin.- Parameters:
pluginName- Plugin's name whose services are going to be used- Returns:
- The PluginServices object associated with the provided plugin.
-
getMDIManager
Deprecated.Gets the window manager (MDIManager).- Returns:
- A reference to the window manager (MDIManager).
-
getMainFrame
Deprecated.Gets the application's main frame.- Returns:
- A reference to the application's main window
-
registerKeyStroke
-
unRegisterKeyStroke
-
getExtension
Deprecated.Gets the instance of the extension whose class is provided.- Parameters:
extensionClass- Class of the extension whose instance is to be returned- Returns:
- The instance of the extension, or null if the instance does not exist.Instancia de la extensi�n o null en caso de que no haya una
-
getDecoratedExtension
Deprecated.Gets a reference to the Extension Decorator which adds some extra options to the basic extension interface.- Parameters:
extensionClass- The class of the extension whose decorator is to be returned- Returns:
- The ExtensionDecorator associated with the provided extension, or null if the extension does not exist.
-
getDecoratedExtensions
Deprecated.Returns an array containing references to all the loaded extensions.- Returns:
- ExtensionDecorator[] An array of ExtensionDecorators (each Decorator contains one extension).
-
getExtensions
Deprecated.Gets an iterator with all the loaded Extensions.- Returns:
- Iterator over the decorated extensions (each member of the iterator is an ExtensionDecorator, which in turn contains one IExtension object).
-
getText
Returns the message in the current's locale language corresponding to the provided translation key. The key-message pairs are obtained from the plugin's translation files (text_xx.properties files).- Parameters:
pluginObject- Any object which was loaded from a pluginkey- Translation key whose associated message is to be obtained- Returns:
- The message associated with the provided key, in one of the current locale languages, or the key if the translation is not found.
-
setPersistentXML
public void setPersistentXML(org.gvsig.utils.XMLEntity entity) Sets the XML data which should be saved on disk for this plugin. This data can be retrieved on following sessions.- Parameters:
The- XMLEntity object containing the data to be persisted.- See Also:
-
getPersistentXML
Deprecated.Gets the XML data which was saved on previous sessions for this plugins.- Returns:
- An XMLEntity object containing the persisted data
-
addPopupMenuListener
A�ade un listener a un popup menu registrado en el config.xml de alg�n plugin- Parameters:
name- Nombre del men� contextualc- Componente que desplegar� el men� cuando se haga click con el bot�n derecholistener- Listener que se ejecutar� cuando se seleccione cualquier entrada del men�- Throws:
RuntimeException- Si la interfaz no est� preparada todav�a. S�lo puede darse durante el arranque
-
getPluginDirectory
Gets the plugin's root directory.- Returns:
- A File pointing to the plugin's root directory.
-
backgroundExecution
Runs a background task. The events produced on the main frame will be inhibited.- Parameters:
r- The task to run.- Returns:
- The Thread on which the task is executed.
-
cancelableBackgroundExecution
public static void cancelableBackgroundExecution(org.gvsig.utils.swing.threads.IMonitorableTask task) Runs a backbround task. This task may be monitored and canceled, and does not inhibit any event.- Parameters:
task- The task to run.
-
closeApplication
public static void closeApplication()Closes the application. Cleanly exits from the application: terminates all the extensions, then exits. -
getArguments
Deprecated.Gets an array containing the application's startup arguments.
Usually:appName plugins-directory [locale] [other args]- Returns:
- the original arguments that Andami received. (app-name plugins-directory, locale, etc)
-
setArguments
Deprecated.Replaces the original Andami arguments with the provided arguments.- Parameters:
arguments- An array of String, each element of the array represents one argument.
-
getArgumentByName
Returns the value of a command line named argument.
The argument format is:
-{argumentName}={argumentValue}
example:
' -language=en '- Returns:
- String The value of the argument
-
getLogger
Deprecated.Gets the logger. The logger is used to register important events (errors, etc), which are stored on a file which can be checked later.- Returns:
- A Logger object.
- See Also:
-
getDlgPreferences
Deprecated. -
putInClipboard
Stores the provided text data on the clipboard.- Parameters:
data- An String containing the data to be stored on the clipboard.
-
getFromClipboard
Deprecated.Gets text data from the Clipboard, if available.- Returns:
- An String containing the clipboard's data, or
nullif the data was not available.
-
getExclusiveUIExtension
Deprecated.Gets the ExclusiveUIExtension, an special extension which will take control over the UI and will decide which extensions may be enable/disabled or visible/hidden.- Returns:
- If an ExclusiveUIExtension was set, return this extension.
Otherwise, return
null. - See Also:
-
setExclusiveUIExtension
Deprecated.Sets the ExclusiveUIExtension, an special extension which will take control over the UI and will decide which extensions may be enable/disabled or visible/hidden.
The ExclusiveUIExtension is normally set by the following Andami startup argument:
ExclusiveUIExtension=ExtensionName- See Also:
-
addLoaders
-
getIconThemeManager
public static org.gvsig.tools.swing.icontheme.IconThemeManager getIconThemeManager() -
getIconTheme
public static org.gvsig.tools.swing.icontheme.IconTheme getIconTheme() -
runningInDevelopment
public static boolean runningInDevelopment()Try to detect if the application is running in a development environment.
This look for .project and .classpath files in the starts path of the application.- Returns:
- true if .project and .classpath are in the development path
-
getManager
Deprecated. -
getPluginProperties
public org.gvsig.tools.dynobject.DynObject getPluginProperties() -
savePluginProperties
public void savePluginProperties() -
getPluginHomeFolder
Returns the folder where the plugin stores its resources. That folder will be usually a subfolder into the application folder in the user home folder.- Returns:
- the folder where the plugin stores its resources
-
toString
-
addDependencyWithPlugin
-