Revision fb76c216
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorE4.java | ||
---|---|---|
25 | 25 |
import javax.annotation.PreDestroy; |
26 | 26 |
import javax.inject.Inject; |
27 | 27 |
|
28 |
import org.eclipse.core.commands.operations.UndoContext; |
|
28 | 29 |
import org.eclipse.core.runtime.IAdaptable; |
29 | 30 |
import org.eclipse.core.runtime.IProgressMonitor; |
30 | 31 |
import org.eclipse.e4.ui.di.Focus; |
32 |
import org.eclipse.e4.ui.di.UISynchronize; |
|
31 | 33 |
import org.eclipse.e4.ui.services.EMenuService; |
32 | 34 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
35 |
import org.eclipse.jface.util.LocalSelectionTransfer; |
|
33 | 36 |
import org.eclipse.jface.viewers.ISelection; |
34 | 37 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
35 | 38 |
import org.eclipse.jface.viewers.IStructuredSelection; |
36 | 39 |
import org.eclipse.jface.viewers.TreePath; |
37 | 40 |
import org.eclipse.jface.viewers.TreeViewer; |
38 | 41 |
import org.eclipse.swt.SWT; |
42 |
import org.eclipse.swt.dnd.DND; |
|
43 |
import org.eclipse.swt.dnd.Transfer; |
|
39 | 44 |
import org.eclipse.swt.layout.FillLayout; |
40 | 45 |
import org.eclipse.swt.widgets.Composite; |
41 | 46 |
import org.eclipse.ui.IMemento; |
... | ... | |
87 | 92 |
|
88 | 93 |
private static final String TREE_PATHS = "treepaths"; //$NON-NLS-1$ |
89 | 94 |
|
95 |
private final int dndOperations = DND.DROP_MOVE; |
|
96 |
|
|
90 | 97 |
private ConversationHolder conversation; |
91 | 98 |
|
92 | 99 |
private ICdmEntitySession cdmEntitySession; |
... | ... | |
100 | 107 |
@Inject |
101 | 108 |
private ESelectionService selService; |
102 | 109 |
|
110 |
@Inject |
|
111 |
private UISynchronize sync; |
|
112 |
|
|
103 | 113 |
private ISelectionChangedListener selectionChangedListener; |
104 | 114 |
|
105 |
@Inject |
|
115 |
private UndoContext undoContext; |
|
116 |
|
|
117 |
@Inject |
|
106 | 118 |
public TaxonNavigatorE4() { |
119 |
undoContext = new UndoContext(); |
|
107 | 120 |
CdmStore.getContextManager().addContextListener(this); |
108 | 121 |
} |
109 | 122 |
|
... | ... | |
136 | 149 |
|
137 | 150 |
//create context menu |
138 | 151 |
menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.navigator.popupmenu.taxonnavigator"); |
139 |
menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.store.menu.import"); |
|
152 |
|
|
153 |
//add drag'n'drop support |
|
154 |
Transfer[] transfers = new Transfer[] {LocalSelectionTransfer.getTransfer()}; |
|
155 |
viewer.addDragSupport(dndOperations, transfers, new TreeNodeDragListenerE4(viewer)); |
|
156 |
viewer.addDropSupport(dndOperations, transfers, new TreeNodeDropAdapterE4(this)); |
|
140 | 157 |
|
141 | 158 |
init(); |
142 | 159 |
} |
... | ... | |
326 | 343 |
} |
327 | 344 |
} |
328 | 345 |
|
346 |
public UISynchronize getSync() { |
|
347 |
return sync; |
|
348 |
} |
|
349 |
|
|
350 |
public TreeViewer getViewer() { |
|
351 |
return viewer; |
|
352 |
} |
|
353 |
|
|
354 |
public UndoContext getUndoContext() { |
|
355 |
return undoContext; |
|
356 |
} |
|
357 |
|
|
329 | 358 |
/** {@inheritDoc} */ |
330 | 359 |
@Override |
331 | 360 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
332 |
// nothing to do here
|
|
361 |
viewer.refresh();
|
|
333 | 362 |
return true; |
334 | 363 |
} |
335 | 364 |
|
Also available in: Unified diff
ref #6909 migrate dnd for navigator