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
.operations
.name
;
12 import org
.apache
.log4j
.Logger
;
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
.taxon
.Taxon
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
21 import eu
.etaxonomy
.taxeditor
.operations
.AbstractEditorOperation
;
28 public class ChangeConceptRelationOperation
extends AbstractEditorOperation
{
31 private static final Logger logger
= Logger
32 .getLogger(ChangeConceptRelationOperation
.class);
33 private Taxon relatedTaxon
;
34 private TaxonRelationshipType oldRelationshipType
;
35 private TaxonRelationshipType newRelationshipType
;
37 public ChangeConceptRelationOperation(String label
,
38 IUndoContext undoContext
, Taxon taxon
, Taxon relatedTaxon
, TaxonRelationshipType type
) {
39 super(label
, undoContext
, taxon
);
40 this.relatedTaxon
= relatedTaxon
;
41 // this.oldRelationshipType = relatedTaxon.get
42 this.newRelationshipType
= type
;
46 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
49 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
50 throws ExecutionException
{
51 // Remove relatedTaxon and old relationship
52 // FIXME since taxon relationships come in a set, which relationships are we going to delete here?
53 // taxon.removeTaxon(relatedTaxon, oldRelationshipType);
54 // Add new relationship
55 // TODO add microcitation for misapplied name to property sheet
56 relatedTaxon
.addTaxonRelation(taxon
, newRelationshipType
, null, null);
58 return redrawOpenEditor();
62 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
65 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
66 throws ExecutionException
{
67 return execute(monitor
, info
);
71 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
74 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
75 throws ExecutionException
{
76 // see FIXME in execute()
77 logger
.warn("Not implemented yet. See developer documentation for details");