Project

General

Profile

Revision a7d1d751

IDa7d1d75195d7239668ac7238dfc5bee46f2266c7
Parent ae55584a
Child 90cf660a

Added by Patrick Plitzner about 3 years ago

ref #6595 migrate concept menu handlers

View differences:

eu.etaxonomy.taxeditor.editor/fragment.e4xmi
127 127
      <tags>View</tags>
128 128
      <tags>nonRestore</tags>
129 129
      <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"/>
130
      <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"/>
131
      <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"/>
132
      <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"/>
133
      <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"/>
134
      <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"/>
135
      <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"/>
136
      <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"/>
137
      <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"/>
138
      <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"/>
139
      <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"/>
140
      <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"/>
141
      <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"/>
130 142
      <menus xsi:type="menu:PopupMenu" xmi:id="_tLceQYl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.nameeditor">
131 143
        <children xsi:type="menu:Menu" xmi:id="_R6buoIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menu.new" label="%menu.label">
132
          <children xsi:type="menu:HandledMenuItem" xmi:id="_FjdDgIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel9" label="%command.label.9"/>
133
          <children xsi:type="menu:HandledMenuItem" xmi:id="_Gsr8cIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel10" label="%command.label.10"/>
134
          <children xsi:type="menu:HandledMenuItem" xmi:id="_I6FoIIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel11" label="%command.label.11"/>
144
          <children xsi:type="menu:HandledMenuItem" xmi:id="_FjdDgIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHeterotypicSynonym" label="%command.label.9" command="_ult4EIvOEee7R4eqeQiXZg"/>
145
          <children xsi:type="menu:HandledMenuItem" xmi:id="_Gsr8cIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHomotypicSynonym" label="%command.label.10" command="_KpUFsIvPEee7R4eqeQiXZg"/>
146
          <children xsi:type="menu:HandledMenuItem" xmi:id="_I6FoIIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newSynonymInHomotypicGroup" label="%command.label.11" command="_VPLRIIvPEee7R4eqeQiXZg"/>
135 147
          <children xsi:type="menu:MenuSeparator" xmi:id="_LGspoIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.16"/>
136
          <children xsi:type="menu:HandledMenuItem" xmi:id="_MCsX0Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel49" label="%command.label.49"/>
148
          <children xsi:type="menu:HandledMenuItem" xmi:id="_MCsX0Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newMisapplication" label="%command.label.49" command="_c0byUIvPEee7R4eqeQiXZg"/>
137 149
        </children>
138 150
        <children xsi:type="menu:Menu" xmi:id="_ZXIJsIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menu.changeTo" label="%menu.label.0">
139
          <children xsi:type="menu:HandledMenuItem" xmi:id="_Nt_cAIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel12" label="%command.label.12"/>
140
          <children xsi:type="menu:HandledMenuItem" xmi:id="_POj24Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel13" label="%command.label.13"/>
141
          <children xsi:type="menu:HandledMenuItem" xmi:id="_QbC4IIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel14" label="%command.label.14"/>
151
          <children xsi:type="menu:HandledMenuItem" xmi:id="_Nt_cAIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToAccepted" label="%command.label.12" command="_oBnccIvPEee7R4eqeQiXZg"/>
152
          <children xsi:type="menu:HandledMenuItem" xmi:id="_POj24Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.nameEditor.menuItem.changeToSynonym" label="%command.label.13" command="_yh49QIvPEee7R4eqeQiXZg"/>
153
          <children xsi:type="menu:HandledMenuItem" xmi:id="_QbC4IIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToMisapplication" label="%command.label.14" command="_56AaUIvPEee7R4eqeQiXZg"/>
142 154
        </children>
143 155
        <children xsi:type="menu:MenuSeparator" xmi:id="_a0anEIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.13"/>
144
        <children xsi:type="menu:HandledMenuItem" xmi:id="_bu3dIIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel15" label="%command.label.15"/>
145
        <children xsi:type="menu:HandledMenuItem" xmi:id="_dVXg4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel16" label="%command.label.16"/>
156
        <children xsi:type="menu:HandledMenuItem" xmi:id="_bu3dIIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.delete" label="%command.label.15" command="_CoVcYIvQEee7R4eqeQiXZg"/>
157
        <children xsi:type="menu:HandledMenuItem" xmi:id="_dVXg4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.deleteEmptyNames" label="%command.label.16" command="_L4vQwIvQEee7R4eqeQiXZg"/>
146 158
        <children xsi:type="menu:MenuSeparator" xmi:id="_e7Jy8Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.14"/>
147
        <children xsi:type="menu:HandledMenuItem" xmi:id="_fkhgEIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel17" label="%command.label.17"/>
148
        <children xsi:type="menu:HandledMenuItem" xmi:id="_hdfz4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel57" label="%command.label.57"/>
149
        <children xsi:type="menu:HandledMenuItem" xmi:id="_iw4HUIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel56" label="%command.label.56"/>
159
        <children xsi:type="menu:HandledMenuItem" xmi:id="_fkhgEIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.swapSynonymWithAccpeted" label="%command.label.17" command="_UFDx8IvQEee7R4eqeQiXZg"/>
160
        <children xsi:type="menu:HandledMenuItem" xmi:id="_hdfz4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.setAsBasionym" label="%command.label.57" command="_b2nCsIvQEee7R4eqeQiXZg"/>
161
        <children xsi:type="menu:HandledMenuItem" xmi:id="_iw4HUIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.moveSynonym" label="%command.label.56" command="_jNvBQIvQEee7R4eqeQiXZg"/>
150 162
        <children xsi:type="menu:MenuSeparator" xmi:id="_kS2QYIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.15"/>
151
        <children xsi:type="menu:HandledMenuItem" xmi:id="_lF1MgIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel18" label="%command.label.18"/>
163
        <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">
164
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_zsZzIYvQEee7R4eqeQiXZg" coreExpressionId="isCdmStoreConnected"/>
165
          <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"/>
166
        </children>
152 167
      </menus>
153 168
    </elements>
154 169
  </fragments>
......
182 197
    <elements xsi:type="commands:Command" xmi:id="_2torwIZ7EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.name.createConceptRelation" commandName="%command.name.32"/>
183 198
    <elements xsi:type="commands:Command" xmi:id="_OKtWAIaDEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.command.open" commandName="%command.name.33"/>
184 199
    <elements xsi:type="commands:Command" xmi:id="_cMeq0IaHEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.openBulkEditorForTaxonRelationship" commandName="Open related concept in bulk editor"/>
200
    <elements xsi:type="commands:Command" xmi:id="_ult4EIvOEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createHeterotypicSynoym" commandName="%command.name.1"/>
201
    <elements xsi:type="commands:Command" xmi:id="_KpUFsIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createHomotypicSynoym" commandName="%command.name.0"/>
202
    <elements xsi:type="commands:Command" xmi:id="_VPLRIIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createSynonymInHomotypicalGroup" commandName="%command.name.2"/>
203
    <elements xsi:type="commands:Command" xmi:id="_c0byUIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createMisapplication" commandName="%command.name.36"/>
204
    <elements xsi:type="commands:Command" xmi:id="_oBnccIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.changeToAcceptedTaxon" commandName="%command.name.4"/>
205
    <elements xsi:type="commands:Command" xmi:id="_yh49QIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.changeToSynonym" commandName="%command.name.3"/>
206
    <elements xsi:type="commands:Command" xmi:id="_56AaUIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.changeToMisapplication" commandName="%command.name.5"/>
207
    <elements xsi:type="commands:Command" xmi:id="_CoVcYIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.delete" commandName="%command.name.45"/>
208
    <elements xsi:type="commands:Command" xmi:id="_L4vQwIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames" commandName="%command.name.9"/>
209
    <elements xsi:type="commands:Command" xmi:id="_UFDx8IvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted" commandName="%command.name.6"/>
210
    <elements xsi:type="commands:Command" xmi:id="_b2nCsIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.setAsBasionym" commandName="%command.name.57"/>
211
    <elements xsi:type="commands:Command" xmi:id="_jNvBQIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon" commandName="%command.name.46"/>
185 212
  </fragments>
186 213
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView">
187 214
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_tvph4EalEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.characterEditor" label="Character Editor" command="_WPjpoDSnEeek0dKsFNy--Q">
eu.etaxonomy.taxeditor.editor/plugin.xml
1086 1086
            id="eu.etaxonomy.taxeditor.editor.command.openParent"
1087 1087
            name="%command.name">
1088 1088
      </command>
1089
      <command
1090
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1091
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateHomotypicSynonymHandler"
1092
            id="eu.etaxonomy.taxeditor.editor.name.createHomotypicSynoym"
1093
            name="%command.name.0">
1094
      </command>
1095
      <command
1096
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1097
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateHeterotypicSynonymHandler"
1098
            id="eu.etaxonomy.taxeditor.editor.name.createHeterotypicSynoym"
1099
            name="%command.name.1">
1100
      </command>
1101
      <command
1102
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1103
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateSynonymInHomotypicalGroupHandler"
1104
            id="eu.etaxonomy.taxeditor.editor.name.createSynonymInHomotypicalGroup"
1105
            name="%command.name.2">
1106
      </command>
1107
     <command
1108
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1109
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateMisapplicationHandler"
1110
            id="eu.etaxonomy.taxeditor.editor.name.createMisapplication"
1111
            name="%command.name.36">
1112
      </command>
1113 1089
    <!--  <command
1114 1090
            defaultHandler="eu.etaxonomy.taxeditor.editor.handler.MoveTaxonHandler"
1115 1091
            id="eu.etaxonomy.taxeditor.editor.name.moveTaxon"
......
1117 1093
      </command>-->
1118 1094
      <command
1119 1095
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1120
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeToSynonymHandler"
1121
            id="eu.etaxonomy.taxeditor.editor.name.changeToSynonym"
1122
            name="%command.name.3">
1123
      </command>
1124
      <command
1125
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1126
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeSynonymToAcceptedTaxonHandler"
1127
            id="eu.etaxonomy.taxeditor.editor.name.changeToAcceptedTaxon"
1128
            name="%command.name.4">
1129
      </command>
1130
      <command
1131
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1132
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeToMisapplicationHandler"
1133
            id="eu.etaxonomy.taxeditor.editor.name.changeToMisapplication"
1134
            name="%command.name.5">
1135
      </command>
1136
      <command
1137
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1138
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SwapSynonymAndAcceptedHandler"
1139
            id="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted"
1140
            name="%command.name.6">
1141
      </command>
1142
       <command
1143
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1144
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SetBasionymHandler"
1145
            id="eu.etaxonomy.taxeditor.editor.name.setAsBasionym"
1146
            name="%command.name.57">
1147
      </command>
1148
      <command
1149
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1150
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.MoveSynonymToAnotherAcceptedTaxonHandler"
1151
            id="eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon"
1152
            name="%command.name.46">
1153
      </command>
1154
      <command
1155
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1156 1096
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SetBasionymHandler"
1157 1097
            id="eu.etaxonomy.taxeditor.editor.name.setBasionym"
1158 1098
            name="%command.name.7">
......
1169 1109
            id="eu.etaxonomy.taxeditor.editor.name.changeAcceptedToSynonym"
1170 1110
            name="Change Accepted Taxon to Synonym">
1171 1111
      </command>-->
1172
      <command
1173
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1174
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.DeleteTaxonBaseHandler"
1175
            id="eu.etaxonomy.taxeditor.editor.name.delete"
1176
            name="%command.name.45">
1177
      </command>
1178
      <command
1179
            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
1180
            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.DeleteAllEmptyNamesHandler"
1181
            id="eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames"
1182
            name="%command.name.9">
1183
      </command>
1184 1112
      <category
1185 1113
            id="eu.etaxonomy.taxeditor.editor.view.descriptive.command.category"
1186 1114
            name="%category.name.1">
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
16 16
import org.eclipse.core.commands.ExecutionEvent;
17 17
import org.eclipse.core.commands.operations.IOperationHistory;
18 18
import org.eclipse.core.commands.operations.IUndoContext;
19
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
20
import org.eclipse.e4.ui.workbench.modeling.EPartService;
21
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
19 22
import org.eclipse.jface.dialogs.MessageDialog;
20 23
import org.eclipse.jface.viewers.ISelection;
21 24
import org.eclipse.jface.viewers.IStructuredSelection;
......
36 39
import eu.etaxonomy.cdm.model.taxon.Synonym;
37 40
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
38 41
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
42
import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
39 43
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor;
40 44
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
41 45
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
42 46
import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
43 47
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
44 48
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
49
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
45 50
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
46 51
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
47 52
import eu.etaxonomy.taxeditor.model.AbstractUtility;
......
138 143
	 *             if any.
139 144
	 */
140 145
	public static void openTaxonNode(UUID taxonNodeUuid) throws Exception {
141
		TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
142
		open(input);
146
	    TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
147
	    open(input);
148
	}
149

  
150
	public static void openTaxonNodeE4(UUID taxonNodeUuid) throws Exception {
151
        TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(taxonNodeUuid);
152
        EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getService(EPartService.class);
153
        MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
154
        partService.showPart(part, PartState.ACTIVATE);
155
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
156
        editor.init(input);
143 157
	}
144 158

  
145
	/**
146
	 * <p>
147
	 * openTaxonBase
148
	 * </p>
149
	 *
150
	 * @param taxonBaseUuid
151
	 *            a {@link java.util.UUID} object.
152
	 * @throws org.eclipse.ui.PartInitException
153
	 *             if any.
154
	 */
155 159
	public static void openTaxonBase(UUID taxonBaseUuid)
156 160
			throws PartInitException {
157 161
	    TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
......
172 176
		}
173 177
	}
174 178

  
179
	public static void openTaxonBaseE4(UUID taxonBaseUuid) throws PartInitException{
180
	    TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
181

  
182
	    if (taxonBase != null && taxonBase.isOrphaned()) {
183
	        if(taxonBase.isInstanceOf(Synonym.class)){
184
	            MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE);
185
	            return;
186
	        }
187
	        else{
188
	            MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE);
189
	            return;
190
	        }
191
	    }
192
	    TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(taxonBaseUuid);
193
	    if(input!=null && input.getTaxonNode()!=null){
194
	        EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getService(EPartService.class);
195
	        MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
196
	        partService.showPart(part, PartState.ACTIVATE);
197
	        TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
198
	        editor.init(input);
199
	    }
200
	}
201

  
175 202
	/**
176 203
	 * <p>
177 204
	 * findEditorByTaxonNodeUuid
......
350 377
		return true;
351 378
	}
352 379

  
380
	public static boolean forceUserSaveE4Editor(TaxonNameEditorE4 editor, Shell shell) {
381
	    if (editor.isDirty()) {
382

  
383
	        boolean doSave = MessageDialog
384
	                .openConfirm(shell, Messages.EditorUtil_COMFIRM_SAVE,
385
	                        Messages.EditorUtil_CONFIRM_SAVE_MESSAGE);
386

  
387
	        if (!doSave) {
388
	            return false;
389
	        }
390

  
391
	        editor.doSave(AbstractUtility.getMonitor());
392
	    }
393
	    return true;
394
	}
395

  
353 396
	/**
354 397
	 * <p>
355 398
	 * getSelection
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonNameEditorE4.java
639 639
        return true;
640 640
    }
641 641

  
642
    public TaxonEditorInputE4 getEditorInput() {
643
        return input;
644
    }
645

  
642 646
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeSynonymToAcceptedTaxonHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import java.util.Set;
13

  
14
import javax.inject.Named;
15

  
16
import org.apache.log4j.Logger;
17
import org.eclipse.e4.core.di.annotations.Execute;
18
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
19
import org.eclipse.e4.ui.services.IServiceConstants;
20
import org.eclipse.jface.viewers.IStructuredSelection;
21
import org.eclipse.swt.widgets.Shell;
22
import org.eclipse.ui.IEditorInput;
23
import org.eclipse.ui.PartInitException;
24

  
25
import eu.etaxonomy.cdm.model.common.CdmBase;
26
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
27
import eu.etaxonomy.cdm.model.name.TaxonName;
28
import eu.etaxonomy.cdm.model.taxon.Synonym;
29
import eu.etaxonomy.cdm.model.taxon.Taxon;
30
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
31
import eu.etaxonomy.taxeditor.editor.EditorUtil;
32
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
33
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
34
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
35
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToAcceptedTaxonOperation;
36
import eu.etaxonomy.taxeditor.model.AbstractUtility;
37
import eu.etaxonomy.taxeditor.model.MessagingUtils;
38
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
39
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
40

  
41
/**
42
 *
43
 * @author pplitzner
44
 * @since Aug 28, 2017
45
 *
46
 */
47
public class ChangeSynonymToAcceptedTaxonHandlerE4 implements IPostOperationEnabled {
48
	private static final Logger logger = Logger
49
			.getLogger(ChangeSynonymToAcceptedTaxonHandlerE4.class);
50

  
51
	private TaxonNameEditorE4 editor;
52

  
53
    @Execute
54
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
55
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
56
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
57

  
58
        editor = (TaxonNameEditorE4) activePart.getObject();
59

  
60
		IEditorInput input = editor.getEditorInput();
61

  
62
		if (!(input instanceof TaxonEditorInput)) {
63
			logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$
64
			return;
65
		}
66

  
67
		// Get synonym from selection
68
		if (!(selection.getFirstElement() instanceof Synonym)) {
69
			logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$
70
			return;
71
		}
72

  
73
		Synonym synonym = (Synonym) selection.getFirstElement();
74

  
75
		// Force user to save taxon - not really necessary though, is it?
76
		if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
77
			return;
78
		}
79

  
80
		// Get taxon
81
		Taxon taxon = ((TaxonEditorInput) input).getTaxon();
82

  
83
		TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
84

  
85

  
86
		if(newParentNode != null){
87

  
88
			// TODO get synonyms from homotypical group and add them as homotypic synonyms to new accepted taxon
89
			// apply confirmation dialog
90
			HomotypicalGroup group = synonym.getHomotypicGroup();
91
			Set<TaxonName> namesInGroup = group.getTypifiedNames();
92
			// FIXME with this implementation we can not create a taxonNode that is a direct child of the classification node
93
			ChangeSynonymToAcceptedTaxonOperation operation = new ChangeSynonymToAcceptedTaxonOperation(Messages.ChangeSynonymToAcceptedTaxonHandler_CHANGE_SYN_TO_ACC_TAXON, EditorUtil.getUndoContext(),
94
					taxon, newParentNode, synonym, namesInGroup, this, editor, editor.getEditorInput()); //$NON-NLS-1$
95

  
96
			AbstractUtility.executeOperation(operation);
97
		}
98

  
99
	}
100

  
101
	/** {@inheritDoc} */
102
	@Override
103
    public boolean postOperation(CdmBase objectAffectedByOperation) {
104

  
105
		// Redraw existing editor
106
		((IPostOperationEnabled) editor).postOperation(null);
107

  
108
		editor.doSave(AbstractUtility.getMonitor());
109

  
110
		if (objectAffectedByOperation instanceof TaxonNode) {
111

  
112
			// Open new unsaved editor with existing taxon's parent as temporary parent
113
			TaxonNode newNode = (TaxonNode) objectAffectedByOperation;
114
//			TaxonNode newNode = parentNode.addChild(newTaxon);
115

  
116
			try {
117
				// TODO
118
				/*
119
				 * This doesn't work b/c newNode hasn't been committed yet, and therefore
120
				 *  CdmStore.getTaxonService().getTaxonNodeByUuid(taxonNodeUuid);
121
				 *  doesn't work yet.
122
				 */
123
				EditorUtil.openTaxonNode(newNode.getUuid());
124

  
125
			} catch (PartInitException e) {
126
				// TODO Auto-generated catch block
127
				e.printStackTrace();
128
			} catch (Exception e) {
129
				MessagingUtils.warningDialog(Messages.ChangeSynonymToAcceptedTaxonHandler_CREATE_FAILURE, this, e.getMessage());
130
			}
131
		}
132
		return true;
133
	}
134

  
135
	@Override
136
    public boolean onComplete() {
137
		return false;
138
	}
139
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToMisapplicationHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19
import org.eclipse.swt.widgets.Shell;
20

  
21
import eu.etaxonomy.cdm.model.taxon.Synonym;
22
import eu.etaxonomy.cdm.model.taxon.Taxon;
23
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
24
import eu.etaxonomy.taxeditor.editor.EditorUtil;
25
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
26
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
27
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation;
28
import eu.etaxonomy.taxeditor.model.AbstractUtility;
29
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
30

  
31
/**
32
 *
33
 * @author pplitzner
34
 * @since Aug 28, 2017
35
 *
36
 */
37
public class ChangeToMisapplicationHandlerE4 {
38

  
39
    private TaxonNameEditorE4 editor;
40

  
41
    @Execute
42
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
43
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
44
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
45
            MHandledMenuItem menuItem) {
46

  
47
        editor = (TaxonNameEditorE4) activePart.getObject();
48

  
49
		if (!EditorUtil.forceUserSaveE4Editor(editor, shell)){
50
            return ;
51
        }
52
		Object selectedElement = selection.getFirstElement();
53

  
54
		AbstractPostOperation operation = null;
55
		if(selectedElement instanceof Taxon){
56
        	operation = new ChangeConceptRelationshipTypeOperation(menuItem.getLocalizedLabel(),
57
        							editor.getUndoContext(), editor.getTaxon(), (Taxon) selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), editor);
58
        }
59
        if(selectedElement instanceof Synonym){
60
        	operation = new ChangeSynonymToMisapplicationOperation(menuItem.getLocalizedLabel(),
61
        			editor.getUndoContext(), editor.getTaxon(), (Synonym) selectedElement, editor);
62
        }
63

  
64

  
65
        AbstractUtility.executeOperation(operation);
66
	}
67
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToSynonymHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19

  
20
import eu.etaxonomy.cdm.model.taxon.Taxon;
21
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
22
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
23
import eu.etaxonomy.taxeditor.model.AbstractUtility;
24
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
25

  
26
/**
27
 *
28
 * @author pplitzner
29
 * @since Aug 28, 2017
30
 *
31
 */
32
public class ChangeToSynonymHandlerE4 {
33

  
34
    @Execute
35
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
36
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
37
            MHandledMenuItem menuItem) {
38

  
39
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
40

  
41

  
42
		Taxon concept  = (Taxon) selection.getFirstElement();
43

  
44
		AbstractPostOperation operation;
45
		operation = new ChangeConceptToSynonymOperation(menuItem.getLocalizedLabel(),
46
        		editor.getUndoContext(), editor.getTaxon(), concept, null, editor);
47

  
48
        AbstractUtility.executeOperation(operation);
49

  
50
	}
51
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateHeterotypicSynonymHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18

  
19
import eu.etaxonomy.cdm.model.name.TaxonName;
20
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
21
import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation;
22
import eu.etaxonomy.taxeditor.model.AbstractUtility;
23
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
24
import eu.etaxonomy.taxeditor.parser.ParseHandler;
25

  
26
/**
27
 *
28
 * @author pplitzner
29
 * @since Aug 28, 2017
30
 *
31
 */
32
public class CreateHeterotypicSynonymHandlerE4 {
33

  
34

  
35
    @Execute
36
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
37
            MHandledMenuItem menuItem) {
38

  
39
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
40

  
41
		TaxonName newSynonymName = ParseHandler.createEmptyName();
42

  
43
		AbstractPostOperation<?> operation;
44
		operation = new CreateSynonymInNewGroupOperation(menuItem.getLocalizedLabel(),
45
        		editor.getUndoContext(), editor.getTaxon(), newSynonymName, editor);
46
        AbstractUtility.executeOperation(operation);
47
	}
48
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateHomotypicSynonymHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18

  
19
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
20
import eu.etaxonomy.cdm.model.name.TaxonName;
21
import eu.etaxonomy.cdm.model.taxon.Taxon;
22
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
23
import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
24
import eu.etaxonomy.taxeditor.model.AbstractUtility;
25
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
26
import eu.etaxonomy.taxeditor.parser.ParseHandler;
27

  
28
/**
29
 *
30
 * @author pplitzner
31
 * @since Aug 28, 2017
32
 *
33
 */
34
public class CreateHomotypicSynonymHandlerE4 {
35

  
36

  
37
    @Execute
38
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
39
            MHandledMenuItem menuItem) {
40

  
41
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
42
		Taxon taxon = editor.getTaxon();
43
		HomotypicalGroup group = taxon.getHomotypicGroup();
44
		TaxonName newSynonymName = ParseHandler.createEmptyName();
45

  
46
		AbstractPostOperation<?> operation;
47
		operation = new CreateSynonymInExistingHomotypicalGroupOperation(menuItem.getLocalizedLabel(),
48
        		editor.getUndoContext(), taxon, group, newSynonymName, editor);
49
        AbstractUtility.executeOperation(operation);
50
	}
51
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateMisapplicationHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18

  
19
import eu.etaxonomy.cdm.model.name.TaxonName;
20
import eu.etaxonomy.cdm.model.taxon.Taxon;
21
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
22
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
23
import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
24
import eu.etaxonomy.taxeditor.model.AbstractUtility;
25
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
26
import eu.etaxonomy.taxeditor.parser.ParseHandler;
27

  
28
/**
29
 *
30
 * @author pplitzner
31
 * @since Aug 28, 2017
32
 *
33
 */
34
public class CreateMisapplicationHandlerE4 {
35

  
36
    @Execute
37
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
38
            MHandledMenuItem menuItem) {
39

  
40
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
41

  
42
		TaxonName conceptName = ParseHandler.createEmptyName();
43
		Taxon concept = Taxon.NewInstance(conceptName, null);
44

  
45
		TaxonRelationshipType type = TaxonRelationshipType.MISAPPLIED_NAME_FOR();
46

  
47
		AbstractPostOperation<?> operation;
48
		operation = new CreateConceptRelationOperation(menuItem.getLocalizedLabel(),
49
        		editor.getUndoContext(), editor.getTaxon(), concept, type, editor);
50
        AbstractUtility.executeOperation(operation);
51
	}
52
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateSynonymInHomotypicalGroupHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19

  
20
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
21
import eu.etaxonomy.cdm.model.name.TaxonName;
22
import eu.etaxonomy.cdm.model.taxon.Synonym;
23
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
24
import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
25
import eu.etaxonomy.taxeditor.model.AbstractUtility;
26
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
27
import eu.etaxonomy.taxeditor.parser.ParseHandler;
28

  
29
/**
30
 *
31
 * @author pplitzner
32
 * @since Aug 28, 2017
33
 *
34
 */
35
public class CreateSynonymInHomotypicalGroupHandlerE4 {
36

  
37
    @Execute
38
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
39
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
40
            MHandledMenuItem menuItem) {
41

  
42
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
43

  
44
		Object selecteObject = selection.getFirstElement();
45

  
46
		if(! (selecteObject instanceof Synonym)){
47
			return ;
48
		}
49

  
50
		Synonym synonym = (Synonym) selecteObject;
51

  
52
		HomotypicalGroup group = synonym.getHomotypicGroup();
53

  
54
		TaxonName newSynonymName = ParseHandler.createEmptyName();
55

  
56
		AbstractPostOperation<?> operation;
57

  
58
		operation = new CreateSynonymInExistingHomotypicalGroupOperation(menuItem.getLocalizedLabel(), editor.getUndoContext(),
59
        					editor.getTaxon(), group, newSynonymName, editor);
60
        AbstractUtility.executeOperation(operation);
61

  
62
	}
63
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/DeleteAllEmptyNamesHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19
import org.eclipse.swt.widgets.Shell;
20

  
21
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
22
import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
23

  
24
/**
25
 *
26
 * @author pplitzner
27
 * @since Aug 28, 2017
28
 *
29
 */
30
public class DeleteAllEmptyNamesHandlerE4 extends DeleteTaxonBaseHandlerE4 {
31

  
32
    @Override
33
    @Execute
34
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
35
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selectedElement,
36
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
37
            MHandledMenuItem menuItem) {
38

  
39
        editor = (TaxonNameEditorE4) activePart.getObject();
40

  
41
		for(AbstractGroupedContainerE4 containerWithEmptyName : editor.getEmptyContainers()){
42
		    editor.removeGroup(containerWithEmptyName.getGroup());
43
			doExecute(menuItem.getLocalizedLabel(), shell, editor, containerWithEmptyName.getData());
44
		}
45

  
46
	}
47

  
48
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/DeleteTaxonBaseHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11
import javax.inject.Named;
12

  
13
import org.eclipse.e4.core.di.annotations.Execute;
14
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
15
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
16
import org.eclipse.e4.ui.services.IServiceConstants;
17
import org.eclipse.jface.viewers.IStructuredSelection;
18
import org.eclipse.swt.widgets.Shell;
19

  
20
import eu.etaxonomy.cdm.api.service.DeleteResult;
21
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
22
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
23
import eu.etaxonomy.cdm.model.common.CdmBase;
24
import eu.etaxonomy.cdm.model.taxon.Synonym;
25
import eu.etaxonomy.cdm.model.taxon.Taxon;
26
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
27
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
28
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
29
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
30
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
31
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation;
32
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation;
33
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteTaxonBaseOperation;
34
import eu.etaxonomy.taxeditor.model.AbstractUtility;
35
import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
36
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
37
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
38
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
39

  
40
/**
41
 *
42
 * @author pplitzner
43
 * @since Aug 28, 2017
44
 *
45
 */
46
public class DeleteTaxonBaseHandlerE4 implements IPostOperationEnabled {
47

  
48
    protected TaxonNameEditorE4 editor;
49

  
50
	@Execute
51
	public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
52
	        @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
53
	        @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
54
	        MHandledMenuItem menuItem) {
55

  
56
	    editor = (TaxonNameEditorE4) activePart.getObject();
57

  
58
	    doExecute(menuItem.getLocalizedLabel(), shell, editor, selection.getFirstElement());
59

  
60
	}
61

  
62
	protected void doExecute(String commandName, Shell shell, TaxonNameEditorE4 editor, Object selectedElement) {
63
		AbstractPostOperation operation = null;
64

  
65
		if (selectedElement instanceof TaxonBase){
66
		    if (((TaxonBase)selectedElement).getId() == 0){
67
		        if (selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()) {
68
                    editor.getTaxon().removeTaxon((Taxon)selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
69

  
70
                } else if (selectedElement instanceof Synonym){
71
                    editor.getTaxon().removeSynonym((Synonym)selectedElement);
72
                }
73
		        editor.redraw();
74
		        return;
75

  
76
	        }
77

  
78
		}
79

  
80
		// synonym
81
		if(selectedElement instanceof Synonym){
82
		    SynonymDeletionConfigurator deleteConfig = new SynonymDeletionConfigurator();
83
		    if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, shell, Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION,  Messages.DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM)){
84
		           return ;
85
            }
86
			operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), deleteConfig, editor.getTaxon(), (Synonym) selectedElement,this, editor, editor.getEditorInput());
87

  
88
		}
89
		// misapplication
90
		else if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()){
91
		    TaxonDeletionConfigurator deleteConfig = new TaxonDeletionConfigurator();
92
		    if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, shell, Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION,  Messages.DeleteTaxonBaseHandler_REALLY_DELETE_MISAPPLICATION)){
93
		        return ;
94
		    }
95
			operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(),  deleteConfig, editor.getTaxon(), (Taxon) selectedElement,this, editor, editor.getEditorInput());
96
		} else {
97
			throw new IllegalArgumentException(Messages.DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT);
98
		}
99

  
100
		AbstractUtility.executeOperation(operation);
101
		DeleteResult result = ((DeleteTaxonBaseOperation)operation).getResult();
102
		if (result != null){
103
    		if (result.isError()){
104
                DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteDerivateOperation_DELETE_FAILED, TaxeditorEditorPlugin.PLUGIN_ID);
105
            } else if (selectedElement instanceof Synonym){
106
                this.editor.redraw();
107
    		    if (!result.getExceptions().isEmpty()){
108
                    DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_SYNONYM_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID);
109
                }
110
    		} else if (selectedElement instanceof Taxon && !result.getExceptions().isEmpty()){
111
    	        this.editor.redraw();
112
                DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID);
113
    		}
114
		}
115

  
116

  
117
	}
118

  
119
	@Override
120
	public boolean postOperation(CdmBase objectAffectedByOperation) {
121

  
122
		return true;
123
	}
124

  
125
	@Override
126
	public boolean onComplete() {
127

  
128
		return false;
129
	}
130

  
131
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/MoveSynonymToAnotherAcceptedTaxonHandlerE4.java
1
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
2

  
3
import java.util.ArrayList;
4
import java.util.List;
5
import java.util.UUID;
6

  
7
import javax.inject.Named;
8

  
9
import org.apache.log4j.Logger;
10
import org.eclipse.e4.core.di.annotations.Execute;
11
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
12
import org.eclipse.e4.ui.services.IServiceConstants;
13
import org.eclipse.jface.viewers.IStructuredSelection;
14
import org.eclipse.swt.widgets.Shell;
15
import org.eclipse.ui.IEditorInput;
16

  
17
import eu.etaxonomy.cdm.model.common.CdmBase;
18
import eu.etaxonomy.cdm.model.taxon.Synonym;
19
import eu.etaxonomy.cdm.model.taxon.Taxon;
20
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
21
import eu.etaxonomy.taxeditor.editor.EditorUtil;
22
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
23
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
24
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
25
import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation;
26
import eu.etaxonomy.taxeditor.model.AbstractUtility;
27
import eu.etaxonomy.taxeditor.model.MessagingUtils;
28
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
29
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
30

  
31
public class MoveSynonymToAnotherAcceptedTaxonHandlerE4 implements IPostOperationEnabled{
32
	private static final Logger logger = Logger
33
	.getLogger(MoveSynonymToAnotherAcceptedTaxonHandlerE4.class);
34

  
35
	@Execute
36
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
37
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
38
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
39

  
40
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
41

  
42
		IEditorInput input = editor.getEditorInput();
43

  
44
		if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
45
			return ;
46
		}
47

  
48
		if (!(input instanceof TaxonEditorInput)) {
49
			logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$
50
			return ;
51
		}
52

  
53
		if (selection==null || !(selection.getFirstElement() instanceof Synonym)) {
54
		    MessagingUtils.warningDialog(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION, this, Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION_MESSAGE);
55
			logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$
56
			return ;
57
		}
58

  
59
		Synonym synonym = (Synonym) selection.getFirstElement();
60
		Taxon oldParent = ((TaxonEditorInput)input).getTaxon();
61
		List<UUID> excludeTaxa = new ArrayList<UUID>();
62
		excludeTaxa.add(oldParent.getUuid());
63

  
64

  
65
		TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa,  ((TaxonEditorInput)input).getTaxonNode(), ((TaxonEditorInput)input).getTaxonNode().getClassification());
66

  
67
		if(newParentNode!=null){
68
		   MoveSynonymToAnotherAcceptedTaxonOperation operation = new MoveSynonymToAnotherAcceptedTaxonOperation(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_CHANGE_ACC_TAXON, EditorUtil.getUndoContext(),
69
		            oldParent.getUuid(), synonym.getUuid(), newParentNode.getTaxon(), editor);
70

  
71
		    AbstractUtility.executeOperation(operation);
72

  
73
		}
74
	}
75

  
76
	@Override
77
	public boolean postOperation(CdmBase objectAffectedByOperation) {
78
		// TODO Auto-generated method stub
79
		return false;
80
	}
81

  
82
	@Override
83
	public boolean onComplete() {
84
		// TODO Auto-generated method stub
85
		return false;
86
	}
87

  
88

  
89

  
90
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SetBasionymHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19

  
20
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
21
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
22
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicalGroupBasionymOperation;
23
import eu.etaxonomy.taxeditor.model.AbstractUtility;
24
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
25

  
26
/**
27
 *
28
 * @author pplitzner
29
 * @since Aug 28, 2017
30
 *
31
 */
32
public class SetBasionymHandlerE4 {
33

  
34
    @Execute
35
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
36
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
37
            MHandledMenuItem menuItem) {
38

  
39
        TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
40

  
41
		TaxonBase selectedTaxonBase = (TaxonBase) selection.getFirstElement();
42

  
43
		AbstractPostOperation operation;
44

  
45
		operation = new ChangeHomotypicalGroupBasionymOperation(menuItem.getLocalizedLabel(), editor.getUndoContext(),
46
        					editor.getTaxon(), selectedTaxonBase, editor);
47
        AbstractUtility.executeOperation(operation);
48
	}
49
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SwapSynonymAndAcceptedHandlerE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.editor.name.e4.handler;
11

  
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.e4.ui.workbench.modeling.EPartService;
19
import org.eclipse.jface.viewers.IStructuredSelection;
20
import org.eclipse.swt.widgets.Display;
21
import org.eclipse.swt.widgets.Shell;
22

  
23
import eu.etaxonomy.cdm.model.common.CdmBase;
24
import eu.etaxonomy.cdm.model.taxon.Synonym;
25
import eu.etaxonomy.cdm.model.taxon.Taxon;
26
import eu.etaxonomy.taxeditor.editor.EditorUtil;
27
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
28
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
29
import eu.etaxonomy.taxeditor.editor.name.operation.SwapSynonymAndAcceptedOperation;
30
import eu.etaxonomy.taxeditor.model.AbstractUtility;
31
import eu.etaxonomy.taxeditor.model.MessagingUtils;
32
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
33

  
34
/**
35
 *
36
 * @author pplitzner
37
 * @since Aug 28, 2017
38
 *
39
 */
40
public class SwapSynonymAndAcceptedHandlerE4 implements IPostOperationEnabled {
41

  
42
    private TaxonNameEditorE4 editor;
43
    private Taxon taxon;
44
    private EPartService partService;
45
    private MPart activePart;
46

  
47
    @Execute
48
    public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
49
            @Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection,
50
            @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MHandledMenuItem menuItem, EPartService partService) {
51

  
52
        this.activePart = activePart;
53
        this.partService = partService;
54

  
55
        editor = (TaxonNameEditorE4) activePart.getObject();
56

  
57
        Synonym synonym = (Synonym) selection.getFirstElement();
58

  
59
        // Force user to save taxon - not really necessary though, is it?
60
        if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
61
            return;
62
        }
63

  
64
        SwapSynonymAndAcceptedOperation operation = new SwapSynonymAndAcceptedOperation(menuItem.getLocalizedLabel(),
65
                editor.getUndoContext(), editor.getTaxon(), synonym, this, editor.getEditorInput());
66

  
67
        AbstractUtility.executeOperation(operation);
68

  
69
    }
70

  
71
    @Override
72
    public boolean postOperation(CdmBase objectAffectedByOperation) {
73
        // Redraw existing editor
74
        // ((IPostOperationEnabled) editor).postOperation(null);
75

  
76
        editor.doSave(AbstractUtility.getMonitor());
77
        partService.hidePart(activePart);
78

  
79
        if (objectAffectedByOperation instanceof Taxon) {
80
            taxon = (Taxon) objectAffectedByOperation;
81
        }
82
        return true;
83
    }
84

  
85
    @Override
86
    public boolean onComplete() {
87
        Display display = Display.getCurrent();
88
        display.asyncExec(new Runnable() {
89
            @Override
90
            public void run() {
91
                try {
92
                    EditorUtil.openTaxonBaseE4(taxon.getUuid());
93
                } catch (Exception e) {
94
                    MessagingUtils.warningDialog(Messages.SwapSynonymAndAcceptedHandler_COULD_NOT_OPEN, this,
95
                            e.getMessage());
96
                }
97

  
98
            }
99
        });
100
        return true;
101
    }
102
}
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java
116 116
			        dialog.open();
117 117
			    }
118 118
			    else{
119
			        EditorUtil.openTaxonNode(entityUuid);
119
			        EditorUtil.openTaxonNodeE4(entityUuid);
120 120
			    }
121 121
			}else if(selectedObject instanceof TaxonBase){
122 122
				TaxonBase taxonBase = (TaxonBase)selectedObject;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)