3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.editor
.view
.media
.operation
;
13 import org
.eclipse
.core
.commands
.ExecutionException
;
14 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
15 import org
.eclipse
.core
.runtime
.IAdaptable
;
16 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
17 import org
.eclipse
.core
.runtime
.IStatus
;
19 import eu
.etaxonomy
.cdm
.api
.utility
.ImagesUtility
;
20 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionBase
;
21 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
22 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
23 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
26 * <p>DeleteMediaOperation class.</p>
32 @Deprecated // I don't think this is really used anymore
33 public class DeleteMediaOperation
extends AbstractPostTaxonOperation
{
37 private DescriptionBase
<?
> description
;
40 * <p>Constructor for DeleteMediaOperation.</p>
42 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
43 * @param label a {@link java.lang.String} object.
44 * @param description a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object.
45 * @param media a {@link eu.etaxonomy.cdm.model.media.Media} object.
46 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
48 public DeleteMediaOperation(String label
, IUndoContext undoContext
,
49 DescriptionBase
<?
> description
, Media media
, IPostOperationEnabled postOperationEnabled
) {
50 super(label
, undoContext
, postOperationEnabled
);
53 this.description
= description
;
57 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
61 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
62 throws ExecutionException
{
65 ImagesUtility
.removeMediaFromGallery(description
, media
);
68 return postExecute(null);
72 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
76 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
77 throws ExecutionException
{
78 return execute(monitor
, info
);
82 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
86 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
87 throws ExecutionException
{
89 ImagesUtility
.addMediaToGallery(description
, media
);
91 return postExecute(null);