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.
9 package eu
.etaxonomy
.taxeditor
.bulkeditor
.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
.model
.common
.IAnnotatableEntity
;
20 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
21 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
22 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
23 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
27 * @created Dec 13, 2010
29 public class SetMarkerFlagOperation
extends AbstractPostTaxonOperation
{
31 private Set
<IAnnotatableEntity
> annotatableEntities
;
32 private MarkerType markerType
;
33 private boolean value
;
35 public SetMarkerFlagOperation(String label
, IUndoContext undoContext
,
36 Set
<IAnnotatableEntity
> annotatableEntities
, MarkerType markerType
, boolean value
,
37 IPostOperationEnabled postOperationEnabled
) {
38 super(label
, undoContext
, postOperationEnabled
);
39 this.annotatableEntities
= annotatableEntities
;
40 this.markerType
= markerType
;
45 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
46 throws ExecutionException
{
48 for(IAnnotatableEntity annotatableEntity
: annotatableEntities
){
49 Marker marker
= Marker
.NewInstance(markerType
, value
);
51 annotatableEntity
.addMarker(marker
);
54 return postExecute(null);
58 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
59 throws ExecutionException
{
60 return execute(monitor
, info
);
64 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
65 throws ExecutionException
{
66 for(IAnnotatableEntity annotatableEntity
: annotatableEntities
){
67 Marker marker
= Marker
.NewInstance(markerType
, ! value
);
69 annotatableEntity
.addMarker(marker
);
72 return postExecute(null);