/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
/**
- * <p>AddMediaToImageGalleryOperation class.</p>
+ * This operation creates a new {@link Media} and adds it to the currently selected {@link DescriptionBase}.
*
* @author p.ciardelli
* @author n.hoffmann
* @version 1.0
*/
public class AddMediaToImageGalleryOperation extends AbstractPostTaxonOperation {
-
- private DescriptionBase description;
+
+ private final DescriptionBase<?> description;
private Media media;
/**
* @param description a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object.
*/
public AddMediaToImageGalleryOperation(String label,
- IUndoContext undoContext, DescriptionBase description, IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, postOperationEnabled);
+ IUndoContext undoContext, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
+ this(null, label, undoContext, description, postOperationEnabled);
+ media = Media.NewInstance();
+ }
+
+ protected AddMediaToImageGalleryOperation(Media media, String label,
+ IUndoContext undoContext, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, postOperationEnabled);
- this.description = description;
- media = Media.NewInstance();
+ this.description = description;
+ this.media = media;
}
/* (non-Javadoc)
throws ExecutionException {
monitor.worked(20);
-
+
ImagesUtility.addMediaToGallery(description, media);
-
+
monitor.worked(40);
-
+
return postExecute(media);
}