<tags>View</tags>
<tags>nonRestore</tags>
<handlers xmi:id="_tLceQIl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.handler.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_majwMEaQEeeXMc6kSYO7Xg"/>
+ <handlers xmi:id="_DCv88IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHeterotypicSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHeterotypicSynonymHandlerE4" command="_ult4EIvOEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_OqNIQIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHomotypicSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHomotypicSynonymHandlerE4" command="_KpUFsIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_XFc2QIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateSynonymInHomotypicalGroupHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateSynonymInHomotypicalGroupHandlerE4" command="_VPLRIIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_ffY8sIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateMisapplicationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateMisapplicationHandlerE4" command="_c0byUIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_qKP84IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeSynonymToAcceptedTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeSynonymToAcceptedTaxonHandlerE4" command="_oBnccIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_14GrIIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToSynonymHandlerE4" command="_yh49QIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_8Lzd0IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToMisapplicationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToMisapplicationHandlerE4" command="_56AaUIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_GTxMUIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteTaxonBaseHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteTaxonBaseHandlerE4" command="_CoVcYIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_OZLNMIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteAllEmptyNamesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteAllEmptyNamesHandlerE4" command="_L4vQwIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_WWqoMIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandlerE4" command="_UFDx8IvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_edkd4IvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.SetBasionymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.SetBasionymHandlerE4" command="_b2nCsIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_lv9GYIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4" command="_jNvBQIvQEee7R4eqeQiXZg"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_tLceQYl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.nameeditor">
<children xsi:type="menu:Menu" xmi:id="_R6buoIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menu.new" label="%menu.label">
- <children xsi:type="menu:HandledMenuItem" xmi:id="_FjdDgIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel9" label="%command.label.9"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_Gsr8cIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel10" label="%command.label.10"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_I6FoIIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel11" label="%command.label.11"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_FjdDgIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHeterotypicSynonym" label="%command.label.9" command="_ult4EIvOEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Gsr8cIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHomotypicSynonym" label="%command.label.10" command="_KpUFsIvPEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_I6FoIIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newSynonymInHomotypicGroup" label="%command.label.11" command="_VPLRIIvPEee7R4eqeQiXZg"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_LGspoIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.16"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_MCsX0Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel49" label="%command.label.49"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_MCsX0Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newMisapplication" label="%command.label.49" command="_c0byUIvPEee7R4eqeQiXZg"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_ZXIJsIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menu.changeTo" label="%menu.label.0">
- <children xsi:type="menu:HandledMenuItem" xmi:id="_Nt_cAIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel12" label="%command.label.12"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_POj24Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel13" label="%command.label.13"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_QbC4IIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel14" label="%command.label.14"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Nt_cAIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToAccepted" label="%command.label.12" command="_oBnccIvPEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_POj24Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.nameEditor.menuItem.changeToSynonym" label="%command.label.13" command="_yh49QIvPEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_QbC4IIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToMisapplication" label="%command.label.14" command="_56AaUIvPEee7R4eqeQiXZg"/>
</children>
<children xsi:type="menu:MenuSeparator" xmi:id="_a0anEIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.13"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_bu3dIIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel15" label="%command.label.15"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_dVXg4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel16" label="%command.label.16"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_bu3dIIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.delete" label="%command.label.15" command="_CoVcYIvQEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_dVXg4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.deleteEmptyNames" label="%command.label.16" command="_L4vQwIvQEee7R4eqeQiXZg"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_e7Jy8Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.14"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_fkhgEIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel17" label="%command.label.17"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_hdfz4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel57" label="%command.label.57"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_iw4HUIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel56" label="%command.label.56"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_fkhgEIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.swapSynonymWithAccpeted" label="%command.label.17" command="_UFDx8IvQEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_hdfz4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.setAsBasionym" label="%command.label.57" command="_b2nCsIvQEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_iw4HUIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.moveSynonym" label="%command.label.56" command="_jNvBQIvQEee7R4eqeQiXZg"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_kS2QYIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.15"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_lF1MgIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel18" label="%command.label.18"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_zsZzIIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.nameEditorPopup.details" label="%command.label.18" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/accessories-text-editor.png" command="_WPjpoDSnEeek0dKsFNy--Q">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_zsZzIYvQEee7R4eqeQiXZg" coreExpressionId="isCdmStoreConnected"/>
+ <parameters xmi:id="_zsZzIovQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.detailsView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4"/>
+ </children>
</menus>
</elements>
</fragments>
<elements xsi:type="commands:Command" xmi:id="_2torwIZ7EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.name.createConceptRelation" commandName="%command.name.32"/>
<elements xsi:type="commands:Command" xmi:id="_OKtWAIaDEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.command.open" commandName="%command.name.33"/>
<elements xsi:type="commands:Command" xmi:id="_cMeq0IaHEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.openBulkEditorForTaxonRelationship" commandName="Open related concept in bulk editor"/>
+ <elements xsi:type="commands:Command" xmi:id="_ult4EIvOEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createHeterotypicSynoym" commandName="%command.name.1"/>
+ <elements xsi:type="commands:Command" xmi:id="_KpUFsIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createHomotypicSynoym" commandName="%command.name.0"/>
+ <elements xsi:type="commands:Command" xmi:id="_VPLRIIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createSynonymInHomotypicalGroup" commandName="%command.name.2"/>
+ <elements xsi:type="commands:Command" xmi:id="_c0byUIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createMisapplication" commandName="%command.name.36"/>
+ <elements xsi:type="commands:Command" xmi:id="_oBnccIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.changeToAcceptedTaxon" commandName="%command.name.4"/>
+ <elements xsi:type="commands:Command" xmi:id="_yh49QIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.changeToSynonym" commandName="%command.name.3"/>
+ <elements xsi:type="commands:Command" xmi:id="_56AaUIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.changeToMisapplication" commandName="%command.name.5"/>
+ <elements xsi:type="commands:Command" xmi:id="_CoVcYIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.delete" commandName="%command.name.45"/>
+ <elements xsi:type="commands:Command" xmi:id="_L4vQwIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames" commandName="%command.name.9"/>
+ <elements xsi:type="commands:Command" xmi:id="_UFDx8IvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted" commandName="%command.name.6"/>
+ <elements xsi:type="commands:Command" xmi:id="_b2nCsIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.setAsBasionym" commandName="%command.name.57"/>
+ <elements xsi:type="commands:Command" xmi:id="_jNvBQIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon" commandName="%command.name.46"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView">
<elements xsi:type="menu:HandledMenuItem" xmi:id="_tvph4EalEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.characterEditor" label="Character Editor" command="_WPjpoDSnEeek0dKsFNy--Q">
id="eu.etaxonomy.taxeditor.editor.command.openParent"
name="%command.name">
</command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateHomotypicSynonymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.createHomotypicSynoym"
- name="%command.name.0">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateHeterotypicSynonymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.createHeterotypicSynoym"
- name="%command.name.1">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateSynonymInHomotypicalGroupHandler"
- id="eu.etaxonomy.taxeditor.editor.name.createSynonymInHomotypicalGroup"
- name="%command.name.2">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateMisapplicationHandler"
- id="eu.etaxonomy.taxeditor.editor.name.createMisapplication"
- name="%command.name.36">
- </command>
<!-- <command
defaultHandler="eu.etaxonomy.taxeditor.editor.handler.MoveTaxonHandler"
id="eu.etaxonomy.taxeditor.editor.name.moveTaxon"
name="Move Taxon">
</command>-->
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeToSynonymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.changeToSynonym"
- name="%command.name.3">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeSynonymToAcceptedTaxonHandler"
- id="eu.etaxonomy.taxeditor.editor.name.changeToAcceptedTaxon"
- name="%command.name.4">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeToMisapplicationHandler"
- id="eu.etaxonomy.taxeditor.editor.name.changeToMisapplication"
- name="%command.name.5">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SwapSynonymAndAcceptedHandler"
- id="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted"
- name="%command.name.6">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SetBasionymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.setAsBasionym"
- name="%command.name.57">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.MoveSynonymToAnotherAcceptedTaxonHandler"
- id="eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon"
- name="%command.name.46">
- </command>
<command
categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SetBasionymHandler"
id="eu.etaxonomy.taxeditor.editor.name.changeAcceptedToSynonym"
name="Change Accepted Taxon to Synonym">
</command>-->
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.DeleteTaxonBaseHandler"
- id="eu.etaxonomy.taxeditor.editor.name.delete"
- name="%command.name.45">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.DeleteAllEmptyNamesHandler"
- id="eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames"
- name="%command.name.9">
- </command>
<category
id="eu.etaxonomy.taxeditor.editor.view.descriptive.command.category"
name="%category.name.1">
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
* if any.
*/
public static void openTaxonNode(UUID taxonNodeUuid) throws Exception {
- TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
- open(input);
+ TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
+ open(input);
+ }
+
+ public static void openTaxonNodeE4(UUID taxonNodeUuid) throws Exception {
+ TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(taxonNodeUuid);
+ EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getService(EPartService.class);
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
+ partService.showPart(part, PartState.ACTIVATE);
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+ editor.init(input);
}
- /**
- * <p>
- * openTaxonBase
- * </p>
- *
- * @param taxonBaseUuid
- * a {@link java.util.UUID} object.
- * @throws org.eclipse.ui.PartInitException
- * if any.
- */
public static void openTaxonBase(UUID taxonBaseUuid)
throws PartInitException {
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
}
}
+ public static void openTaxonBaseE4(UUID taxonBaseUuid) throws PartInitException{
+ TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
+
+ if (taxonBase != null && taxonBase.isOrphaned()) {
+ if(taxonBase.isInstanceOf(Synonym.class)){
+ MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE);
+ return;
+ }
+ else{
+ MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE);
+ return;
+ }
+ }
+ TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(taxonBaseUuid);
+ if(input!=null && input.getTaxonNode()!=null){
+ EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getService(EPartService.class);
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
+ partService.showPart(part, PartState.ACTIVATE);
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+ editor.init(input);
+ }
+ }
+
/**
* <p>
* findEditorByTaxonNodeUuid
return true;
}
+ public static boolean forceUserSaveE4Editor(TaxonNameEditorE4 editor, Shell shell) {
+ if (editor.isDirty()) {
+
+ boolean doSave = MessageDialog
+ .openConfirm(shell, Messages.EditorUtil_COMFIRM_SAVE,
+ Messages.EditorUtil_CONFIRM_SAVE_MESSAGE);
+
+ if (!doSave) {
+ return false;
+ }
+
+ editor.doSave(AbstractUtility.getMonitor());
+ }
+ return true;
+ }
+
/**
* <p>
* getSelection
return true;
}
+ public TaxonEditorInputE4 getEditorInput() {
+ return input;
+ }
+
}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.apache.log4j.Logger;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToAcceptedTaxonOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class ChangeSynonymToAcceptedTaxonHandlerE4 implements IPostOperationEnabled {
+ private static final Logger logger = Logger
+ .getLogger(ChangeSynonymToAcceptedTaxonHandlerE4.class);
+
+ private TaxonNameEditorE4 editor;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ IEditorInput input = editor.getEditorInput();
+
+ if (!(input instanceof TaxonEditorInput)) {
+ logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$
+ return;
+ }
+
+ // Get synonym from selection
+ if (!(selection.getFirstElement() instanceof Synonym)) {
+ logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$
+ return;
+ }
+
+ Synonym synonym = (Synonym) selection.getFirstElement();
+
+ // Force user to save taxon - not really necessary though, is it?
+ if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
+ return;
+ }
+
+ // Get taxon
+ Taxon taxon = ((TaxonEditorInput) input).getTaxon();
+
+ TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
+
+
+ if(newParentNode != null){
+
+ // TODO get synonyms from homotypical group and add them as homotypic synonyms to new accepted taxon
+ // apply confirmation dialog
+ HomotypicalGroup group = synonym.getHomotypicGroup();
+ Set<TaxonName> namesInGroup = group.getTypifiedNames();
+ // FIXME with this implementation we can not create a taxonNode that is a direct child of the classification node
+ ChangeSynonymToAcceptedTaxonOperation operation = new ChangeSynonymToAcceptedTaxonOperation(Messages.ChangeSynonymToAcceptedTaxonHandler_CHANGE_SYN_TO_ACC_TAXON, EditorUtil.getUndoContext(),
+ taxon, newParentNode, synonym, namesInGroup, this, editor, editor.getEditorInput()); //$NON-NLS-1$
+
+ AbstractUtility.executeOperation(operation);
+ }
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+
+ // Redraw existing editor
+ ((IPostOperationEnabled) editor).postOperation(null);
+
+ editor.doSave(AbstractUtility.getMonitor());
+
+ if (objectAffectedByOperation instanceof TaxonNode) {
+
+ // Open new unsaved editor with existing taxon's parent as temporary parent
+ TaxonNode newNode = (TaxonNode) objectAffectedByOperation;
+// TaxonNode newNode = parentNode.addChild(newTaxon);
+
+ try {
+ // TODO
+ /*
+ * This doesn't work b/c newNode hasn't been committed yet, and therefore
+ * CdmStore.getTaxonService().getTaxonNodeByUuid(taxonNodeUuid);
+ * doesn't work yet.
+ */
+ EditorUtil.openTaxonNode(newNode.getUuid());
+
+ } catch (PartInitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ MessagingUtils.warningDialog(Messages.ChangeSynonymToAcceptedTaxonHandler_CREATE_FAILURE, this, e.getMessage());
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onComplete() {
+ return false;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class ChangeToMisapplicationHandlerE4 {
+
+ private TaxonNameEditorE4 editor;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ MHandledMenuItem menuItem) {
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ if (!EditorUtil.forceUserSaveE4Editor(editor, shell)){
+ return ;
+ }
+ Object selectedElement = selection.getFirstElement();
+
+ AbstractPostOperation operation = null;
+ if(selectedElement instanceof Taxon){
+ operation = new ChangeConceptRelationshipTypeOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), (Taxon) selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), editor);
+ }
+ if(selectedElement instanceof Synonym){
+ operation = new ChangeSynonymToMisapplicationOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), (Synonym) selectedElement, editor);
+ }
+
+
+ AbstractUtility.executeOperation(operation);
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class ChangeToSynonymHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+
+ Taxon concept = (Taxon) selection.getFirstElement();
+
+ AbstractPostOperation operation;
+ operation = new ChangeConceptToSynonymOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), concept, null, editor);
+
+ AbstractUtility.executeOperation(operation);
+
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.parser.ParseHandler;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class CreateHeterotypicSynonymHandlerE4 {
+
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+ TaxonName newSynonymName = ParseHandler.createEmptyName();
+
+ AbstractPostOperation<?> operation;
+ operation = new CreateSynonymInNewGroupOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), newSynonymName, editor);
+ AbstractUtility.executeOperation(operation);
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.parser.ParseHandler;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class CreateHomotypicSynonymHandlerE4 {
+
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+ Taxon taxon = editor.getTaxon();
+ HomotypicalGroup group = taxon.getHomotypicGroup();
+ TaxonName newSynonymName = ParseHandler.createEmptyName();
+
+ AbstractPostOperation<?> operation;
+ operation = new CreateSynonymInExistingHomotypicalGroupOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), taxon, group, newSynonymName, editor);
+ AbstractUtility.executeOperation(operation);
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.parser.ParseHandler;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class CreateMisapplicationHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+ TaxonName conceptName = ParseHandler.createEmptyName();
+ Taxon concept = Taxon.NewInstance(conceptName, null);
+
+ TaxonRelationshipType type = TaxonRelationshipType.MISAPPLIED_NAME_FOR();
+
+ AbstractPostOperation<?> operation;
+ operation = new CreateConceptRelationOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), concept, type, editor);
+ AbstractUtility.executeOperation(operation);
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.parser.ParseHandler;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class CreateSynonymInHomotypicalGroupHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+ Object selecteObject = selection.getFirstElement();
+
+ if(! (selecteObject instanceof Synonym)){
+ return ;
+ }
+
+ Synonym synonym = (Synonym) selecteObject;
+
+ HomotypicalGroup group = synonym.getHomotypicGroup();
+
+ TaxonName newSynonymName = ParseHandler.createEmptyName();
+
+ AbstractPostOperation<?> operation;
+
+ operation = new CreateSynonymInExistingHomotypicalGroupOperation(menuItem.getLocalizedLabel(), editor.getUndoContext(),
+ editor.getTaxon(), group, newSynonymName, editor);
+ AbstractUtility.executeOperation(operation);
+
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class DeleteAllEmptyNamesHandlerE4 extends DeleteTaxonBaseHandlerE4 {
+
+ @Override
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selectedElement,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ MHandledMenuItem menuItem) {
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ for(AbstractGroupedContainerE4 containerWithEmptyName : editor.getEmptyContainers()){
+ editor.removeGroup(containerWithEmptyName.getGroup());
+ doExecute(menuItem.getLocalizedLabel(), shell, editor, containerWithEmptyName.getData());
+ }
+
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.service.DeleteResult;
+import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation;
+import eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation;
+import eu.etaxonomy.taxeditor.editor.name.operation.DeleteTaxonBaseOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class DeleteTaxonBaseHandlerE4 implements IPostOperationEnabled {
+
+ protected TaxonNameEditorE4 editor;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ MHandledMenuItem menuItem) {
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ doExecute(menuItem.getLocalizedLabel(), shell, editor, selection.getFirstElement());
+
+ }
+
+ protected void doExecute(String commandName, Shell shell, TaxonNameEditorE4 editor, Object selectedElement) {
+ AbstractPostOperation operation = null;
+
+ if (selectedElement instanceof TaxonBase){
+ if (((TaxonBase)selectedElement).getId() == 0){
+ if (selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()) {
+ editor.getTaxon().removeTaxon((Taxon)selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
+
+ } else if (selectedElement instanceof Synonym){
+ editor.getTaxon().removeSynonym((Synonym)selectedElement);
+ }
+ editor.redraw();
+ return;
+
+ }
+
+ }
+
+ // synonym
+ if(selectedElement instanceof Synonym){
+ SynonymDeletionConfigurator deleteConfig = new SynonymDeletionConfigurator();
+ if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, shell, Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM)){
+ return ;
+ }
+ operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), deleteConfig, editor.getTaxon(), (Synonym) selectedElement,this, editor, editor.getEditorInput());
+
+ }
+ // misapplication
+ else if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()){
+ TaxonDeletionConfigurator deleteConfig = new TaxonDeletionConfigurator();
+ if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, shell, Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_MISAPPLICATION)){
+ return ;
+ }
+ operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), deleteConfig, editor.getTaxon(), (Taxon) selectedElement,this, editor, editor.getEditorInput());
+ } else {
+ throw new IllegalArgumentException(Messages.DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT);
+ }
+
+ AbstractUtility.executeOperation(operation);
+ DeleteResult result = ((DeleteTaxonBaseOperation)operation).getResult();
+ if (result != null){
+ if (result.isError()){
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteDerivateOperation_DELETE_FAILED, TaxeditorEditorPlugin.PLUGIN_ID);
+ } else if (selectedElement instanceof Synonym){
+ this.editor.redraw();
+ if (!result.getExceptions().isEmpty()){
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_SYNONYM_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID);
+ }
+ } else if (selectedElement instanceof Taxon && !result.getExceptions().isEmpty()){
+ this.editor.redraw();
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID);
+ }
+ }
+
+
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+
+ return true;
+ }
+
+ @Override
+ public boolean onComplete() {
+
+ return false;
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Named;
+
+import org.apache.log4j.Logger;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+public class MoveSynonymToAnotherAcceptedTaxonHandlerE4 implements IPostOperationEnabled{
+ private static final Logger logger = Logger
+ .getLogger(MoveSynonymToAnotherAcceptedTaxonHandlerE4.class);
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+ IEditorInput input = editor.getEditorInput();
+
+ if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
+ return ;
+ }
+
+ if (!(input instanceof TaxonEditorInput)) {
+ logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$
+ return ;
+ }
+
+ if (selection==null || !(selection.getFirstElement() instanceof Synonym)) {
+ MessagingUtils.warningDialog(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION, this, Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION_MESSAGE);
+ logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$
+ return ;
+ }
+
+ Synonym synonym = (Synonym) selection.getFirstElement();
+ Taxon oldParent = ((TaxonEditorInput)input).getTaxon();
+ List<UUID> excludeTaxa = new ArrayList<UUID>();
+ excludeTaxa.add(oldParent.getUuid());
+
+
+ TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa, ((TaxonEditorInput)input).getTaxonNode(), ((TaxonEditorInput)input).getTaxonNode().getClassification());
+
+ if(newParentNode!=null){
+ MoveSynonymToAnotherAcceptedTaxonOperation operation = new MoveSynonymToAnotherAcceptedTaxonOperation(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_CHANGE_ACC_TAXON, EditorUtil.getUndoContext(),
+ oldParent.getUuid(), synonym.getUuid(), newParentNode.getTaxon(), editor);
+
+ AbstractUtility.executeOperation(operation);
+
+ }
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean onComplete() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicalGroupBasionymOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class SetBasionymHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+ TaxonBase selectedTaxonBase = (TaxonBase) selection.getFirstElement();
+
+ AbstractPostOperation operation;
+
+ operation = new ChangeHomotypicalGroupBasionymOperation(menuItem.getLocalizedLabel(), editor.getUndoContext(),
+ editor.getTaxon(), selectedTaxonBase, editor);
+ AbstractUtility.executeOperation(operation);
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.operation.SwapSynonymAndAcceptedOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class SwapSynonymAndAcceptedHandlerE4 implements IPostOperationEnabled {
+
+ private TaxonNameEditorE4 editor;
+ private Taxon taxon;
+ private EPartService partService;
+ private MPart activePart;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MHandledMenuItem menuItem, EPartService partService) {
+
+ this.activePart = activePart;
+ this.partService = partService;
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ Synonym synonym = (Synonym) selection.getFirstElement();
+
+ // Force user to save taxon - not really necessary though, is it?
+ if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
+ return;
+ }
+
+ SwapSynonymAndAcceptedOperation operation = new SwapSynonymAndAcceptedOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), synonym, this, editor.getEditorInput());
+
+ AbstractUtility.executeOperation(operation);
+
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ // Redraw existing editor
+ // ((IPostOperationEnabled) editor).postOperation(null);
+
+ editor.doSave(AbstractUtility.getMonitor());
+ partService.hidePart(activePart);
+
+ if (objectAffectedByOperation instanceof Taxon) {
+ taxon = (Taxon) objectAffectedByOperation;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onComplete() {
+ Display display = Display.getCurrent();
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ EditorUtil.openTaxonBaseE4(taxon.getUuid());
+ } catch (Exception e) {
+ MessagingUtils.warningDialog(Messages.SwapSynonymAndAcceptedHandler_COULD_NOT_OPEN, this,
+ e.getMessage());
+ }
+
+ }
+ });
+ return true;
+ }
+}
dialog.open();
}
else{
- EditorUtil.openTaxonNode(entityUuid);
+ EditorUtil.openTaxonNodeE4(entityUuid);
}
}else if(selectedObject instanceof TaxonBase){
TaxonBase taxonBase = (TaxonBase)selectedObject;