Revision 0a534d09
Added by Patrick Plitzner over 10 years ago
- adapted sub classes of AbstractPostOperation
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/operation/CreateConceptRelationOperation.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
30 | 30 |
* @version 1.0 |
31 | 31 |
*/ |
32 | 32 |
public class CreateConceptRelationOperation extends AbstractPostTaxonOperation { |
33 |
|
|
34 |
private Taxon concept; |
|
35 |
private TaxonRelationshipTypeInverseContainer taxonRelationshipTypeInverseContainer; |
|
36 |
|
|
33 |
|
|
34 |
private final Taxon concept;
|
|
35 |
private final TaxonRelationshipTypeInverseContainer taxonRelationshipTypeInverseContainer;
|
|
36 |
|
|
37 | 37 |
/** |
38 | 38 |
* <p>Constructor for CreateConceptRelationOperation.</p> |
39 | 39 |
* |
... | ... | |
51 | 51 |
this.concept = concept; |
52 | 52 |
this.taxonRelationshipTypeInverseContainer = taxonRelationshipTypeInverseContainer; |
53 | 53 |
} |
54 |
|
|
54 |
|
|
55 | 55 |
public CreateConceptRelationOperation(String label, |
56 | 56 |
IUndoContext undoContext, Taxon taxon, Taxon concept, TaxonRelationshipType taxonRelationshipType |
57 | 57 |
, IPostOperationEnabled postOperationEnabled) { |
... | ... | |
69 | 69 |
monitor.worked(20); |
70 | 70 |
// add concept to taxon |
71 | 71 |
if(taxonRelationshipTypeInverseContainer.isInverse()){ |
72 |
concept.addTaxonRelation(taxon, taxonRelationshipTypeInverseContainer.getType(), null, null);
|
|
72 |
concept.addTaxonRelation(element, taxonRelationshipTypeInverseContainer.getType(), null, null);
|
|
73 | 73 |
} else { |
74 |
taxon.addTaxonRelation(concept, taxonRelationshipTypeInverseContainer.getType(), null, null);
|
|
74 |
element.addTaxonRelation(concept, taxonRelationshipTypeInverseContainer.getType(), null, null);
|
|
75 | 75 |
} |
76 | 76 |
monitor.worked(40); |
77 |
|
|
77 |
|
|
78 | 78 |
// redraw editor if exists |
79 | 79 |
return postExecute(concept); |
80 | 80 |
} |
... | ... | |
96 | 96 |
@Override |
97 | 97 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info) |
98 | 98 |
throws ExecutionException { |
99 |
|
|
100 |
taxon.removeTaxon(concept, taxonRelationshipTypeInverseContainer.getType());
|
|
101 |
|
|
99 |
|
|
100 |
element.removeTaxon(concept, taxonRelationshipTypeInverseContainer.getType());
|
|
101 |
|
|
102 | 102 |
// redraw editor if exists |
103 | 103 |
return postExecute(null); |
104 | 104 |
} |
Also available in: Unified diff