Revision aa42dfd9
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java | ||
---|---|---|
30 | 30 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
31 | 31 |
import org.eclipse.jface.util.LocalSelectionTransfer; |
32 | 32 |
import org.eclipse.jface.viewers.AbstractTreeViewer; |
33 |
import org.eclipse.jface.viewers.ISelection; |
|
34 | 33 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
35 | 34 |
import org.eclipse.jface.viewers.IStructuredSelection; |
36 | 35 |
import org.eclipse.jface.viewers.StructuredSelection; |
... | ... | |
61 | 60 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
62 | 61 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
63 | 62 |
import eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter.DerivateSearchCompositeController; |
64 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
65 | 63 |
import eu.etaxonomy.taxeditor.model.IContextListener; |
66 | 64 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
67 | 65 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
... | ... | |
224 | 222 |
viewer.getTree().setEnabled(CdmStore.isActive()); |
225 | 223 |
|
226 | 224 |
//propagate selection |
227 |
selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
|
|
225 |
selectionChangedListener = (event -> selService.setSelection(event.getSelection()));
|
|
228 | 226 |
viewer.addSelectionChangedListener(selectionChangedListener); |
229 | 227 |
|
230 | 228 |
//create context menu |
... | ... | |
511 | 509 |
|
512 | 510 |
@Inject |
513 | 511 |
@Optional |
514 |
public void selectionChanged(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) ISelection selection, |
|
512 |
public void selectionChanged(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection,
|
|
515 | 513 |
@Named(IServiceConstants.ACTIVE_PART) MPart activePart, MPart thisPart) |
516 | 514 |
{ |
517 | 515 |
if(activePart == thisPart || viewer==null){ |
... | ... | |
525 | 523 |
if(activePart instanceof TaxonNameEditorE4){ |
526 | 524 |
selectedTaxon = ((TaxonNameEditorE4) activePart).getTaxon(); |
527 | 525 |
} |
528 |
else if(selection instanceof IStructuredSelection){
|
|
529 |
Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
|
|
526 |
else if(selection != null){
|
|
527 |
Object selectedElement = selection.getFirstElement();
|
|
530 | 528 |
if(selectedElement instanceof CdmBase){ |
531 | 529 |
if(((CdmBase) selectedElement).isInstanceOf(TaxonNode.class)){ |
532 | 530 |
selectedTaxon = HibernateProxyHelper.deproxy(selectedElement, TaxonNode.class).getTaxon(); |
Also available in: Unified diff
ref #7010 Adapt derivate view handlers for multiple selection