Class PluginImportTask


  • public class PluginImportTask
    extends NewTaskType
    Unpack an existing plug-in into a task folder.
    Author:
    Chris Jennings
    • Constructor Detail

      • PluginImportTask

        public PluginImportTask()
    • Method Detail

      • getLabel

        public java.lang.String getLabel()
        Description copied from class: NewTaskType
        Returns the localized, human-readable name of this task type.
        Specified by:
        getLabel in class NewTaskType
        Returns:
        the name displayed for this type in the new task dialog
      • getDescription

        public java.lang.String getDescription()
        Description copied from class: NewTaskType
        Returns the localized, human-readable description of this task type as a simple HTML document.
        Overrides:
        getDescription in class NewTaskType
        Returns:
        a description of the task supported by this task type
      • getType

        public java.lang.String getType()
        Description copied from class: NewTaskType
        Returns a string that describes the type of task created by this NewTaskType. The default implementation returns "TASK", the generic task type. Returning "PROJECT" is illegal, because that type is reserved to identify project folders. The type setting of new tasks of this type will be set to the value returned by this method.

        TaskActions often decide whether or not they can be applied to a given file based on the type and/or subtype of the task folder they belong to.

        Note that the type identifier returned by this method does not have to be unique.

        Overrides:
        getType in class NewTaskType
        Returns:
        a non-null string describing the task type
      • importZipFile

        protected static void importZipFile​(java.util.zip.ZipFile zip,
                                            java.io.File parent)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • initializeNewTask

        public boolean initializeNewTask​(Project project,
                                         Task task)
        Description copied from class: NewTaskType
        This method is called when this task type is added to a project. By the time this is called, the task folder will already exist and the type, subtype, and icon settings will be filled in using the values returned from this object, if any.

        The project view will be synchronized with the task after this method returns, so any new files added to the task folder will be detected immediately.

        The default implementation does nothing, which means the user will simply have a new, empty task folder after adding the new task.

        This method should return true if the initialization is successful. If it returns false, or the method throws an exception, then the task folder will be deleted. If an exception was thrown, then a generic error message will be displayed; if the method returns false then it is assumed that the method displayed its own, more specific message.

        Overrides:
        initializeNewTask in class NewTaskType
        Parameters:
        project - the project that the task was added to
        task - the Member that represents the new task's folder
        Returns:
        true if initialization succeeded
      • createTaskFromBundle

        public static Task createTaskFromBundle​(TaskGroup parent,
                                                java.io.File bundleFile)
        Converts a bundle into a task folder by unpacking the contents of the bundle archive.
        Parameters:
        parent - the parent that holds the new task
        bundleFile - the bundle file to convert into a task
        Returns:
        the task if conversion was a success, or null if it failed