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.
10 package eu
.etaxonomy
.taxeditor
.bulkeditor
.operation
;
14 import org
.eclipse
.core
.commands
.ExecutionException
;
15 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
16 import org
.eclipse
.core
.runtime
.IAdaptable
;
17 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
18 import org
.eclipse
.core
.runtime
.IStatus
;
20 import eu
.etaxonomy
.cdm
.model
.common
.IAnnotatableEntity
;
21 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
22 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
23 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
24 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
28 * @created Dec 13, 2010
31 public class SetMarkerFlagOperation
extends AbstractPostTaxonOperation
{
33 private Set
<IAnnotatableEntity
> annotatableEntities
;
34 private MarkerType markerType
;
35 private boolean value
;
40 * @param postOperationEnabled
42 public SetMarkerFlagOperation(String label
, IUndoContext undoContext
,
43 Set
<IAnnotatableEntity
> annotatableEntities
, MarkerType markerType
, boolean value
,
44 IPostOperationEnabled postOperationEnabled
) {
45 super(label
, undoContext
, postOperationEnabled
);
46 this.annotatableEntities
= annotatableEntities
;
47 this.markerType
= markerType
;
52 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
55 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
56 throws ExecutionException
{
58 for(IAnnotatableEntity annotatableEntity
: annotatableEntities
){
59 Marker marker
= Marker
.NewInstance(markerType
, value
);
61 annotatableEntity
.addMarker(marker
);
64 return postExecute(null);
68 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
71 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
72 throws ExecutionException
{
73 return execute(monitor
, info
);
77 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
80 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
81 throws ExecutionException
{
82 for(IAnnotatableEntity annotatableEntity
: annotatableEntities
){
83 Marker marker
= Marker
.NewInstance(markerType
, ! value
);
85 annotatableEntity
.addMarker(marker
);
88 return postExecute(null);