Project

General

Profile

« Previous | Next » 

Revision 0a534d09

Added by Patrick Plitzner over 10 years ago

  • adapted sub classes of AbstractPostOperation

View differences:

.gitattributes
1191 1191
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTeamWizard.java -text
1192 1192
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewUserWizard.java -text
1193 1193
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/PolytomousKeyWizardPage.java -text
1194
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractDescriptionPostOperation.java -text
1194 1195
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPersistentPostOperation.java -text
1195
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostDescribableOperation.java -text
1196 1196
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java -text
1197 1197
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java -text
1198 1198
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/IPostOperationEnabled.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptRelationshipTypeOperation.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
*/
......
32 32
 * @version 1.0
33 33
 */
34 34
public class ChangeConceptRelationshipTypeOperation extends AbstractPostTaxonOperation {
35
	
35

  
36 36
	private Taxon relatedTaxon;
37
	
37

  
38 38
	private TaxonRelationship taxonRelationship;
39
	
39

  
40 40
	private TaxonRelationshipType oldRelationshipType;
41
	
41

  
42 42
	private TaxonRelationshipType newRelationshipType;
43 43

  
44 44
	/**
......
55 55
			IUndoContext undoContext, Taxon taxon, Taxon relatedTaxon, TaxonRelationshipType type, IPostOperationEnabled postOperationEnabled) {
56 56
		super(label, undoContext, taxon, postOperationEnabled);
57 57
		this.relatedTaxon = relatedTaxon;
58
				
58

  
59 59
		Set<TaxonRelationship> taxonRelationships = taxon.getTaxonRelations(relatedTaxon);
60
		
60

  
61 61
		if(taxonRelationships.size() > 1){
62 62
			StoreUtil.warningDialog("Multiple relations between taxa", this, "There are multiple relations between the " +
63 63
					"accepted and the related taxon. This case is not handled by the software yet");
64 64
			return;
65 65
		}
66
		
66

  
67 67
		this.taxonRelationship = taxonRelationships.iterator().next();
68 68
		this.oldRelationshipType = taxonRelationship.getType();
69 69
		this.newRelationshipType = type;
70 70
	}
71
	
71

  
72 72
	/* (non-Javadoc)
73 73
	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
74 74
	 */
......
76 76
	@Override
77 77
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
78 78
			throws ExecutionException {
79
		
79

  
80 80
		// Remove relatedTaxon and old relationship
81 81
		// FIXME since taxon relationships come in a set, which relationships are we going to delete here?
82
		taxon.removeTaxon(relatedTaxon, oldRelationshipType);
82
	    element.removeTaxon(relatedTaxon, oldRelationshipType);
83 83
		monitor.worked(20);
84
        
84

  
85 85
        // Add new relationship
86 86
		// TODO add microcitation for misapplied name to property sheet
87
		relatedTaxon.addTaxonRelation(taxon, newRelationshipType, null, null);	
87
		relatedTaxon.addTaxonRelation(element, newRelationshipType, null, null);
88 88
		monitor.worked(40);
89
		
89

  
90 90
		return postExecute(relatedTaxon);
91 91
	}
92 92

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperation.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
*/
......
37 37
 */
38 38
public class ChangeConceptToSynonymOperation extends
39 39
		AbstractPostTaxonOperation {
40
	
40

  
41 41
	private Taxon concept;
42 42

  
43 43
	private HomotypicalGroup homotypicalGroup;
44 44

  
45 45
	private TaxonRelationship taxonRelationship;
46 46
	private TaxonRelationshipType oldRelationshipType;
47
	
47

  
48 48
	private SynonymRelationship newSynonymRelationship;
49 49

  
50 50
	/**
......
61 61
			IUndoContext undoContext, Taxon taxon, Taxon concept, HomotypicalGroup homotypicalGroup,
62 62
			IPostOperationEnabled editor) {
63 63
		super(label, undoContext, taxon, editor);
64
		
64

  
65 65
		Set<TaxonRelationship> taxonRelationships = taxon.getTaxonRelations(concept);
66
		
66

  
67 67
		if(taxonRelationships.size() > 1){
68 68
			StoreUtil.warningDialog("Multiple relations between taxa", this, "There are multiple relations between the " +
69 69
					"accepted and the related taxon. This case is not handled by the software yet");
70 70
			return;
71 71
		}
72
		
72

  
73 73
		this.taxonRelationship = taxonRelationships.iterator().next();
74 74
		this.oldRelationshipType = taxonRelationship.getType();
75
		
75

  
76 76
		this.concept = concept;
77 77
		this.homotypicalGroup = homotypicalGroup != null ? homotypicalGroup : HomotypicalGroup.NewInstance();
78 78
	}
......
84 84
	@Override
85 85
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
86 86
			throws ExecutionException {
87
		
87

  
88 88
		// Create new synonym using concept name
89 89
		TaxonNameBase<?, ?> synonymName = concept.getName();
90
		
90

  
91 91
		// Remove concept relation from taxon
92
		taxon.removeTaxon(concept, oldRelationshipType);
92
		element.removeTaxon(concept, oldRelationshipType);
93 93
		monitor.worked(20);
94
        
94

  
95 95
		// Add name to new homotypic group
96 96
		homotypicalGroup.addTypifiedName(synonymName);
97 97
		monitor.worked(40);
98
		
98

  
99 99
        // Create a new synonym for the taxon
100
		newSynonymRelationship = taxon.addHeterotypicSynonymName(synonymName);
101
			
100
		newSynonymRelationship = element.addHeterotypicSynonymName(synonymName);
101

  
102 102
		return postExecute(newSynonymRelationship.getSynonym());
103 103
	}
104 104

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperation.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
*/
......
35 35
	/**
36 36
	 * The synonym to be moved.
37 37
	 */
38
	private Synonym synonym; 
38
	private final Synonym synonym;
39 39
	/**
40 40
	 * The former homotypical group the synonym belonged to
41 41
	 */
42
	private HomotypicalGroup oldHomotypicalGroup;
42
	private final HomotypicalGroup oldHomotypicalGroup;
43 43
	/**
44 44
	 * The homotypical group the synonym is to be moved to
45 45
	 */
46
	private HomotypicalGroup newHomotypicalGroup;
47
	
46
	private final HomotypicalGroup newHomotypicalGroup;
47

  
48 48
	/**
49 49
	 * <p>Constructor for ChangeHomotypicGroupOperation.</p>
50 50
	 *
......
55 55
	 * @param newHomotypicalGroup a {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup} object.
56 56
	 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
57 57
	 */
58
	public ChangeHomotypicGroupOperation(String label, IUndoContext undoContext, 
58
	public ChangeHomotypicGroupOperation(String label, IUndoContext undoContext,
59 59
			Taxon taxon, Synonym synonym, HomotypicalGroup newHomotypicalGroup, IPostOperationEnabled postOperationEnabled) {
60 60
		super(label, undoContext, taxon, postOperationEnabled);
61
		
61

  
62 62
		this.synonym = synonym;
63 63
		if(synonym == null){
64 64
			throw new IllegalArgumentException(
65 65
					"A null synonym was provided.");
66 66
		}
67
		
67

  
68 68
		this.oldHomotypicalGroup = synonym.getHomotypicGroup();
69 69
		this.newHomotypicalGroup = newHomotypicalGroup != null ? newHomotypicalGroup : HomotypicalGroup.NewInstance();
70 70
	}
......
76 76
	@Override
77 77
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
78 78
			throws ExecutionException {
79
		
79

  
80 80
    	// Get synonym name
81 81
		TaxonNameBase<?, ?> synonymName = synonym.getName();
82 82
		monitor.worked(20);
83
        
83

  
84 84
		// TODO pass in homotypical group's taxon in case we are dragging from one editor to another
85
		
85

  
86 86
		// Switch groups
87 87
		oldHomotypicalGroup.removeTypifiedName(synonymName);
88 88
		monitor.worked(40);
89 89

  
90 90
		newHomotypicalGroup.addTypifiedName(synonymName);
91
		
92
		if(! synonym.getAcceptedTaxa().contains(taxon)){
91

  
92
		if(! synonym.getAcceptedTaxa().contains(element)){
93 93
			for(Taxon acceptedTaxon : synonym.getAcceptedTaxa()){
94 94
				acceptedTaxon.removeSynonym(synonym);
95 95
			}
96
			
96

  
97 97
			SynonymRelationshipType type = SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF();
98
			if(newHomotypicalGroup.getTypifiedNames().contains(taxon.getName())){
98
			if(newHomotypicalGroup.getTypifiedNames().contains(element.getName())){
99 99
				type = SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF();
100 100
			}
101
			
102
			taxon.addSynonym(synonym, type);
101

  
102
			element.addSynonym(synonym, type);
103 103
		}
104
		
104

  
105 105
		// Redraw editor if it exists
106 106
		return postExecute(synonym);
107 107
	}
......
123 123
	@Override
124 124
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
125 125
			throws ExecutionException {
126
		
126

  
127 127
		// Get synonym name
128 128
		TaxonNameBase<?, ?> synonymName = this.synonym.getName();
129 129
		if(synonymName == null){
130 130
			// TODO
131 131
		}
132
		
132

  
133 133
		// TODO pass in homotypical group's taxon in case we are dragging from one editor to another
134
		
134

  
135 135
		// Switch groups
136 136
		newHomotypicalGroup.removeTypifiedName(synonymName);
137
		oldHomotypicalGroup.addTypifiedName(synonymName);		
138
		
137
		oldHomotypicalGroup.addTypifiedName(synonymName);
138

  
139 139
		// Redraw editor if it exists
140 140
		return postExecute(synonym);
141 141
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToAcceptedTaxonOperation.java
22 22
import eu.etaxonomy.cdm.model.taxon.Synonym;
23 23
import eu.etaxonomy.cdm.model.taxon.Taxon;
24 24
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
25
import eu.etaxonomy.taxeditor.editor.EditorUtil;
25
import eu.etaxonomy.taxeditor.model.AbstractUtility;
26 26
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
27 27
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
28 28
import eu.etaxonomy.taxeditor.store.CdmStore;
29
import eu.etaxonomy.taxeditor.store.StoreUtil;
30 29

  
31 30
/**
32 31
 * Change the taxonomic parent of a given taxon.
......
38 37
public class ChangeSynonymToAcceptedTaxonOperation extends AbstractPersistentPostOperation {
39 38

  
40 39
	private Taxon newTaxon;
41
	private Synonym synonym;
42
	private ITaxonTreeNode parentNode;
40
	private final Synonym synonym;
41
	private final ITaxonTreeNode parentNode;
43 42

  
44 43
	private TaxonNode newNode;
45 44

  
46
	private Synonym[] synonymsInHomotypicalGroup;
45
	private final Synonym[] synonymsInHomotypicalGroup;
47 46

  
48 47
	/**
49 48
	 * <p>Constructor for ChangeSynonymToAcceptedTaxonOperation.</p>
......
61 60
			Taxon taxon, ITaxonTreeNode parentNode, Synonym synonym, Synonym[] synonymsInHomotypicalGroup, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
62 61
		super(label, undoContext, postOperationEnabled, conversationEnabled);
63 62

  
64
		this.taxon = taxon;
63
		this.element = taxon;
65 64
		this.parentNode = parentNode;
66 65
		this.synonym = synonym;
67 66
		this.synonymsInHomotypicalGroup = synonymsInHomotypicalGroup;
......
76 75
			throws ExecutionException {
77 76

  
78 77
		try {
79
			newTaxon = CdmStore.getService(ITaxonService.class).changeSynonymToAcceptedTaxon(synonym, taxon, true, true, null, null);
78
			newTaxon = CdmStore.getService(ITaxonService.class).changeSynonymToAcceptedTaxon(synonym, element, true, true, null, null);
80 79
		} catch (HomotypicalGroupChangeException e) {
81
			EditorUtil.warningDialog("Operation may lead to inconsistent data", getClass(), e.getMessage());
80
			AbstractUtility.warningDialog("Operation may lead to inconsistent data", getClass(), e.getMessage());
82 81
			return postExecute(null);
83 82
		}
84 83
		monitor.worked(20);
......
117 116
			throws ExecutionException {
118 117

  
119 118
		// TODO implement - biggest problem is that any window open for new taxon must be closed first
120
		StoreUtil.warn(this.getClass(), "Not yet implemented");
119
		AbstractUtility.warn(this.getClass(), "Not yet implemented");
121 120

  
122
		return postExecute(taxon);
121
		return postExecute(element);
123 122
	}
124 123

  
125 124
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToConceptOperation.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
*/
......
32 32
 * @version 1.0
33 33
 */
34 34
public class ChangeSynonymToConceptOperation extends AbstractPostTaxonOperation {
35
	private Synonym synonym;
36
	private TaxonRelationshipType taxonRelationshipType;
37
	
35
	private final Synonym synonym;
36
	private final TaxonRelationshipType taxonRelationshipType;
37

  
38 38
	/**
39 39
	 * <p>Constructor for ChangeSynonymToConceptOperation.</p>
40 40
	 *
......
48 48
	public ChangeSynonymToConceptOperation(String label,
49 49
			IUndoContext undoContext, Taxon taxon, Synonym synonym, TaxonRelationshipType taxonRelationshipType, IPostOperationEnabled postOperationEnabled) {
50 50
		super(label, undoContext, taxon, postOperationEnabled);
51
		
51

  
52 52
		this.taxonRelationshipType = taxonRelationshipType;
53 53
		this.synonym = synonym;
54
		
54

  
55 55
	}
56 56

  
57 57
	/* (non-Javadoc)
......
64 64

  
65 65
//		// Get name from synonym
66 66
//		TaxonNameBase<?, ?> synonymName = synonym.getName();
67
//		
67
//
68 68
//		// remove synonym from taxon
69 69
//		taxon.removeSynonym(synonym);
70
//		
70
//
71 71
//		// Create a taxon with synonym name
72 72
//		Taxon fromTaxon = Taxon.NewInstance(synonymName, null);
73
//		
74
//		// Add taxon relation 
73
//
74
//		// Add taxon relation
75 75
//		fromTaxon.addTaxonRelation(taxon, taxonRelationshipType, null, null);
76 76

  
77 77
		monitor.worked(20);
78
    	Taxon fromTaxon = CdmStore.getService(ITaxonService.class).changeSynonymToRelatedTaxon(synonym, taxon, taxonRelationshipType, null, null);
78
    	Taxon fromTaxon = CdmStore.getService(ITaxonService.class).changeSynonymToRelatedTaxon(synonym, element, taxonRelationshipType, null, null);
79 79
		monitor.worked(40);
80
		
80

  
81 81
//		TaxonRelationshipType.
82 82
//		logger.warn("Not yet implemented.");
83 83

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToMisapplicationOperation.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
*/
......
37 37
 */
38 38
public class ChangeSynonymToMisapplicationOperation extends AbstractPostTaxonOperation {
39 39

  
40
	private Synonym synonym;
40
	private final Synonym synonym;
41 41
	private Taxon misapplication;
42 42
	private Set<SynonymRelationshipType> synonymTypes;
43 43

  
......
53 53
	public ChangeSynonymToMisapplicationOperation(String label,
54 54
			IUndoContext undoContext, Taxon taxon, Synonym synonym, IPostOperationEnabled editor) {
55 55
		super(label, undoContext, taxon, editor);
56
		
56

  
57 57
		this.synonym = synonym;
58 58
	}
59 59

  
......
61 61
	@Override
62 62
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
63 63
			throws ExecutionException {
64
		
64

  
65 65
    	// get name from synonym
66 66
		TaxonNameBase<?, ?> synonymName = synonym.getName();
67 67

  
......
69 69
		misapplication = Taxon.NewInstance(synonymName, null);
70 70
		CdmStore.getService(ITaxonService.class).saveOrUpdate(misapplication);
71 71
		monitor.worked(20);
72
		
72

  
73 73
		// store synonymRelationshipType for later undo operations
74
		synonymTypes = synonym.getRelationType(taxon);
75
		
76
		// remove synonym from taxon		
77
		taxon.removeSynonym(synonym);
74
		synonymTypes = synonym.getRelationType(element);
75

  
76
		// remove synonym from taxon
77
		element.removeSynonym(synonym);
78 78
		monitor.worked(40);
79
		
79

  
80 80
		// add misapplied name to taxon
81 81
		// TODO add microcitation for misapplied name to property sheet (if microcitation is indeed needed?!)
82
		taxon.addMisappliedName(misapplication, null, null);
83
		
82
		element.addMisappliedName(misapplication, null, null);
83

  
84 84
		// redraw editor if exists
85 85
		return postExecute(misapplication);
86 86
	}
......
91 91
			throws ExecutionException {
92 92
		// add misapplied name to taxon
93 93
		// TODO add citation for misapplied name to property sheet
94
		taxon.addMisappliedName(misapplication, null, null);
95
		
94
		element.addMisappliedName(misapplication, null, null);
95

  
96 96
		// remove synonym from taxon
97
		taxon.removeSynonym(synonym);
98
		
97
		element.removeSynonym(synonym);
98

  
99 99
		// redraw editor if exists
100 100
		return postExecute(null);
101 101
	}
......
104 104
	@Override
105 105
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
106 106
			throws ExecutionException {
107
		
107

  
108 108
		// remove misapplied name from taxon
109
		taxon.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
110
		
109
		element.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
110

  
111 111
		// add synonym to taxon
112 112
		for (SynonymRelationshipType synonymType : synonymTypes){
113
			taxon.addSynonym(synonym, synonymType);
113
			element.addSynonym(synonym, synonymType);
114 114
		}
115
		
115

  
116 116
		// redraw editor if exists
117 117
		return postExecute(null);
118 118
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExistingHomotypicalGroupOperation.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
*/
......
32 32
public class CreateSynonymInExistingHomotypicalGroupOperation extends
33 33
		AbstractPostTaxonOperation {
34 34

  
35
	private HomotypicalGroup group;
36
	private TaxonNameBase newSynonymName;
35
	private final HomotypicalGroup group;
36
	private final TaxonNameBase newSynonymName;
37 37

  
38 38
	private SynonymRelationship synonymRelationship;
39
	
39

  
40 40
	/**
41 41
	 * <p>Constructor for CreateSynonymInExistingHomotypicalGroupOperation.</p>
42 42
	 *
......
61 61
	@Override
62 62
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
63 63
			throws ExecutionException {
64
		
64

  
65 65
		// Add name to given homotypic group
66 66
		group.addTypifiedName(newSynonymName);
67 67
		monitor.worked(20);
68
		
68

  
69 69
		// Create a new synonym for the taxon
70 70
		// TODO add citations
71
		if(group.equals(taxon.getHomotypicGroup())){
72
			synonymRelationship = taxon.addHomotypicSynonymName(newSynonymName, null, null);
71
		if(group.equals(element.getHomotypicGroup())){
72
			synonymRelationship = element.addHomotypicSynonymName(newSynonymName, null, null);
73 73
		}else{
74
			synonymRelationship = taxon.addHeterotypicSynonymName(newSynonymName);
74
			synonymRelationship = element.addHeterotypicSynonymName(newSynonymName);
75 75
		}
76 76
		monitor.worked(40);
77
		
77

  
78 78
//		Synonym affectedSynonym = null;
79
//		
79
//
80 80
//		for(Synonym synonym : group.getSynonymsInGroup(taxon.getSec())){
81 81
//			if(synonym.getName() == synonymName){
82 82
//				affectedSynonym = synonym;
83 83
//				break;
84 84
//			}
85 85
//		}
86
		
86

  
87 87
		return postExecute(synonymRelationship.getSynonym());
88 88
	}
89 89

  
......
105 105
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
106 106
			throws ExecutionException {
107 107

  
108
		taxon.removeSynonymRelation(synonymRelationship);
109
		
108
		element.removeSynonymRelation(synonymRelationship);
109

  
110 110
		return postExecute(null);
111 111
	}
112 112
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInNewGroupOperation.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
*/
......
35 35
 * @version 1.0
36 36
 */
37 37
public class CreateSynonymInNewGroupOperation extends AbstractPostTaxonOperation {
38
	
38

  
39 39
	// TODO replace this with TaxonNameBase
40
	private TaxonNameBase newSynonymName;
40
	private final TaxonNameBase newSynonymName;
41 41
	private SynonymRelationship newSynonymRelationship;
42 42

  
43 43
	/**
......
52 52
	public CreateSynonymInNewGroupOperation(String label,
53 53
			IUndoContext undoContext, Taxon taxon, TaxonNameBase newSynonymName, IPostOperationEnabled postOperationEnabled) {
54 54
		super(label, undoContext, taxon, postOperationEnabled);
55
		
55

  
56 56
		this.newSynonymName = newSynonymName;
57 57
	}
58 58

  
......
63 63
	@Override
64 64
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
65 65
			throws ExecutionException {
66
		
66

  
67 67
		// Add name to new homotypic group
68 68
		HomotypicalGroup.NewInstance().addTypifiedName(newSynonymName);
69 69
		monitor.worked(20);
70
		
70

  
71 71
		// Create a new synonym for the taxon
72
		newSynonymRelationship = taxon.addHeterotypicSynonymName(newSynonymName);
72
		newSynonymRelationship = element.addHeterotypicSynonymName(newSynonymName);
73 73
		monitor.worked(40);
74 74

  
75 75
		return postExecute(newSynonymRelationship.getSynonym());
......
92 92
	@Override
93 93
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
94 94
			throws ExecutionException {
95
		
96
		// Remove the synonym 
97
		taxon.removeSynonymRelation(newSynonymRelationship);
95

  
96
		// Remove the synonym
97
		element.removeSynonymRelation(newSynonymRelationship);
98 98
		newSynonymRelationship = null;
99
		
99

  
100 100
		return postExecute(null);
101 101
	}
102 102
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.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 DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
33
	
34
	private Taxon misapplication;
33

  
34
	private final Taxon misapplication;
35 35

  
36 36
	private Reference<?> citation;
37 37

  
......
49 49
	public DeleteMisapplicationOperation(String label, IUndoContext undoContext,
50 50
			Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled) {
51 51
		super(label, undoContext, taxon, postOperationEnabled);
52
		
52

  
53 53
		this.misapplication = misapplication;
54 54
	}
55 55

  
......
62 62
			throws ExecutionException {
63 63

  
64 64
		// Find misapplication relation, save citation information
65
		for (TaxonRelationship relationship : taxon.getTaxonRelations()) {
65
		for (TaxonRelationship relationship : element.getTaxonRelations()) {
66 66
			if (relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())
67 67
					&& relationship.getFromTaxon().equals(misapplication)) {
68 68
				citation = relationship.getCitation();
......
70 70
			}
71 71
		}
72 72
		monitor.worked(20);
73
		
73

  
74 74
		// Remove misapplied name relation from taxon
75
		taxon.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
75
		element.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
76 76
		monitor.worked(40);
77 77

  
78 78
		return postExecute(null);
......
95 95
	@Override
96 96
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
97 97
			throws ExecutionException {
98
		
99
		taxon.addMisappliedName(misapplication, citation, microcitation);
100
		
98

  
99
		element.addMisappliedName(misapplication, citation, microcitation);
100

  
101 101
		return postExecute(misapplication);
102 102
	}
103 103
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.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
*/
......
34 34
 * @version 1.0
35 35
 */
36 36
public class DeleteSynonymOperation extends AbstractPostTaxonOperation {
37
	
38
	private Synonym synonym;
37

  
38
	private final Synonym synonym;
39 39
	private Set<SynonymRelationshipType> synonymTypes;
40 40

  
41 41
	/**
......
60 60
	@Override
61 61
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
62 62
			throws ExecutionException {
63
		
63

  
64 64
		// Store synonymRelationshipType for later undo operations
65
				synonymTypes = synonym.getRelationType(taxon);
65
				synonymTypes = synonym.getRelationType(element);
66 66
				monitor.worked(20);
67
				
67

  
68 68
				// Remove synonym from taxon
69
				
69

  
70 70
				CdmApplicationController controller;
71
				
71

  
72 72
				controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration();
73
				
73

  
74 74
				ITaxonService service = controller.getTaxonService();
75 75
				if (synonym.getId() == 0){
76
					taxon.removeSynonym(synonym);
77
					
76
					element.removeSynonym(synonym);
77

  
78 78
				} else {
79 79
					service.deleteSynonym(synonym, null);
80 80
				}
81 81
			//	taxon.removeSynonym(synonym);
82 82
//				CdmStore.getTaxonService().deleteSynonymRelationships(synonym);
83 83
//				CdmStore.getTaxonService().delete(synonym);
84
				
84

  
85 85
				monitor.worked(40);
86 86

  
87 87
				// Redraw editor if exists
88
				
89
				return postExecute(taxon);
88

  
89
				return postExecute(element);
90 90
	}
91 91

  
92 92
	/* (non-Javadoc)
......
95 95
	/** {@inheritDoc} */
96 96
	@Override
97 97
	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
98
			throws ExecutionException {		
98
			throws ExecutionException {
99 99
		return execute(monitor, info);
100 100
	}
101 101

  
......
106 106
	@Override
107 107
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
108 108
			throws ExecutionException {
109
		
109

  
110 110
		// Add synonym to taxon
111 111
		for (SynonymRelationshipType synonymType : synonymTypes){
112
			taxon.addSynonym(synonym, synonymType);
112
			element.addSynonym(synonym, synonymType);
113 113
		}
114
		
114

  
115 115
		// Redraw editor if exists
116 116
		return postExecute(synonym);
117 117
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java
3 3
import java.util.Iterator;
4 4
import java.util.Set;
5 5

  
6
import org.eclipse.core.commands.ExecutionEvent;
7 6
import org.eclipse.core.commands.ExecutionException;
8 7
import org.eclipse.core.commands.operations.IUndoContext;
9 8
import org.eclipse.core.runtime.IAdaptable;
10 9
import org.eclipse.core.runtime.IProgressMonitor;
11 10
import org.eclipse.core.runtime.IStatus;
12
import org.eclipse.core.runtime.Status;
13
import org.eclipse.ui.IEditorInput;
14
import org.eclipse.ui.IEditorReference;
15
import org.eclipse.ui.IPerspectiveDescriptor;
16
import org.eclipse.ui.IViewPart;
17
import org.eclipse.ui.IViewReference;
18 11
import org.eclipse.ui.IWorkbenchPage;
19
import org.eclipse.ui.PartInitException;
20
import org.eclipse.ui.handlers.HandlerUtil;
21 12

  
22 13
import eu.etaxonomy.cdm.api.application.CdmApplicationController;
23 14
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
......
25 16
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
26 17
import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;
27 18
import eu.etaxonomy.cdm.model.taxon.Classification;
28
import eu.etaxonomy.cdm.model.taxon.Synonym;
29 19
import eu.etaxonomy.cdm.model.taxon.Taxon;
30 20
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
31
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
32
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
33 21
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
34 22
import eu.etaxonomy.taxeditor.store.CdmStore;
35 23

  
36 24
public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{
37 25
	//private Taxon taxon;
38
	private Classification classification;
39
	
40
	
41
	
42
	
26
	private final Classification classification;
27

  
28

  
29

  
30

  
43 31
	public DeleteTaxonOperation(String label, IUndoContext undoContext,
44 32
			Taxon taxon, Classification classification, IWorkbenchPage activePage, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
45 33
		super(label, undoContext, taxon, activePage, postOperationEnabled, conversationEnabled);
46
		this.taxon = taxon;
47
		
34
		this.element = taxon;
35

  
48 36
		Set<TaxonNode> nodes = taxon.getTaxonNodes();
49 37
		if (nodes.size() == 1 && classification == null){
50 38
			this.taxonNode = nodes.iterator().next();
......
60 48
			//TODO
61 49
		}
62 50
		this.classification = classification;
63
		
51

  
64 52
	}
65 53

  
66
	
54

  
67 55

  
68 56
	@Override
69 57
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
70 58
			throws ExecutionException {
71
				
59

  
72 60
				monitor.worked(20);
73 61
				bind();
74
				
75
				
62

  
63

  
76 64
				CdmApplicationController controller;
77
				
65

  
78 66
				controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration();
79
				
67

  
80 68
				ITaxonService service = controller.getTaxonService();
81 69
				try {
82
					
83
					service.deleteTaxon(taxon, new TaxonDeletionConfigurator(), classification);
84
					
70

  
71
					service.deleteTaxon(element, new TaxonDeletionConfigurator(), classification);
72

  
85 73
				} catch (DataChangeNoRollbackException e) {
86 74
					// TODO Auto-generated catch block
87 75
					e.printStackTrace();
88
					
76

  
89 77
				}
90
				
78

  
91 79
				//closeObsoleteEditor(taxon);
92 80
				monitor.worked(40);
93
				
94
				
81

  
82

  
95 83
				return postExecute(null);
96 84
	}
97 85

  
......
108 96
		// TODO Auto-generated method stub
109 97
		return null;
110 98
	}
111
	
112
	
99

  
100

  
113 101
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperation.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
15 15
import org.eclipse.core.runtime.IAdaptable;
16 16
import org.eclipse.core.runtime.IProgressMonitor;
17 17
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.Status;
19 18

  
20 19
import eu.etaxonomy.cdm.api.service.ITaxonService;
21
import eu.etaxonomy.cdm.model.common.CdmBase;
22 20
import eu.etaxonomy.cdm.model.taxon.Synonym;
23 21
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
24 22
import eu.etaxonomy.cdm.model.taxon.Taxon;
25
import eu.etaxonomy.taxeditor.editor.EditorUtil;
26 23
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
27 24
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
28 25
import eu.etaxonomy.taxeditor.store.CdmStore;
......
36 33
 * @version 1.0
37 34
 */
38 35
public class SwapSynonymAndAcceptedOperation extends AbstractPostTaxonOperation {
39
	
40
	private Synonym synonym;
36

  
37
	private final Synonym synonym;
41 38
	// TODO store the old relationship for undo reasons
42 39
	private SynonymRelationshipType synonymRelationshipType;
43
	
40

  
44 41
	/**
45 42
	 * <p>Constructor for SwapSynonymAndAcceptedOperation.</p>
46 43
	 *
......
53 50
	public SwapSynonymAndAcceptedOperation(String label, IUndoContext undoContext,
54 51
			Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled) {
55 52
		super("Swap Synonym And Accepted Taxon Operation", undoContext, taxon, postOperationEnabled);
56
		
53

  
57 54
		this.synonym = synonym;
58 55
	}
59 56

  
......
64 61
	@Override
65 62
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
66 63
			throws ExecutionException {
67
		
64

  
68 65
		monitor.worked(20);
69
		
70
		CdmStore.getService(ITaxonService.class).swapSynonymAndAcceptedTaxon(synonym, taxon);
71
		
66

  
67
		CdmStore.getService(ITaxonService.class).swapSynonymAndAcceptedTaxon(synonym, element);
68

  
72 69
		monitor.worked(40);
73 70

  
74
		return postExecute(taxon);
71
		return postExecute(element);
75 72
	}
76 73

  
77 74
	/* (non-Javadoc)
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
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/operation/DeleteConceptRelationOperation.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
*/
......
31 31
 * @version 1.0
32 32
 */
33 33
public class DeleteConceptRelationOperation extends AbstractPostTaxonOperation {
34
	
35
	private Set<TaxonRelationship> taxonRelationships;	
34

  
35
	private final Set<TaxonRelationship> taxonRelationships;
36 36

  
37 37

  
38 38
	/**
......
45 45
			IUndoContext undoContext, Taxon taxon, Set<TaxonRelationship> relations,
46 46
			IPostOperationEnabled postOperationEnabled) {
47 47
		super(label, undoContext, taxon, postOperationEnabled);
48
		
48

  
49 49
		taxonRelationships = relations;
50 50
	}
51 51

  
......
56 56
	@Override
57 57
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
58 58
			throws ExecutionException {
59
		
59

  
60 60
		monitor.worked(20);
61
		
61

  
62 62
		// Remove relation from taxon
63 63
		for(TaxonRelationship relationship : taxonRelationships){
64
			taxon.removeTaxonRelation(relationship);
64
		    element.removeTaxonRelation(relationship);
65 65
			monitor.worked(10);
66 66
		}
67 67
		monitor.worked(10);
68 68

  
69
		return postExecute(taxon);
69
		return postExecute(element);
70 70
	}
71 71

  
72 72
	/* (non-Javadoc)
......
86 86
	@Override
87 87
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
88 88
			throws ExecutionException {
89
		
89

  
90 90
		for(TaxonRelationship relationship : taxonRelationships){
91
			taxon.addTaxonRelation(relationship);
91
		    element.addTaxonRelation(relationship);
92 92
			monitor.worked(10);
93 93
		}
94
		
95
		return postExecute(taxon);
94

  
95
		return postExecute(element);
96 96
	}
97 97
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.java
124 124
		return featureTree;
125 125
	}
126 126

  
127
	/**
128
	 * Get all descriptions associated with the given TaxonEditorInput
129
	 *
130
	 * @param parentElement
131
	 * @return
132
	 */
133
	protected List<DescriptionBase> getDescriptions(IDescribable<?> parentElement) {
134
	    Set<? extends DescriptionBase<?>> elementDescriptions = parentElement.getDescriptions();
135
		List<DescriptionBase> resultDescriptions = new ArrayList<DescriptionBase>();
136
		for(DescriptionBase description : elementDescriptions){
127
    /**
128
     * Get all descriptions associated with the given object
129
     * @param parentElement
130
     * @return
131
     */
132
    protected List<DescriptionBase> getDescriptions(IDescribable<?> parentElement) {
133
        Set<? extends DescriptionBase> elementDescriptions = parentElement.getDescriptions();
134
        List<DescriptionBase> resultDescriptions = new ArrayList<DescriptionBase>();
135
        for(DescriptionBase description : elementDescriptions){
137 136
			if(! description.isImageGallery()){
138 137
				MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
139 138
				Set<Marker> descriptionMarkers = description.getMarkers();
......
148 147
					resultDescriptions.add(description);
149 148
				}
150 149
			}
151

  
152 150
		}
153
		return resultDescriptions;
154
	}
151
        return resultDescriptions;
152
    }
155 153

  
156 154
	/* (non-Javadoc)
157 155
	 * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
21 21
import org.eclipse.jface.resource.ImageDescriptor;
22 22
import org.eclipse.jface.viewers.ISelection;
23 23
import org.eclipse.jface.viewers.IStructuredSelection;
24
import org.eclipse.jface.viewers.ITreeContentProvider;
24 25
import org.eclipse.jface.viewers.StructuredSelection;
25 26
import org.eclipse.jface.viewers.TreeViewer;
26 27
import org.eclipse.jface.viewers.Viewer;
......
64 65

  
65 66
	protected TreeViewer viewer;
66 67

  
68
	/**
69
	 * Maps {@link FeatureNodeContainerTree} to their corresponding {@link TaxonDescritpion}.<br>
70
	 * This serves as input for the {@link ITreeContentProvider} of the {@link TreeViewer}
71
	 */
67 72
	protected Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache = new HashMap<DescriptionBase<?>, FeatureNodeContainerTree>();
68 73

  
69 74
	protected ToggleDescriptionAction showAllElementsAction;
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateTaxonDescriptionOperation.java
20 20
import eu.etaxonomy.cdm.model.description.TextData;
21 21
import eu.etaxonomy.cdm.model.media.Media;
22 22
import eu.etaxonomy.cdm.model.taxon.Taxon;
23
import eu.etaxonomy.taxeditor.operation.AbstractPostDescribableOperation;
23
import eu.etaxonomy.taxeditor.operation.AbstractDescriptionPostOperation;
24 24
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
25 25

  
26 26
/**
......
31 31
 * @created 05.02.2009
32 32
 * @version 1.0
33 33
 */
34
public class CreateTaxonDescriptionOperation extends AbstractPostDescribableOperation{
34
public class CreateTaxonDescriptionOperation extends AbstractDescriptionPostOperation<Taxon, TaxonDescription>{
35 35

  
36
	private TaxonDescription description;
37
	private boolean isImageGallery;
36
	private final boolean isImageGallery;
38 37

  
39 38
	/**
40 39
	 * <p>Constructor for CreateTaxonDescriptionOperation.</p>
......
59 58
	 * @param isImageGallery a boolean.
60 59
	 */
61 60
	public CreateTaxonDescriptionOperation(String label, IUndoContext undoContext,
62
			Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {
61
	        Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {
63 62
		super(label, undoContext, taxon, postOperationEnabled);
64 63

  
65 64
		this.isImageGallery  = isImageGallery;
......
73 72
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
74 73
			throws ExecutionException {
75 74

  
76
		description = TaxonDescription.NewInstance(taxon);
75
		description = TaxonDescription.NewInstance(element);
77 76
		monitor.worked(20);
78 77

  
79 78
		if(isImageGallery){
......
96 95
	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
97 96
			throws ExecutionException {
98 97

  
99
		describable.addDescription(description);
98
		element.addDescription(description);
100 99

  
101 100
		return postExecute(description);
102 101
	}
......
109 108
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
110 109
			throws ExecutionException {
111 110

  
112
		describable.removeDescription(description);
111
		element.removeDescription(description);
113 112

  
114 113
		return postExecute(null);
115 114
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/DeleteTaxonDescriptionOperation.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
*/
......
28 28
 * @version 1.0
29 29
 */
30 30
public class DeleteTaxonDescriptionOperation extends AbstractPostTaxonOperation {
31
	
32
	private TaxonDescription description;
31

  
32
	private final TaxonDescription description;
33 33

  
34 34
	/**
35 35
	 * <p>Constructor for DeleteTaxonDescriptionOperation.</p>
......
42 42
	public DeleteTaxonDescriptionOperation(String label, IUndoContext undoContext,
43 43
			TaxonDescription description, IPostOperationEnabled postOperationEnabled) {
44 44
		super(label, undoContext, postOperationEnabled);
45
		
45

  
46 46
		this.description = description;
47
		taxon = description.getTaxon();
47
		element = description.getTaxon();
48 48
	}
49 49

  
50 50
	/* (non-Javadoc)
......
56 56
			throws ExecutionException {
57 57

  
58 58
		monitor.worked(20);
59
		taxon.removeDescription(description);
59
		element.removeDescription(description);
60 60
		monitor.worked(40);
61 61

  
62 62
		return postExecute(description);
......
80 80
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
81 81
			throws ExecutionException {
82 82

  
83
		taxon.addDescription(description);
84
		
83
	    element.addDescription(description);
84

  
85 85
		return postExecute(null);
86 86
	}
87 87
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/CreateImageOperation.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
31 31
 * @version 1.0
32 32
 */
33 33
public class CreateImageOperation extends AbstractPostTaxonOperation {
34
	
34

  
35 35
	private ImageFile imageFile;
36 36

  
37
	private DescriptionBase<?> description;
37
	private final DescriptionBase<?> description;
38 38

  
39 39
	/**
40 40
	 * <p>Constructor for CreateImageOperation.</p>
......
67 67
		super(label, undoContext, taxon, postOperationEnabled);
68 68
		this.description = description;
69 69
	}
70
	
70

  
71 71
	/* (non-Javadoc)
72 72
	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
73 73
	 */
......
75 75
	@Override
76 76
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
77 77
			throws ExecutionException {
78
		
78

  
79 79
		if (imageFile == null) {
80 80
			imageFile = ImageFile.NewInstance(null, null);
81 81
		}
82 82
		monitor.worked(20);
83 83

  
84
		ImagesUtility.addTaxonImage(taxon, description, imageFile);
84
		ImagesUtility.addTaxonImage(element, description, imageFile);
85 85
		monitor.worked(40);
86 86

  
87 87
		return postExecute(imageFile);
......
94 94
	@Override
95 95
	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
96 96
			throws ExecutionException {
97
		
98
		ImagesUtility.addTaxonImage(taxon, description, imageFile);
99
		
97

  
98
		ImagesUtility.addTaxonImage(element, description, imageFile);
99

  
100 100
		return postExecute(imageFile);
101 101
	}
102 102

  
......
107 107
	@Override
108 108
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
109 109
			throws ExecutionException {
110
		
111
		ImagesUtility.removeTaxonImage(taxon, description, imageFile);
112
		
110

  
111
		ImagesUtility.removeTaxonImage(element, description, imageFile);
112

  
113 113
		return postExecute(null);
114 114
	}
115 115

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateTaxonUseOperation.java
1 1
/**
2 2
* Copyright (C) 2011 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
*/
9 9
package eu.etaxonomy.taxeditor.editor.view.uses.operation;
10 10

  
11
import java.util.UUID;
12

  
13 11
import org.eclipse.core.commands.ExecutionException;
14 12
import org.eclipse.core.commands.operations.IUndoContext;
15 13
import org.eclipse.core.runtime.IAdaptable;
......
28 26

  
29 27
/**
30 28
 * CreateTaxonUseOperation Class
31
 * @author a.theys	
29
 * @author a.theys
32 30
 * @created mar 13, 2012
33 31
 * @version 1.0
34 32
 */
......
62 60
			Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {
63 61
		super(label, undoContext, taxon, postOperationEnabled);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff