Class 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
  • 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

      public static AddonManagerPlugin getInstance()
      Returns:
      The Addonmanager instance or null, if no instance was created (e.g. deselected)
    • expandClasspathByJarfile

      public static void expandClasspathByJarfile​(URL[] files)
      Expands the classloader by the Add-on jarfile.
      Parameters:
      files - the files
    • addAddon

      public AddOnInstallResult addAddon​(PluginDescription pd, File f, boolean onStartup)
      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, IOException
      Install Add-on by copying the jarfile and loading it.
      Parameters:
      jardir - the jardir, which must not be the add-on directory
      jarname - the jarname of the add-on
      Throws:
      FileNotFoundException - the file not found exception
      IOException - Signals that an I/O exception has occurred.
    • removeAddon

      public void removeAddon​(File file) throws FileNotFoundException, IOException
      Removes the Add-on by renaming it.
      Parameters:
      file - the file
      Throws:
      FileNotFoundException - the file not found exception
      IOException - Signals that an I/O exception has occurred.
    • showManageAddonDialog

      public void showManageAddonDialog()
      Shows Add-on-Manage-Dialog.
    • showManageAddonDialog

      public void showManageAddonDialog​(Window parent)
      Shows Add-on-Manage-Dialog.
    • showManageAddonDialog

      public void showManageAddonDialog​(String msg, boolean highlightUpdate)
    • getAddons

      public ArrayList<Addon> getAddons()
      Gets the all the Add-ons as a list.
      Returns:
      the addons
    • process

      public boolean process​(List<File> files)
      Specified by:
      process in interface DragAndDropHandler
    • getAddon

      public Addon getAddon​(int number)
    • getDeactivatedAddons

      public Collection<String> getDeactivatedAddons()
    • addonsLoaded

      public static boolean addonsLoaded()
    • canProcess

      public boolean canProcess​(File f)
      Specified by:
      canProcess in interface DragAndDropHandler
      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 interface DragAndDropHandler
      Returns:
      True, if the handler should be called before other handlers are executed, which return False.
    • activateAddon

      public boolean activateAddon​(String name)