Revision fabdcb1b
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorE4.java | ||
---|---|---|
30 | 30 |
import org.eclipse.e4.ui.di.Focus; |
31 | 31 |
import org.eclipse.e4.ui.services.EMenuService; |
32 | 32 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
33 |
import org.eclipse.jface.viewers.ISelection; |
|
33 | 34 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
35 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
34 | 36 |
import org.eclipse.jface.viewers.TreePath; |
35 | 37 |
import org.eclipse.jface.viewers.TreeViewer; |
36 | 38 |
import org.eclipse.swt.SWT; |
... | ... | |
52 | 54 |
import eu.etaxonomy.cdm.model.taxon.TaxonNodeByNameComparator; |
53 | 55 |
import eu.etaxonomy.cdm.model.taxon.TaxonNodeByRankAndNameComparator; |
54 | 56 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
57 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
|
55 | 58 |
import eu.etaxonomy.taxeditor.model.DataChangeBridge; |
56 | 59 |
import eu.etaxonomy.taxeditor.model.IContextListener; |
57 | 60 |
import eu.etaxonomy.taxeditor.model.IDataChangeBehavior; |
... | ... | |
121 | 124 |
|
122 | 125 |
viewer.setContentProvider(new TaxonNavigatorContentProviderE4()); |
123 | 126 |
viewer.setLabelProvider(new TaxonNavigatorLabelProviderE4()); |
127 |
viewer.addDoubleClickListener(event->{ |
|
128 |
ISelection selection = event.getSelection(); |
|
129 |
if(selection instanceof IStructuredSelection){ |
|
130 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
|
131 |
try { |
|
132 |
if(firstElement instanceof TaxonNode){ |
|
133 |
EditorUtil.openTaxonNodeE4(((TaxonNode) firstElement).getUuid()); |
|
134 |
} |
|
135 |
else if(firstElement instanceof Classification){ |
|
136 |
NavigationUtil.openClassificationWizard((Classification) firstElement, viewer.getControl().getShell()); |
|
137 |
} |
|
138 |
} catch (Exception e) { |
|
139 |
// TODO Auto-generated catch block |
|
140 |
e.printStackTrace(); |
|
141 |
} |
|
142 |
} |
|
143 |
}); |
|
124 | 144 |
|
125 | 145 |
//propagate selection |
126 | 146 |
selectionChangedListener = (event -> selService.setSelection(event.getSelection())); |
... | ... | |
324 | 344 |
return true; |
325 | 345 |
} |
326 | 346 |
|
327 |
//FIXME E4 migrate double click |
|
328 |
// /** {@inheritDoc} */ |
|
329 |
// @Override |
|
330 |
// protected void handleDoubleClick(DoubleClickEvent event) { |
|
331 |
// ISelection selection = event.getSelection(); |
|
332 |
// if(selection instanceof IStructuredSelection){ |
|
333 |
// Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
|
334 |
// if(firstElement instanceof ICdmBase){ |
|
335 |
// NavigationUtil.openEditor((ICdmBase) firstElement); |
|
336 |
// } |
|
337 |
// } |
|
338 |
// // If the double click is passed up to the super-class it will |
|
339 |
// // expand/collapse trees. |
|
340 |
// // We do not want that |
|
341 |
// // super.handleDoubleClick(anEvent); |
|
342 |
// } |
|
343 |
|
|
344 | 347 |
@Override |
345 | 348 |
public boolean onComplete() { |
346 | 349 |
return true; |
Also available in: Unified diff
ref #6909 Add double-click listener