1 |
1 |
/**
|
2 |
2 |
* Copyright (C) 2007 EDIT
|
3 |
|
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy
|
4 |
4 |
* http://www.e-taxonomy.eu
|
5 |
|
*
|
|
5 |
*
|
6 |
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7 |
7 |
* See LICENSE.TXT at the top of this package for the full license terms.
|
8 |
8 |
*/
|
... | ... | |
16 |
16 |
import org.eclipse.core.runtime.IStatus;
|
17 |
17 |
|
18 |
18 |
import eu.etaxonomy.cdm.api.utility.ImagesUtility;
|
19 |
|
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
|
20 |
|
import eu.etaxonomy.cdm.model.media.ImageFile;
|
21 |
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
|
19 |
import eu.etaxonomy.cdm.model.description.DescriptionBase;
|
|
20 |
import eu.etaxonomy.cdm.model.media.Media;
|
22 |
21 |
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
|
23 |
22 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
|
24 |
23 |
|
... | ... | |
31 |
30 |
* @version 1.0
|
32 |
31 |
*/
|
33 |
32 |
public class RemoveImageFromDescriptionElementOperation extends AbstractPostTaxonOperation {
|
34 |
|
|
35 |
|
private DescriptionElementBase element;
|
36 |
|
private ImageFile image;
|
|
33 |
|
|
34 |
private DescriptionBase element;
|
|
35 |
private Media media;
|
37 |
36 |
|
38 |
37 |
/**
|
39 |
38 |
* <p>Constructor for RemoveImageFromDescriptionElementOperation.</p>
|
... | ... | |
43 |
42 |
* @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
|
44 |
43 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
|
45 |
44 |
* @param label a {@link java.lang.String} object.
|
|
45 |
* @param config
|
46 |
46 |
* @param image a {@link eu.etaxonomy.cdm.model.media.ImageFile} object.
|
47 |
47 |
*/
|
48 |
48 |
public RemoveImageFromDescriptionElementOperation(String label,
|
49 |
|
IUndoContext undoContext, Taxon taxon, ImageFile image,
|
50 |
|
DescriptionElementBase element, IPostOperationEnabled postOperationEnabled) {
|
51 |
|
super(label, undoContext, taxon, postOperationEnabled);
|
52 |
|
|
53 |
|
this.image = image;
|
|
49 |
IUndoContext undoContext, Media media,
|
|
50 |
DescriptionBase element, IPostOperationEnabled postOperationEnabled) {
|
|
51 |
super(label, undoContext, postOperationEnabled);
|
|
52 |
|
|
53 |
this.media = media;
|
54 |
54 |
this.element = element;
|
55 |
55 |
}
|
56 |
56 |
|
... | ... | |
63 |
63 |
throws ExecutionException {
|
64 |
64 |
|
65 |
65 |
monitor.worked(20);
|
66 |
|
ImagesUtility.removeImage(element, image);
|
|
66 |
ImagesUtility.removeMediaFromGallery(element, media);
|
67 |
67 |
monitor.worked(40);
|
68 |
68 |
|
69 |
69 |
return postExecute(element);
|
... | ... | |
86 |
86 |
@Override
|
87 |
87 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
|
88 |
88 |
throws ExecutionException {
|
89 |
|
image = ImagesUtility.addImagePart(element);
|
90 |
|
return postExecute(image);
|
|
89 |
ImagesUtility.addMediaToGallery(element, media);
|
|
90 |
return postExecute(media);
|
91 |
91 |
}
|
92 |
92 |
}
|
minor