Revision eaff1338
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
39 | 39 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
40 | 40 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
41 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
|
42 |
import eu.etaxonomy.taxeditor.editor.Page; |
|
43 | 41 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
44 |
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
|
|
42 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
|
|
45 | 43 |
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4; |
46 | 44 |
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation; |
47 | 45 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
... | ... | |
62 | 60 |
*/ |
63 | 61 |
public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{ |
64 | 62 |
private UUID newAcceptedTaxonNodeUuid; |
65 |
private TaxonNameEditor editor; |
|
63 |
private TaxonNameEditorE4 editor;
|
|
66 | 64 |
|
67 | 65 |
@Execute |
68 | 66 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
... | ... | |
71 | 69 |
|
72 | 70 |
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject(); |
73 | 71 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart()); |
74 |
if(e4WrappedPart instanceof MultiPageTaxonEditor){
|
|
75 |
editor = (TaxonNameEditor) ((MultiPageTaxonEditor) e4WrappedPart).getPage(Page.NAME);
|
|
72 |
if(e4WrappedPart instanceof TaxonNameEditorE4){
|
|
73 |
editor = (TaxonNameEditorE4) e4WrappedPart;
|
|
76 | 74 |
} |
77 | 75 |
Taxon actualTaxon= null; |
78 | 76 |
|
... | ... | |
127 | 125 |
} |
128 | 126 |
newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid(); |
129 | 127 |
|
130 |
String moveMessage = String.format(Messages.MoveDescriptionElementsHandler_ELEMENTS_MOVED, editor.getEditor().getTaxon());
|
|
128 |
String moveMessage = String.format(Messages.MoveDescriptionElementsHandler_ELEMENTS_MOVED, editor.getTaxon()); |
|
131 | 129 |
|
132 | 130 |
AbstractPostOperation operation = new MoveDescriptionElementsOperation( |
133 | 131 |
menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), |
... | ... | |
150 | 148 |
//AbstractUtility.close(editor.getMultiPageTaxonEditor()); |
151 | 149 |
|
152 | 150 |
try { |
153 |
MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid); |
|
154 |
if(possibleOpenEditor != null){ |
|
155 |
AbstractUtility.close(possibleOpenEditor); |
|
156 |
} |
|
151 |
//FIXME E4 migrate |
|
152 |
// MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid); |
|
153 |
// if(possibleOpenEditor != null){ |
|
154 |
// AbstractUtility.close(possibleOpenEditor); |
|
155 |
// } |
|
157 | 156 |
EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid); |
158 | 157 |
} catch (PartInitException e) { |
159 | 158 |
MessagingUtils.error(this.getClass(), e); |
... | ... | |
181 | 180 |
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject(); |
182 | 181 |
|
183 | 182 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart()); |
184 |
if(e4WrappedPart instanceof MultiPageTaxonEditor){
|
|
183 |
if(e4WrappedPart instanceof TaxonNameEditorE4){
|
|
185 | 184 |
ISelection selection = factualDataPart.getViewer().getSelection(); |
186 | 185 |
if(selection instanceof IStructuredSelection){ |
187 | 186 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
Also available in: Unified diff
ref #6595 refactor selection handling to migrated name editor