2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.media
.operation
;
12 import org
.eclipse
.core
.commands
.ExecutionException
;
13 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
14 import org
.eclipse
.core
.runtime
.IAdaptable
;
15 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
16 import org
.eclipse
.core
.runtime
.IStatus
;
18 import eu
.etaxonomy
.cdm
.api
.utility
.ImagesUtility
;
19 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
20 import eu
.etaxonomy
.cdm
.model
.media
.ImageFile
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
22 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
23 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
26 * <p>RemoveImageFromDescriptionElementOperation class.</p>
33 public class RemoveImageFromDescriptionElementOperation
extends AbstractPostTaxonOperation
{
35 private DescriptionElementBase element
;
36 private ImageFile image
;
39 * <p>Constructor for RemoveImageFromDescriptionElementOperation.</p>
41 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
42 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
43 * @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
44 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
45 * @param label a {@link java.lang.String} object.
46 * @param image a {@link eu.etaxonomy.cdm.model.media.ImageFile} object.
48 public RemoveImageFromDescriptionElementOperation(String label
,
49 IUndoContext undoContext
, Taxon taxon
, ImageFile image
,
50 DescriptionElementBase element
, IPostOperationEnabled postOperationEnabled
) {
51 super(label
, undoContext
, taxon
, postOperationEnabled
);
54 this.element
= element
;
58 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
62 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
63 throws ExecutionException
{
66 ImagesUtility
.removeImage(element
, image
);
69 return postExecute(element
);
73 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
77 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
78 throws ExecutionException
{
79 return execute(monitor
, info
);
83 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
87 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
88 throws ExecutionException
{
89 image
= ImagesUtility
.addImagePart(element
);
90 return postExecute(image
);