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
.DescriptionBase
;
20 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
21 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
22 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
25 * <p>DeleteMediaOperation class.</p>
31 public class DeleteMediaOperation
extends AbstractPostTaxonOperation
{
33 private final Media media
;
35 private final DescriptionBase
<?
> description
;
38 * <p>Constructor for DeleteMediaOperation.</p>
40 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
41 * @param label a {@link java.lang.String} object.
42 * @param description a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object.
43 * @param media a {@link eu.etaxonomy.cdm.model.media.Media} object.
44 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
46 public DeleteMediaOperation(String label
, IUndoContext undoContext
,
47 DescriptionBase
<?
> description
, Media media
, IPostOperationEnabled postOperationEnabled
) {
48 super(label
, undoContext
, postOperationEnabled
);
51 this.description
= description
;
55 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
59 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
60 throws ExecutionException
{
63 ImagesUtility
.removeMediaFromGallery(description
, media
);
66 return postExecute(null);
70 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
74 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
75 throws ExecutionException
{
76 return execute(monitor
, info
);
80 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
84 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
85 throws ExecutionException
{
87 ImagesUtility
.addMediaToGallery(description
, media
);
89 return postExecute(null);