Class AddonManagerPlugin
java.lang.Object
org.graffiti.plugin.GenericPluginAdapter
org.graffiti.plugin.EditorPluginAdapter
de.ipk_gatersleben.ag_nw.graffiti.IPK_EditorPluginAdapter
de.ipk_gatersleben.ag_nw.graffiti.plugins.addons.AddonManagerPlugin
- All Implemented Interfaces:
DragAndDropHandler
,EditorPlugin
,GenericPlugin
public class AddonManagerPlugin extends IPK_EditorPluginAdapter implements DragAndDropHandler
This class manages Add-ons, which are Vanted-plugins loaded during runtime.
Usually such an Add-on brings more functionality than plugins, e.g. extending
Vanted by complete Flux-Balance Analysis or 3D-networks. Add-ons are
downloaded/distributed as a jar-file. An exemplary Add-on can be found in the
CVS and serve as a starting point.
- Author:
- Hendrik Rohn, Christian Klukas
-
Field Summary
Fields inherited from class org.graffiti.plugin.EditorPluginAdapter
tools
-
Constructor Summary
Constructors Constructor Description AddonManagerPlugin()
Creates a new menu-entry for the Add-ons and waits for all plugins to be started. -
Method Summary
Modifier and Type Method Description boolean
activateAddon(int number)
Activate deactivated addon.boolean
activateAddon(String name)
AddOnInstallResult
addAddon(PluginDescription pd, File f, boolean onStartup)
Adds the addon to Vanted.static boolean
addonsLoaded()
boolean
canProcess(File f)
void
deactivateAddon(int number)
static void
expandClasspathByJarfile(URL[] files)
Expands the classloader by the Add-on jarfile.Addon
getAddon(int number)
ArrayList<Addon>
getAddons()
Gets the all the Add-ons as a list.Collection<String>
getDeactivatedAddons()
static AddonManagerPlugin
getInstance()
boolean
hasPriority()
boolean
installAddon(String jardir, String jarname)
Install Add-on by copying the jarfile and loading it.boolean
process(List<File> files)
void
removeAddon(File file)
Removes the Add-on by renaming it.void
showManageAddonDialog()
Shows Add-on-Manage-Dialog.void
showManageAddonDialog(Window parent)
Shows Add-on-Manage-Dialog.void
showManageAddonDialog(String msg, boolean highlightUpdate)
void
writeDeactivatedListToFile()
Write deactivated list to file.Methods inherited from class de.ipk_gatersleben.ag_nw.graffiti.IPK_EditorPluginAdapter
getIcon
Methods inherited from class org.graffiti.plugin.EditorPluginAdapter
getAttributeComponents, getGUIComponents, getInspectorTabs, getModes, getShapes, getTools, getValueEditComponents
Methods inherited from class org.graffiti.plugin.GenericPluginAdapter
configure, doBeforeExit, getAddonIcon, getAlgorithms, getAttributeDescriptions, getAttributes, getDefaultView, getDependencies, getExtensions, getGraphPostProcessors, getInputSerializers, getOutputSerializers, getURLattributeActions, getViews, interrupt, isSelectionListener, isSessionListener, isViewListener, needsEditComponents, setIsAddon, stop
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.graffiti.plugin.GenericPlugin
configure, doBeforeExit, getAlgorithms, getAttributeDescriptions, getAttributes, getDefaultView, getDependencies, getExtensions, getInputSerializers, getOutputSerializers, getURLattributeActions, getViews, interrupt, isSelectionListener, isSessionListener, isViewListener, needsEditComponents, stop
-
Constructor Details
-
AddonManagerPlugin
public AddonManagerPlugin()Creates a new menu-entry for the Add-ons and waits for all plugins to be started. Then the Add-ons can be loaded.
-
-
Method Details
-
getInstance
- Returns:
- The Addonmanager instance or null, if no instance was created (e.g. deselected)
-
expandClasspathByJarfile
Expands the classloader by the Add-on jarfile.- Parameters:
files
- the files
-
addAddon
Adds the addon to Vanted.- Parameters:
f
- The Add-on-Jar-File.
-
writeDeactivatedListToFile
public void writeDeactivatedListToFile()Write deactivated list to file.- Parameters:
list
- The file-list
-
activateAddon
public boolean activateAddon(int number)Activate deactivated addon.- Parameters:
number
- the number
-
deactivateAddon
public void deactivateAddon(int number) -
installAddon
public boolean installAddon(String jardir, String jarname) throws FileNotFoundException, IOExceptionInstall Add-on by copying the jarfile and loading it.- Parameters:
jardir
- the jardir, which must not be the add-on directoryjarname
- the jarname of the add-on- Throws:
FileNotFoundException
- the file not found exceptionIOException
- Signals that an I/O exception has occurred.
-
removeAddon
Removes the Add-on by renaming it.- Parameters:
file
- the file- Throws:
FileNotFoundException
- the file not found exceptionIOException
- Signals that an I/O exception has occurred.
-
showManageAddonDialog
public void showManageAddonDialog()Shows Add-on-Manage-Dialog. -
showManageAddonDialog
Shows Add-on-Manage-Dialog. -
showManageAddonDialog
-
getAddons
Gets the all the Add-ons as a list.- Returns:
- the addons
-
process
- Specified by:
process
in interfaceDragAndDropHandler
-
getAddon
-
getDeactivatedAddons
-
addonsLoaded
public static boolean addonsLoaded() -
canProcess
- Specified by:
canProcess
in interfaceDragAndDropHandler
- Parameters:
f
- Input file to be analyzed for compatibility.- Returns:
- True, if this handler might handle the input file. E.g. based on the file extension.
-
hasPriority
public boolean hasPriority()- Specified by:
hasPriority
in interfaceDragAndDropHandler
- Returns:
- True, if the handler should be called before other handlers are executed, which return False.
-
activateAddon
-