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
.bulkeditor
.operation
;
15 import org
.eclipse
.core
.commands
.ExecutionException
;
16 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
17 import org
.eclipse
.core
.runtime
.IAdaptable
;
18 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
19 import org
.eclipse
.core
.runtime
.IStatus
;
21 import eu
.etaxonomy
.cdm
.model
.common
.IAnnotatableEntity
;
22 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
23 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
24 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
25 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
29 * @created Dec 13, 2010
32 public class SetMarkerFlagOperation
extends AbstractPostOperation
{
34 private Set
<IAnnotatableEntity
> annotatableEntities
;
35 private MarkerType markerType
;
36 private boolean value
;
41 * @param postOperationEnabled
43 public SetMarkerFlagOperation(String label
, IUndoContext undoContext
,
44 Set
<IAnnotatableEntity
> annotatableEntities
, MarkerType markerType
, boolean value
,
45 IPostOperationEnabled postOperationEnabled
) {
46 super(label
, undoContext
, postOperationEnabled
);
47 this.annotatableEntities
= annotatableEntities
;
48 this.markerType
= markerType
;
53 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
56 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
57 throws ExecutionException
{
59 for(IAnnotatableEntity annotatableEntity
: annotatableEntities
){
60 Marker marker
= Marker
.NewInstance(markerType
, value
);
62 annotatableEntity
.addMarker(marker
);
65 return postExecute(null);
69 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
72 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
73 throws ExecutionException
{
74 return execute(monitor
, info
);
78 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
81 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
82 throws ExecutionException
{
83 for(IAnnotatableEntity annotatableEntity
: annotatableEntities
){
84 Marker marker
= Marker
.NewInstance(markerType
, ! value
);
86 annotatableEntity
.addMarker(marker
);
89 return postExecute(null);