public class PluginJAR
extends java.lang.Object
actions.xml
defining plugin actions.
Only one such file per plugin is allowed. See ActionSet
for
syntax.browser.actions.xml
defining file system
browser actions.
Only one such file per plugin is allowed. See ActionSet
for
syntax.dockables.xml
defining dockable windows.
Only one such file per plugin is allowed. See DockableWindowManager
for
syntax.services.xml
defining additional services
offered by the plugin, such as virtual file systems.
Only one such file per plugin is allowed. See ServiceManager
for
syntax..props
containing name/value pairs
separated by an equals sign.
A plugin can supply any number of property files. Property files are used
to define plugin men items, plugin option panes, as well as arbitriary
settings and strings used by the plugin. See EditPlugin
for
information about properties used by jEdit. See
java.util.Properties
for property file syntax.Plugin
.
This class, known as the plugin core class must extend
EditPlugin
and define a few required properties, otherwise it is
ignored.
jEdit.addPluginJAR(String)
and
jEdit.removePluginJAR(PluginJAR,boolean)
methods. Furthermore, the
plugin core class might not be loaded until the plugin is first used. See
EditPlugin.start()
for a full description.Modifier and Type | Class and Description |
---|---|
static class |
PluginJAR.PluginCacheEntry
Used by the
DockableWindowManager and
ServiceManager to handle caching. |
Constructor and Description |
---|
PluginJAR(java.io.File file)
Creates a PluginJAR object which is not necessarily loaded, but can be later.
|
Modifier and Type | Method and Description |
---|---|
void |
activatePlugin()
Loads the plugin core class.
|
void |
activatePluginIfNecessary()
Should be called after a new plugin is installed.
|
boolean |
checkDependencies()
Returns true if all dependencies are satisified, false otherwise.
|
void |
deactivatePlugin(boolean exit)
Unloads the plugin core class.
|
static java.lang.String |
findPlugin(java.lang.String className)
Unlike getPlugin(), will return a PluginJAR that is not yet loaded,
given its classname.
|
PluginJAR.PluginCacheEntry |
generateCache() |
ActionSet |
getActionSet()
Returns the plugin's action set for the jEdit action context
jEdit.getActionContext() . |
java.lang.String[] |
getAllDependentPlugins() |
ActionSet |
getBrowserActionSet()
Returns the plugin's action set for the file system browser action
context
VFSBrowser.getActionContext() . |
java.lang.String |
getCachePath()
Returns the full path name of this plugin's summary file.
|
JARClassLoader |
getClassLoader()
Returns the plugin's class loader.
|
static java.util.Set<java.lang.String> |
getDependencies(java.lang.String classname)
Returns a list of dependencies by searching the plugin properties.
|
static java.util.Set<java.lang.String> |
getDependencySet(java.lang.String className) |
java.lang.String[] |
getDependentPlugins() |
java.net.URL |
getDockablesURI()
Returns the location of the plugin's
dockables.xml file. |
java.io.File |
getFile()
Returns a file pointing to the plugin JAR.
|
java.util.Collection<java.lang.String> |
getFiles()
Get the files listed in this plugin and return full paths to them
|
java.util.Collection<java.lang.String> |
getJars()
Get the jars listed in this plugin and return full paths to them
|
static java.util.Set<java.lang.String> |
getOptionalDependencies(java.lang.String classname)
Returns a list of optional dependencies by searching the plugin properties.
|
java.lang.String[] |
getOptionallyDependentPlugins() |
java.lang.String |
getPath()
Returns the full path name of this plugin's JAR file.
|
EditPlugin |
getPlugin()
Returns the plugin core class for this JAR file.
|
static PluginJAR.PluginCacheEntry |
getPluginCache(PluginJAR plugin) |
static PluginJAR.PluginCacheEntry |
getPluginCacheEntry(java.lang.String path)
Returns the cache entry for an installed but not loaded plugin.
|
java.util.Set<java.lang.String> |
getRequiredJars()
Returns the required jars of this plugin.
|
java.lang.String[] |
getResources() |
java.net.URL |
getServicesURI()
Returns the location of the plugin's
services.xml file. |
java.util.zip.ZipFile |
getZipFile()
Returns the plugin's JAR file, opening it if necessary.
|
boolean |
init() |
static PluginJAR |
load(java.lang.String path,
boolean loadDependents)
Loads a plugin, and its dependent plugins if necessary.
|
static java.util.Collection<java.lang.String> |
parseJarsFilesString(java.lang.String path,
java.lang.String jarsString)
parse the files listed in plugin.CLASSNAME.jars or plugin.CLASSNAME.files
and return full paths to each file of the list.
|
static java.util.Collection<java.lang.String> |
parseJarsFilesStringNames(java.lang.String jarsString)
parse the files listed in plugin.CLASSNAME.jars or plugin.CLASSNAME.files
and return them as a collection
|
java.lang.String |
toString() |
static void |
transitiveClosure(java.lang.String[] dependents,
java.util.List<java.lang.String> listModel)
If plugin A is needed by B, and B is needed by C, we want to
tell the user that A is needed by B and C when they try to
unload A.
|
void |
uninit(boolean exit) |
public PluginJAR(java.io.File file)
load(String, boolean)
public static PluginJAR load(java.lang.String path, boolean loadDependents)
public static java.util.Collection<java.lang.String> parseJarsFilesString(java.lang.String path, java.lang.String jarsString)
public static java.util.Collection<java.lang.String> parseJarsFilesStringNames(java.lang.String jarsString)
public java.util.Collection<java.lang.String> getJars()
public java.util.Collection<java.lang.String> getFiles()
public java.lang.String getPath()
public static java.lang.String findPlugin(java.lang.String className)
className
- a class namepublic java.lang.String getCachePath()
public static java.util.Set<java.lang.String> getDependencySet(java.lang.String className)
className
- of a plugin that we wish to loadpublic java.io.File getFile()
public JARClassLoader getClassLoader()
public java.util.zip.ZipFile getZipFile() throws java.io.IOException
java.io.IOException
public ActionSet getActionSet()
jEdit.getActionContext()
. These actions are loaded from
the actions.xml
file; see ActionSet
.
.public ActionSet getBrowserActionSet()
VFSBrowser.getActionContext()
.
These actions are loaded from
the browser.actions.xml
file; see ActionSet
.
.public boolean checkDependencies()
public java.util.Set<java.lang.String> getRequiredJars()
public static java.util.Set<java.lang.String> getDependencies(java.lang.String classname) throws java.lang.IllegalArgumentException
classname
- The classname of a pluginjava.lang.IllegalArgumentException
public static java.util.Set<java.lang.String> getOptionalDependencies(java.lang.String classname) throws java.lang.IllegalArgumentException
classname
- The classname of a pluginjava.lang.IllegalArgumentException
public static void transitiveClosure(java.lang.String[] dependents, java.util.List<java.lang.String> listModel)
dependents
- a set of plugins which we wish to disablelistModel
- a set of plugins which will be affected, and will need
to be disabled also.public java.lang.String[] getDependentPlugins()
public java.lang.String[] getOptionallyDependentPlugins()
public java.lang.String[] getAllDependentPlugins()
getDependentPlugins
and getOptionallyDependentPlugins
.public EditPlugin getPlugin()
EditPlugin.Deferred
. If you need the actual plugin core
class instance, call activatePlugin()
first.
If the plugin is not yet loaded, returns nullpublic void activatePlugin()
EditPlugin.start()
.
This method is thread-safe.public void activatePluginIfNecessary()
public void deactivatePlugin(boolean exit)
EditPlugin.stop()
public java.net.URL getDockablesURI()
dockables.xml
file.public java.net.URL getServicesURI()
services.xml
file.public java.lang.String toString()
toString
in class java.lang.Object
public static PluginJAR.PluginCacheEntry getPluginCache(PluginJAR plugin)
public static PluginJAR.PluginCacheEntry getPluginCacheEntry(java.lang.String path) throws java.io.IOException
path
- path to the the plugin jarjava.io.IOException
- if jEdit cannot generate cachepublic boolean init()
public void uninit(boolean exit)
public java.lang.String[] getResources()
public PluginJAR.PluginCacheEntry generateCache() throws java.io.IOException
java.io.IOException