Search in sources :

Example 1 with DelegatingDragAdapter

use of org.eclipse.jface.util.DelegatingDragAdapter in project webtools.sourceediting by eclipse.

the class ConfigurableContentOutlinePage method createControl.

/**
 * @see ContentOutlinePage#createControl
 */
public void createControl(Composite parent) {
    super.createControl(parent);
    getTreeViewer().setUseHashlookup(true);
    ColumnViewerToolTipSupport.enableFor(getTreeViewer());
    IWorkbenchPage page = getSite().getWorkbenchWindow().getActivePage();
    if (page != null) {
        fEditor = page.getActiveEditor();
    }
    fDragAdapter = new DelegatingDragAdapter();
    fDragSource = new DragSource(getControl(), DND.DROP_COPY | DND.DROP_MOVE);
    fDropAdapter = new DelegatingDropAdapter();
    fDropTarget = new DropTarget(getControl(), DND.DROP_COPY | DND.DROP_MOVE);
    setConfiguration(getConfiguration());
    /*
		 * ContentOutlinePage only implements ISelectionProvider while the
		 * tree viewer implements both ISelectionProvider and
		 * IPostSelectionProvider. Use an ISelectionProvider that listens to
		 * post selection from the tree viewer and forward only post selection
		 * to the selection service.
		 */
    getTreeViewer().addPostSelectionChangedListener(fSelectionProvider.getPostSelectionChangedListener());
    getTreeViewer().addSelectionChangedListener(fSelectionProvider.getSelectionChangedListener());
    if (fDoubleClickProvider == null) {
        fDoubleClickProvider = new DoubleClickProvider();
    }
    getTreeViewer().addDoubleClickListener(fDoubleClickProvider);
    getSite().setSelectionProvider(fSelectionProvider);
}
Also used : DelegatingDropAdapter(org.eclipse.jface.util.DelegatingDropAdapter) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) DelegatingDragAdapter(org.eclipse.jface.util.DelegatingDragAdapter) DragSource(org.eclipse.swt.dnd.DragSource) DropTarget(org.eclipse.swt.dnd.DropTarget)

Example 2 with DelegatingDragAdapter

use of org.eclipse.jface.util.DelegatingDragAdapter in project mylyn.docs by eclipse.

the class DndConfigurationStrategy method configure.

public void configure(CommandManager commandManager, Control control, ISelectionProvider provider) {
    dragAdapter = new DelegatingDragAdapter();
    dragSource = new DragSource(control, DND.DROP_COPY | DND.DROP_MOVE);
    dragAdapter.addDragSourceListener(new OutlineDragSourceListener(provider));
    dragSource.addDragListener(dragAdapter);
    dragSource.setTransfer(dragAdapter.getTransfers());
    dropAdapter = new DelegatingDropAdapter();
    dropTarget = new DropTarget(control, DND.DROP_COPY | DND.DROP_MOVE);
    dropAdapter.addDropTargetListener(new OutlineDropTargetListener(commandManager));
    dropTarget.addDropListener(dropAdapter);
    dropTarget.setTransfer(dropAdapter.getTransfers());
}
Also used : DelegatingDropAdapter(org.eclipse.jface.util.DelegatingDropAdapter) DelegatingDragAdapter(org.eclipse.jface.util.DelegatingDragAdapter) DragSource(org.eclipse.swt.dnd.DragSource) DropTarget(org.eclipse.swt.dnd.DropTarget)

Aggregations

DelegatingDragAdapter (org.eclipse.jface.util.DelegatingDragAdapter)2 DelegatingDropAdapter (org.eclipse.jface.util.DelegatingDropAdapter)2 DragSource (org.eclipse.swt.dnd.DragSource)2 DropTarget (org.eclipse.swt.dnd.DropTarget)2 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1