Revision 61c51c84
Added by Patrick Plitzner about 7 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
33 | 33 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
34 | 34 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
35 |
import eu.etaxonomy.taxeditor.editor.Messages; |
|
35 | 36 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
36 | 37 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
37 | 38 |
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToAcceptedTaxonOperation; |
... | ... | |
61 | 62 |
IEditorInput input = editor.getEditorInput(); |
62 | 63 |
|
63 | 64 |
if (!(input instanceof TaxonEditorInput)) { |
64 |
logger.error("Editor input is not TaxonEditorInput"); |
|
65 |
logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$
|
|
65 | 66 |
return null; |
66 | 67 |
} |
67 | 68 |
|
68 | 69 |
// Get synonym from selection |
69 | 70 |
StructuredSelection selection = (StructuredSelection) HandlerUtil.getCurrentSelection(event); |
70 | 71 |
if (!(selection.getFirstElement() instanceof Synonym)) { |
71 |
logger.error("Selection does not contain a Synonym"); |
|
72 |
logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$
|
|
72 | 73 |
return null; |
73 | 74 |
} |
74 | 75 |
|
... | ... | |
87 | 88 |
List<UUID> excludeTaxa = new ArrayList<UUID>(); |
88 | 89 |
//excludeTaxa.add(taxon.getUuid());//there are some cases where the accepted taxon should be the parent of the new created accepted taxon |
89 | 90 |
|
90 |
TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
|
|
91 |
TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
|
|
91 | 92 |
|
92 | 93 |
|
93 | 94 |
if(newParentNode != null){ |
... | ... | |
97 | 98 |
HomotypicalGroup group = synonym.getHomotypicGroup(); |
98 | 99 |
Set<TaxonNameBase> namesInGroup = group.getTypifiedNames(); |
99 | 100 |
// FIXME with this implementation we can not create a taxonNode that is a direct child of the classification node |
100 |
AbstractPostOperation operation = new ChangeSynonymToAcceptedTaxonOperation("Change synonym to accepted taxon", EditorUtil.getUndoContext(),
|
|
101 |
AbstractPostOperation operation = new ChangeSynonymToAcceptedTaxonOperation(Messages.ChangeSynonymToAcceptedTaxonHandler_CHANGE_SYN_TO_ACC_TAXON, EditorUtil.getUndoContext(),
|
|
101 | 102 |
taxon, newParentNode, synonym, namesInGroup, this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput()); //$NON-NLS-1$ |
102 | 103 |
|
103 | 104 |
EditorUtil.executeOperation(operation); |
... | ... | |
137 | 138 |
// TODO Auto-generated catch block |
138 | 139 |
e.printStackTrace(); |
139 | 140 |
} catch (Exception e) { |
140 |
MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage());
|
|
141 |
MessagingUtils.warningDialog(Messages.ChangeSynonymToAcceptedTaxonHandler_CREATE_FAILURE, this, e.getMessage());
|
|
141 | 142 |
} |
142 | 143 |
} |
143 | 144 |
return true; |
Also available in: Unified diff
ref #4611 i18n for taxeditor.editor plugin