Revision b0a5a69c
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler; |
11 | 11 |
|
12 | 12 |
import java.util.ArrayList; |
13 |
import java.util.Iterator; |
|
13 | 14 |
import java.util.List; |
14 | 15 |
import java.util.UUID; |
15 | 16 |
|
... | ... | |
69 | 70 |
|
70 | 71 |
@Execute |
71 | 72 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
72 |
@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection, |
|
73 | 73 |
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MMenuItem menuItem, EPartService partService, |
74 | 74 |
EModelService modelService, MApplication application, UISynchronize sync) { |
75 | 75 |
|
... | ... | |
78 | 78 |
this.partService = partService; |
79 | 79 |
|
80 | 80 |
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject(); |
81 |
IStructuredSelection viewselection = (IStructuredSelection) factualDataPart.getViewer().getSelection(); |
|
82 |
|
|
81 | 83 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart()); |
82 | 84 |
if(e4WrappedPart instanceof TaxonNameEditorE4){ |
83 | 85 |
editor = (TaxonNameEditorE4) e4WrappedPart; |
... | ... | |
86 | 88 |
|
87 | 89 |
List<DescriptionElementBase> elements = new ArrayList<DescriptionElementBase>(); |
88 | 90 |
|
89 |
// for(Object element : structuredSelection.toArray()){ |
|
90 |
if(selection instanceof DescriptionElementBase){ |
|
91 |
UUID uuid = ((DescriptionElementBase) selection).getUuid(); |
|
92 |
|
|
93 |
elements.add(CdmStore.getService(IDescriptionService.class).loadDescriptionElement(uuid, null)); |
|
94 |
} else if(selection instanceof FeatureNodeContainer){ |
|
95 |
for(DescriptionElementBase de : ((FeatureNodeContainer)selection).getDescriptionElements()){ |
|
96 |
elements.add( |
|
97 |
CdmStore.getService(IDescriptionService.class).loadDescriptionElement(de.getUuid(), null) |
|
98 |
); |
|
91 |
for (Iterator iter = viewselection.iterator(); iter.hasNext();) { |
|
92 |
Object object = iter.next(); |
|
93 |
if (object instanceof DescriptionElementBase) { |
|
94 |
UUID uuid = ((DescriptionElementBase) object).getUuid(); |
|
95 |
|
|
96 |
elements.add(CdmStore.getService(IDescriptionService.class).loadDescriptionElement(uuid, null)); |
|
97 |
} else if (object instanceof FeatureNodeContainer) { |
|
98 |
for (DescriptionElementBase de : ((FeatureNodeContainer) object).getDescriptionElements()) { |
|
99 |
elements.add( |
|
100 |
CdmStore.getService(IDescriptionService.class).loadDescriptionElement(de.getUuid(), null)); |
|
101 |
} |
|
99 | 102 |
} |
100 | 103 |
} |
101 |
// } |
|
102 | 104 |
|
103 | 105 |
if(elements.size() == 0){ |
104 | 106 |
return; |
Also available in: Unified diff
ref #7010 Adapt descriptive view handlers for multiple selection