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
.cdm
.model
.taxon
.Taxon
;
22 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
23 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
25 * <p>AddMediaToImageGalleryOperation class.</p>
32 public class AddMediaToImageGalleryOperation
extends AbstractPostOperation
{
34 private DescriptionBase description
;
38 * <p>Constructor for AddMediaToImageGalleryOperation.</p>
40 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
41 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
42 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
43 * @param label a {@link java.lang.String} object.
44 * @param description a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object.
46 public AddMediaToImageGalleryOperation(String label
,
47 IUndoContext undoContext
, Taxon taxon
,
48 DescriptionBase description
, IPostOperationEnabled postOperationEnabled
) {
49 super(label
, undoContext
, taxon
, postOperationEnabled
);
51 this.description
= description
;
52 media
= Media
.NewInstance();
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
{
65 ImagesUtility
.addMediaToGallery(description
, media
);
69 return postExecute(media
);
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 ImagesUtility
.removeMediaFromGallery(description
, media
);
90 return postExecute(description
);