Revision 83a1a479
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingChangeAcceptedTaxonToSynonymHandler.java | ||
---|---|---|
18 | 18 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock; |
19 | 19 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
20 | 20 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
21 |
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; |
|
21 | 22 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingChangeAcceptedTaxonToSynonymOperation; |
22 | 23 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; |
23 | 24 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog; |
... | ... | |
34 | 35 |
private static final Logger logger = Logger |
35 | 36 |
.getLogger(RemotingChangeAcceptedTaxonToSynonymHandler.class); |
36 | 37 |
|
37 |
private static final String CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL = "Change Accepted Taxon to Synonym"; |
|
38 |
private static final String NO_TAXON_SELECTION_MESSAGE = "No taxon tree node selected for operation."; |
|
39 |
private static final String SINGLE_TAXON_SELECTION_MESSAGE = "The operation move accepted taxon to synonymy is available only for a single taxon."; |
|
40 |
private static final String SOURCE_TAXON_HAS_CHILDREN_MESSAGE = "The accepted taxon must not have any childen. You need to move all childen to " + |
|
41 |
"another taxon node in the TaxonNavigator before attempting to turn the accepted " + |
|
42 |
"taxon into a synonym."; |
|
43 |
private static final String RELATED_EDITOR_NOT_CLOSED_MESSAGE = "Could not close related taxon name editor " + |
|
44 |
"Please close it manually and try again."; |
|
45 |
private static final String SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE = "Selected object is not a taxon tree node"; |
|
46 | 38 |
|
47 | 39 |
private ITaxonTreeNode oldTaxonNode; |
48 | 40 |
|
... | ... | |
50 | 42 |
* @param label |
51 | 43 |
*/ |
52 | 44 |
public RemotingChangeAcceptedTaxonToSynonymHandler() { |
53 |
super(CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL); |
|
45 |
super(TaxonNavigatorLabels.CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL);
|
|
54 | 46 |
} |
55 | 47 |
/* (non-Javadoc) |
56 | 48 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent) |
... | ... | |
62 | 54 |
if(selection.size() > 1) { |
63 | 55 |
return new Status(IStatus.ERROR, |
64 | 56 |
"unknown", |
65 |
SINGLE_TAXON_SELECTION_MESSAGE); |
|
57 |
TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE);
|
|
66 | 58 |
} |
67 | 59 |
|
68 | 60 |
// check for no taxon tree node selected |
69 | 61 |
if(selection.size() == 0) { |
70 | 62 |
return new Status(IStatus.ERROR, |
71 | 63 |
"unknown", |
72 |
NO_TAXON_SELECTION_MESSAGE); |
|
64 |
TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
|
|
73 | 65 |
} |
74 | 66 |
|
75 | 67 |
// check that selected object is a taxon node |
... | ... | |
79 | 71 |
} else { |
80 | 72 |
return new Status(IStatus.ERROR, |
81 | 73 |
"unknown", |
82 |
SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE); |
|
74 |
TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
|
|
83 | 75 |
} |
84 | 76 |
// check that the source taxon node does not have children |
85 | 77 |
if(((TaxonNode)oldTaxonNode).getCountChildren() > 0) { |
86 | 78 |
return new Status(IStatus.ERROR, |
87 | 79 |
"unknown", |
88 |
SOURCE_TAXON_HAS_CHILDREN_MESSAGE); |
|
80 |
TaxonNavigatorLabels.SOURCE_TAXON_HAS_CHILDREN_MESSAGE);
|
|
89 | 81 |
|
90 | 82 |
} |
91 | 83 |
|
... | ... | |
94 | 86 |
if(editorClosed != true) { |
95 | 87 |
return new Status(IStatus.ERROR, |
96 | 88 |
"unknown", |
97 |
RELATED_EDITOR_NOT_CLOSED_MESSAGE); |
|
89 |
TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
|
|
98 | 90 |
} |
99 | 91 |
|
100 | 92 |
return Status.OK_STATUS; |
... | ... | |
120 | 112 |
RemotingChangeAcceptedTaxonToSynonymOperation rcattso = |
121 | 113 |
new RemotingChangeAcceptedTaxonToSynonymOperation(event.getTrigger(), |
122 | 114 |
false, |
123 |
oldTaxonNode, |
|
124 |
newAcceptedTaxonNode); |
|
115 |
oldTaxonNode.getUuid(),
|
|
116 |
newAcceptedTaxonNode.getUuid());
|
|
125 | 117 |
|
126 | 118 |
return rcattso; |
127 | 119 |
} |
Also available in: Unified diff
TaxonNavigator : added refresh of navigator on data change
TaxonNavigatorLabels : new interface with label strings used by taxon navigator handlers
RemotingChangeAcceptedTaxonToSynonymHandler : using TaxonNavigatorLabels
RemotingMoveFactualDataHandler : remoting version of move factual data handler
RemotingMoveFactualDataOperation : remoting version of move factual data operation
RemotingMoveTaxonHandler : remoting version of move taxon handler
RemotingMoveTaxonOperation : remoting version of move taxon operation
RemotingChangeAcceptedTaxonToSynonymOperation : replaced constructor input cdm entities to their uuids
RemotingCdmHandler : updated to handle other status severities and to handle warning status in post operation
RemotingCdmUpdateOperation : updated for warning status
TaxonNavigatorTest : added move taxon and move factual data tests