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 public class DeleteMediaOperation
extends AbstractPostTaxonOperation
{
34 private final Media media
;
36 private final DescriptionBase
<?
> description
;
39 * <p>Constructor for DeleteMediaOperation.</p>
41 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
42 * @param label a {@link java.lang.String} object.
43 * @param description a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object.
44 * @param media a {@link eu.etaxonomy.cdm.model.media.Media} object.
45 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
47 public DeleteMediaOperation(String label
, IUndoContext undoContext
,
48 DescriptionBase
<?
> description
, Media media
, IPostOperationEnabled postOperationEnabled
) {
49 super(label
, undoContext
, postOperationEnabled
);
52 this.description
= description
;
56 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
60 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
61 throws ExecutionException
{
64 ImagesUtility
.removeMediaFromGallery(description
, media
);
67 return postExecute(null);
71 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
75 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
76 throws ExecutionException
{
77 return execute(monitor
, info
);
81 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
85 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
86 throws ExecutionException
{
88 ImagesUtility
.addMediaToGallery(description
, media
);
90 return postExecute(null);