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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
createFile(org.eclipse.swt.widgets.Shell shell, java.lang.String label, org.eclipse.core.resources.IContainer folder, PropCnr cnr, java.lang.String fileName, boolean doOverwrite)
Creates a resource file for a property with undo support.static java.lang.String
createFile(org.eclipse.swt.widgets.Shell shell, java.lang.String label, org.eclipse.core.resources.IContainer folder, PropCnr cnr, java.lang.String fileName, boolean doOverwrite, boolean showErrorDialog)
Creates a resource file for a property with undo support.static java.lang.String
createResources(org.eclipse.swt.widgets.Shell shell, java.lang.String label, DesignerProp parent, GProp<?>[] props, java.lang.String[] names)
Creates the resources for the list of properties in the specified property.static java.lang.String
createResources(org.eclipse.swt.widgets.Shell shell, java.lang.String label, DesignerProp parent, GProp<?>[] props, java.lang.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.
Method Detail
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 java.lang.String createResources(org.eclipse.swt.widgets.Shell shell, java.lang.String label, DesignerProp parent, GProp<?>[] props, java.lang.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 java.lang.String createResources(org.eclipse.swt.widgets.Shell shell, java.lang.String label, DesignerProp parent, GProp<?>[] props, java.lang.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 java.lang.String createFile(org.eclipse.swt.widgets.Shell shell, java.lang.String label, org.eclipse.core.resources.IContainer folder, PropCnr cnr, java.lang.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 java.lang.String createFile(org.eclipse.swt.widgets.Shell shell, java.lang.String label, org.eclipse.core.resources.IContainer folder, PropCnr cnr, java.lang.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.