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
.operations
.images
;
15 import org
.apache
.log4j
.Logger
;
16 import org
.eclipse
.core
.commands
.ExecutionException
;
17 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
18 import org
.eclipse
.core
.runtime
.IAdaptable
;
19 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
20 import org
.eclipse
.core
.runtime
.IStatus
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
23 import eu
.etaxonomy
.taxeditor
.editor
.images
.ImagesController
;
24 import eu
.etaxonomy
.taxeditor
.operations
.AbstractEditorOperation
;
31 public class RemoveImageOperation
extends AbstractEditorOperation
{
32 private static final Logger logger
= Logger
33 .getLogger(RemoveImageOperation
.class);
43 public RemoveImageOperation(String label
, IUndoContext undoContext
,
44 Taxon taxon
, URL url
) {
45 super(label
, undoContext
, taxon
);
51 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
54 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
55 throws ExecutionException
{
57 ImagesController
.removeTaxonImageUrl(taxon
, url
);
59 return redrawOpenEditor();
63 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
66 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
67 throws ExecutionException
{
68 return execute(monitor
, info
);
72 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
75 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
76 throws ExecutionException
{
78 ImagesController
.addTaxonImageUrl(taxon
, url
);
80 return redrawOpenEditor();