Package com.iizigo.editor
Class CreateResourcesFromProperties
java.lang.Object
org.eclipse.core.commands.operations.AbstractOperation
com.iizigo.editor.CreateResourcesFromProperties
- All Implemented Interfaces:
org.eclipse.core.commands.operations.IUndoableOperation
public class CreateResourcesFromProperties extends org.eclipse.core.commands.operations.AbstractOperation
Class used to create resources from properties, with undo support.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionstatic String
createFile
(org.eclipse.swt.widgets.Shell shell, String label, org.eclipse.core.resources.IContainer folder, PropCnr cnr, String fileName, boolean doOverwrite) Creates a resource file for a property with undo support.static String
createFile
(org.eclipse.swt.widgets.Shell shell, String label, org.eclipse.core.resources.IContainer folder, PropCnr cnr, String fileName, boolean doOverwrite, boolean showErrorDialog) Creates a resource file for a property with undo support.static String
createResources
(org.eclipse.swt.widgets.Shell shell, String label, DesignerProp parent, GProp<?>[] props, String[] names) Creates the resources for the list of properties in the specified property.static String
createResources
(org.eclipse.swt.widgets.Shell shell, String label, DesignerProp parent, GProp<?>[] props, String[] names, boolean showErrorDialog) Creates the resources for the list of properties in the specified property.org.eclipse.core.runtime.IStatus
execute
(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) Execute the operation.org.eclipse.core.runtime.IStatus
redo
(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) Redo the operation.org.eclipse.core.runtime.IStatus
undo
(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) Undo the operation.Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation
addContext, canExecute, canRedo, canUndo, dispose, getContexts, getLabel, hasContext, removeContext, setLabel, toString
Method Details
execute
public org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException Execute the operation. This method should only be called the first time that an operation is executed.- Specified by:
execute
in interfaceorg.eclipse.core.commands.operations.IUndoableOperation
- Specified by:
execute
in classorg.eclipse.core.commands.operations.AbstractOperation
- Parameters:
monitor
- The progress monitor (ornull
) to use for reporting progress to the user.info
- The IAdaptable (ornull
) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is notnull
, 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, andERROR
if it was not. Any other status is assumed to represent an incompletion of the execution. - Throws:
org.eclipse.core.commands.ExecutionException
- Tf an exception occurred during execution.
redo
public org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException Redo the operation. This method should only be called after an operation has been undone.- Specified by:
redo
in interfaceorg.eclipse.core.commands.operations.IUndoableOperation
- Specified by:
redo
in classorg.eclipse.core.commands.operations.AbstractOperation
- Parameters:
monitor
- The progress monitor (ornull
) to use for reporting progress to the user.info
- The IAdaptable (ornull
) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is notnull
, 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, andERROR
if it was not. Any other status is assumed to represent an incompletion of the redo. - Throws:
org.eclipse.core.commands.ExecutionException
- If an exception occurred during redo.
undo
public org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException Undo the operation. This method should only be called after an operation has been executed.- Specified by:
undo
in interfaceorg.eclipse.core.commands.operations.IUndoableOperation
- Specified by:
undo
in classorg.eclipse.core.commands.operations.AbstractOperation
- Parameters:
monitor
- The progress monitor (ornull
) to use for reporting progress to the user.info
- The IAdaptable (ornull
) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is notnull
, 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, andERROR
if it was not. Any other status is assumed to represent an incompletion of the undo. - Throws:
org.eclipse.core.commands.ExecutionException
- If an exception occurred during undo.
createResources
public static String createResources(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.Shell shell, String label, org.eclipse.core.resources.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(org.eclipse.swt.widgets.Shell shell, String label, org.eclipse.core.resources.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.