Search in sources :

Example 1 with ReadOnlyAwareDropTargetAdapter

use of org.eclipse.wst.sse.ui.internal.ReadOnlyAwareDropTargetAdapter in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method initializeDrop.

protected void initializeDrop(ITextViewer textViewer) {
    int operations = DND.DROP_COPY | DND.DROP_MOVE;
    fDropTarget = new DropTarget(textViewer.getTextWidget(), operations);
    fDropAdapter = new ReadOnlyAwareDropTargetAdapter(true);
    fDropAdapter.setTargetEditor(this);
    fDropAdapter.setTargetIDs(getConfigurationPoints());
    fDropAdapter.setTextViewer(textViewer);
    fDropTarget.setTransfer(fDropAdapter.getTransfers());
    fDropTarget.addDropListener(fDropAdapter);
    fDropTarget.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            fDropTarget.removeDropListener(fDropAdapter);
            fDropTarget.removeDisposeListener(this);
            fDropTarget.dispose();
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) ReadOnlyAwareDropTargetAdapter(org.eclipse.wst.sse.ui.internal.ReadOnlyAwareDropTargetAdapter) DropTarget(org.eclipse.swt.dnd.DropTarget) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Point(org.eclipse.swt.graphics.Point)

Aggregations

DropTarget (org.eclipse.swt.dnd.DropTarget)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 Point (org.eclipse.swt.graphics.Point)1 ReadOnlyAwareDropTargetAdapter (org.eclipse.wst.sse.ui.internal.ReadOnlyAwareDropTargetAdapter)1