Class CreateResourcesFromProperties

java.lang.Object
org.eclipse.core.commands.operations.AbstractOperation
com.iizigo.editor.CreateResourcesFromProperties
All Implemented Interfaces:
IUndoableOperation

public class CreateResourcesFromProperties extends AbstractOperation
Class used to create resources from properties, with undo support.
Author:
Christopher Mindus
  • Method Details

    • execute

      public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
      Execute the operation. This method should only be called the first time that an operation is executed.
      Specified by:
      execute in interface IUndoableOperation
      Specified by:
      execute in class AbstractOperation
      Parameters:
      monitor - The progress monitor (or null) to use for reporting progress to the user.
      info - The IAdaptable (or null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not null, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.
      Returns:
      the IStatus of the execution. The status severity should be set to OK if the operation was successful, and ERROR if it was not. Any other status is assumed to represent an incompletion of the execution.
      Throws:
      ExecutionException - Tf an exception occurred during execution.
    • redo

      public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
      Redo the operation. This method should only be called after an operation has been undone.
      Specified by:
      redo in interface IUndoableOperation
      Specified by:
      redo in class AbstractOperation
      Parameters:
      monitor - The progress monitor (or null) to use for reporting progress to the user.
      info - The IAdaptable (or null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not null, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.
      Returns:
      The IStatus of the redo. The status severity should be set to OK if the redo was successful, and ERROR if it was not. Any other status is assumed to represent an incompletion of the redo.
      Throws:
      ExecutionException - If an exception occurred during redo.
    • undo

      public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
      Undo the operation. This method should only be called after an operation has been executed.
      Specified by:
      undo in interface IUndoableOperation
      Specified by:
      undo in class AbstractOperation
      Parameters:
      monitor - The progress monitor (or null) to use for reporting progress to the user.
      info - The IAdaptable (or null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not null, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.
      Returns:
      The IStatus of the undo. The status severity should be set to OK if the redo was successful, and ERROR if it was not. Any other status is assumed to represent an incompletion of the undo.
      Throws:
      ExecutionException - If an exception occurred during undo.
    • createResources

      public static String createResources(Shell shell, String label, DesignerProp parent, GProp<?>[] props, String[] names)
      Creates the resources for the list of properties in the specified property.
      Parameters:
      shell - The shell.
      parent - The parent property.
      props - The properties to create.
      names - The new (or existing) names of the properties.
      Returns:
      null for OK, otherwise an error message.
    • createResources

      public static String createResources(Shell shell, String label, DesignerProp parent, GProp<?>[] props, String[] names, boolean showErrorDialog)
      Creates the resources for the list of properties in the specified property.
      Parameters:
      shell - The shell.
      label - The label of the operation.
      parent - The parent property.
      props - The properties to create.
      names - The new (or existing) names of the properties.
      showErrorDialog - Flag to show an error dialog or not.
      Returns:
      null for OK, otherwise an error message.
    • createFile

      public static String createFile(Shell shell, String label, IContainer folder, PropCnr cnr, String fileName, boolean doOverwrite)
      Creates a resource file for a property with undo support.
      Parameters:
      shell - The shell.
      label - Label for operation.
      folder - Folder to place file.
      cnr - The property container.
      fileName - The file name relative the folder.
      doOverwrite - Overwrite allowed flag.
      Returns:
      An error message, or null for success.
    • createFile

      public static String createFile(Shell shell, String label, IContainer folder, PropCnr cnr, String fileName, boolean doOverwrite, boolean showErrorDialog)
      Creates a resource file for a property with undo support.
      Parameters:
      shell - The shell.
      label - Label for operation.
      folder - Folder to place file.
      cnr - The property container.
      fileName - The file name relative the folder.
      doOverwrite - Overwrite allowed flag.
      showErrorDialog - Flag to show an error dialog or not.
      Returns:
      An error message, or null for success.