-// $Id$\r
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-\r
-package eu.etaxonomy.taxeditor.operations;\r
-\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.core.commands.operations.IUndoContext;\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.eclipse.core.runtime.IStatus;\r
-\r
-import eu.etaxonomy.cdm.api.utility.ImagesUtility;\r
-import eu.etaxonomy.cdm.model.description.DescriptionBase;\r
-import eu.etaxonomy.cdm.model.media.ImageFile;\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-\r
-/**\r
- * @author p.ciardelli\r
- * @created 31.03.2009\r
- * @version 1.0\r
- */\r
-public class CreateImageOperation extends AbstractPostOperation {\r
- \r
- private ImageFile imageFile;\r
-\r
- private DescriptionBase<?> description;\r
-\r
- /**\r
- * @param text\r
- * @param undoContext\r
- * @param taxon\r
- * @param url\r
- */\r
- public CreateImageOperation(String label, IUndoContext undoContext,\r
- Taxon taxon, DescriptionBase<?> description, ImageFile imageFile, IPostOperationEnabled postOperationEnabled) {\r
- super(label, undoContext, taxon, postOperationEnabled);\r
- this.imageFile = imageFile;\r
- this.description = description;\r
- }\r
-\r
- public CreateImageOperation(String label, IUndoContext undoContext,\r
- Taxon taxon, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {\r
- super(label, undoContext, taxon, postOperationEnabled);\r
- this.description = description;\r
- }\r
- \r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
- */\r
- @Override\r
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- \r
- if (imageFile == null) {\r
- imageFile = ImageFile.NewInstance(null, null);\r
- }\r
- monitor.worked(20);\r
-\r
- ImagesUtility.addTaxonImage(taxon, description, imageFile);\r
- monitor.worked(40);\r
-\r
- return postExecute(imageFile);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
- */\r
- @Override\r
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- \r
- ImagesUtility.addTaxonImage(taxon, description, imageFile);\r
- \r
- return postExecute(imageFile);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
- */\r
- @Override\r
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- \r
- ImagesUtility.removeTaxonImage(taxon, description, imageFile);\r
- \r
- return postExecute(null);\r
- }\r
-\r
-\r
-}\r
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.operations;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+
+import eu.etaxonomy.cdm.api.utility.ImagesUtility;
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.media.ImageFile;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+
+/**
+ * <p>CreateImageOperation class.</p>
+ *
+ * @author p.ciardelli
+ * @created 31.03.2009
+ * @version 1.0
+ */
+public class CreateImageOperation extends AbstractPostOperation {
+
+ private ImageFile imageFile;
+
+ private DescriptionBase<?> description;
+
+ /**
+ * <p>Constructor for CreateImageOperation.</p>
+ *
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+ * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
+ * @param label a {@link java.lang.String} object.
+ * @param description a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object.
+ * @param imageFile a {@link eu.etaxonomy.cdm.model.media.ImageFile} object.
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
+ */
+ public CreateImageOperation(String label, IUndoContext undoContext,
+ Taxon taxon, DescriptionBase<?> description, ImageFile imageFile, IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, taxon, postOperationEnabled);
+ this.imageFile = imageFile;
+ this.description = description;
+ }
+
+ /**
+ * <p>Constructor for CreateImageOperation.</p>
+ *
+ * @param label a {@link java.lang.String} object.
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+ * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
+ * @param description a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object.
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
+ */
+ public CreateImageOperation(String label, IUndoContext undoContext,
+ Taxon taxon, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, taxon, postOperationEnabled);
+ this.description = description;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ if (imageFile == null) {
+ imageFile = ImageFile.NewInstance(null, null);
+ }
+ monitor.worked(20);
+
+ ImagesUtility.addTaxonImage(taxon, description, imageFile);
+ monitor.worked(40);
+
+ return postExecute(imageFile);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ ImagesUtility.addTaxonImage(taxon, description, imageFile);
+
+ return postExecute(imageFile);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ ImagesUtility.removeTaxonImage(taxon, description, imageFile);
+
+ return postExecute(null);
+ }
+
+
+}