/** All selection must be named model objects. */
  @Override
  public void dragStart(DragSourceEvent event) {

    // Workaround for 1GEUS9V
    DragSource dragSource = (DragSource) event.widget;
    Control control = dragSource.getControl();
    if (control != control.getDisplay().getFocusControl()) {
      event.doit = false;
      return;
    }

    event.doit = canDrag();
  }
 /** Returns the data to be transferred in a drag and drop operation. */
 @Override
 public void dragSetData(DragSourceEvent event) {
   if (event.doit == false) return;
   if (ModelDataTransfer.getInstance().isSupportedType(event.dataType)) {
     event.data = getSelectedModelObjects();
     fDragData = event.data;
     return;
   }
   if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
     event.data =
         createTextualRepresentation((IStructuredSelection) fSelectionProvider.getSelection());
     fDragData = null;
     return;
   }
 }
Exemplo n.º 3
0
 /**
  * This implementation of <code>dragStart</code> will create a default image that will be used
  * during the drag. The image should be disposed when the drag is completed in the <code>
  * TableDragSourceEffect.dragFinished</code> method.
  *
  * <p>Subclasses that override this method should call <code>super.dragStart(event)</code> to use
  * the image from the default implementation.
  *
  * @param event the information associated with the drag start event
  */
 public void dragStart(DragSourceEvent event) {
   event.image = getDragSourceImage(event);
 }
Exemplo n.º 4
0
 /** @param e the event */
 public void dragExit(DragSourceEvent e) {
   System.out.println("draglabel exit " + e);
   DragSourceContext context = e.getDragSourceContext();
 }