Java 类org.eclipse.swt.dnd.DragSource 实例源码

项目:convertigo-eclipse    文件:SourcePickerView.java   
private void createXhtmlTree() {
    sourcePicker.createXhtmlTree(treesSashForm);

    // DND support
    int ops = DND.DROP_COPY | DND.DROP_MOVE;
    Transfer[] transfers = new Transfer[] {StepSourceTransfer.getInstance()};

    DragSource source = new DragSource(sourcePicker.getTwsDomTree().getTree(), ops);
    source.setTransfer(transfers);
    source.addDragListener(new DragSourceAdapter() {            
        @Override
        public void dragStart(DragSourceEvent event) {
            event.doit = true;
            StepSourceTransfer.getInstance().setStepSource(sourcePicker.getDragData());
        }
    });

}
项目:Hydrograph    文件:CategoriesDialogSourceComposite.java   
private void addDragSupport(final List sourcePackageList, final Combo comboJarList) {
    DragSource dragSource = ExpressionEditorUtil.INSTANCE.getDragSource(sourcePackageList);
    dragSource.addDragListener(new DragSourceAdapter() {
        public void dragSetData(DragSourceEvent event) {
            event.data = formatDataToTransfer(sourcePackageList.getSelection());
        }

        private Object formatDataToTransfer(String[] selection) {
            StringBuffer buffer = new StringBuffer();
            for (String field : selection) {
                buffer.append(field + Constants.DOT + Constants.ASTERISK + SWT.SPACE + Constants.DASH + SWT.SPACE
                        + comboJarList.getItem(comboJarList.getSelectionIndex())
                        + Constants.FIELD_SEPRATOR_FOR_DRAG_DROP);
            }
            return buffer.toString();
        }
    });
}
项目:Hydrograph    文件:ELTSWTWidgets.java   
public void applyDragFromTableViewer(Control sourceControl, int index) {
    Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
    final String portLabel = "in" + index + ".";
    int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
    final Table table = (Table) sourceControl;
    DragSource source = new DragSource(table, operations);
    source.setTransfer(types);
    final String[] columnData = new String[1];
    source.addDragListener(new DragSourceAdapter() {
        public void dragSetData(DragSourceEvent event) {
            // Set the data to be the first selected item's text
            event.data = addDelimeter(portLabel, table.getSelection());
        }
    });

}
项目:bts    文件:SWTUtil.java   
/**
 * Returns the shell for the given widget. If the widget doesn't represent a
 * SWT object that manage a shell, <code>null</code> is returned.
 * 
 * @param widget
 *            the widget
 * 
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget) {
    if (widget instanceof Control)
        return ((Control) widget).getShell();
    if (widget instanceof Caret)
        return ((Caret) widget).getParent().getShell();
    if (widget instanceof DragSource)
        return ((DragSource) widget).getControl().getShell();
    if (widget instanceof DropTarget)
        return ((DropTarget) widget).getControl().getShell();
    if (widget instanceof Menu)
        return ((Menu) widget).getParent().getShell();
    if (widget instanceof ScrollBar)
        return ((ScrollBar) widget).getParent().getShell();

    return null;
}
项目:PDFReporter-Studio    文件:DataAdapterDragSourceListener.java   
private List<MDataAdapter> getDragSelection(DragSourceEvent event){
    if(event.getSource() instanceof DragSource){
        List<MDataAdapter> dataAdapters = new ArrayList<MDataAdapter>();
        Control control = ((DragSource)event.getSource()).getControl();
        if(control instanceof Tree && 
                ((Tree) control).getSelection().length>0){
            for(TreeItem tItem : ((Tree) control).getSelection()){
                Object data = tItem.getData();
                if(data instanceof MDataAdapter){
                    dataAdapters.add((MDataAdapter) data);
                }
            }
            return dataAdapters;                
        }
    }
    return new ArrayList<MDataAdapter>(0);
}
项目:APICloud-Studio    文件:SWTUtil.java   
/**
 * Returns the shell for the given widget. If the widget doesn't represent a SWT object that manage a shell,
 * <code>null</code> is returned.
 * 
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget)
{
    if (widget instanceof Control)
        return ((Control) widget).getShell();
    if (widget instanceof Caret)
        return ((Caret) widget).getParent().getShell();
    if (widget instanceof DragSource)
        return ((DragSource) widget).getControl().getShell();
    if (widget instanceof DropTarget)
        return ((DropTarget) widget).getControl().getShell();
    if (widget instanceof Menu)
        return ((Menu) widget).getParent().getShell();
    if (widget instanceof ScrollBar)
        return ((ScrollBar) widget).getParent().getShell();

    return null;
}
项目:OpenSPIFe    文件:ResourceTreeDragSourceListener.java   
@Override
protected ITransferable getTransferable(DragSource source, long time) {
    ISelection selection = viewer.getSelection();
    if (!(selection instanceof StructuredSelection)) {
        return null;
    }

    List<ENumericResourceDef> nrdefs = getNumericResourceDefs(selection);

    List<EStateResourceDef> srdefs = getStateResourceDefs(selection);
    if (nrdefs.size() == 0 && srdefs.size() == 0) {
        return null;
    } else
    if (nrdefs.size() != 0 && srdefs.size() != 0) {
        return null;
    }

    // one is guranteed to have defs in it
    if (nrdefs.size() > 0) {
        return new NumericResourceDefTransferable(nrdefs);
    } // else...
    return new StateResourceDefTransferable(srdefs);
}
项目:Eclipse-Postfix-Code-Completion    文件:SWTUtil.java   
/**
 * Returns the shell for the given widget. If the widget doesn't represent
 * a SWT object that manage a shell, <code>null</code> is returned.
 * @param widget the widget
 *
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget) {
    if (widget instanceof Control)
        return ((Control)widget).getShell();
    if (widget instanceof Caret)
        return ((Caret)widget).getParent().getShell();
    if (widget instanceof DragSource)
        return ((DragSource)widget).getControl().getShell();
    if (widget instanceof DropTarget)
        return ((DropTarget)widget).getControl().getShell();
    if (widget instanceof Menu)
        return ((Menu)widget).getParent().getShell();
    if (widget instanceof ScrollBar)
        return ((ScrollBar)widget).getParent().getShell();

    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SWTUtil.java   
/**
 * Returns the shell for the given widget. If the widget doesn't represent
 * a SWT object that manage a shell, <code>null</code> is returned.
 * @param widget the widget
 *
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget) {
    if (widget instanceof Control)
        return ((Control)widget).getShell();
    if (widget instanceof Caret)
        return ((Caret)widget).getParent().getShell();
    if (widget instanceof DragSource)
        return ((DragSource)widget).getControl().getShell();
    if (widget instanceof DropTarget)
        return ((DropTarget)widget).getControl().getShell();
    if (widget instanceof Menu)
        return ((Menu)widget).getParent().getShell();
    if (widget instanceof ScrollBar)
        return ((ScrollBar)widget).getParent().getShell();

    return null;
}
项目:Pydev    文件:SWTUtil.java   
/**
 * Returns the shell for the given widget. If the widget doesn't represent
 * a SWT object that manage a shell, <code>null</code> is returned.
 * @param widget the widget
 *
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget) {
    if (widget instanceof Control) {
        return ((Control) widget).getShell();
    }
    if (widget instanceof Caret) {
        return ((Caret) widget).getParent().getShell();
    }
    if (widget instanceof DragSource) {
        return ((DragSource) widget).getControl().getShell();
    }
    if (widget instanceof DropTarget) {
        return ((DropTarget) widget).getControl().getShell();
    }
    if (widget instanceof Menu) {
        return ((Menu) widget).getParent().getShell();
    }
    if (widget instanceof ScrollBar) {
        return ((ScrollBar) widget).getParent().getShell();
    }

    return null;
}
项目:JavaFX-FrameRateMeter    文件:OldFXCanvas.java   
@Override
public void setEmbeddedScene(EmbeddedSceneInterface embeddedScene) {
    scenePeer = embeddedScene;
    if (scenePeer == null) {
        return;
    }
    if (pWidth > 0 && pHeight > 0) {
        scenePeer.setSize(pWidth, pHeight);
    }
    double scaleFactor = getScaleFactor();
    resizePixelBuffer(scaleFactor);
    lastScaleFactor = scaleFactor;
    scenePeer.setPixelScaleFactor((float)scaleFactor);
    scenePeer.setDragStartListener((fxDragSource, dragAction) -> {
        Platform.runLater(() -> {
            DragSource dragSource = createDragSource(fxDragSource, dragAction);
            if (dragSource == null) {
                fxDragSource.dragDropEnd(null);
            } else {
                updateDropTarget();
                OldFXCanvas.this.notifyListeners(SWT.DragDetect, null);
            }
        });
    });
    //Force the old drop target to be disposed before creating a new one
    setDropTarget(null);
    setDropTarget(createDropTarget(embeddedScene));
}
项目:Hydrograph    文件:ExpressionEditorUtil.java   
public void addDragSupport(final Control widget) {
    DragSource dragSource = getDragSource(widget);
    dragSource.addDragListener(new DragSourceAdapter() {
        public void dragSetData(DragSourceEvent event) { 
            if (widget instanceof Table) {
                event.data = formatDataToTransfer(((Table) widget).getSelection());
            }
            if (widget instanceof List) {
                event.data = formatDataToTransfer(((List) widget).getSelection());
            }
        }
    });
}
项目:Hydrograph    文件:ExcelFormattingDialog.java   
private void attachDragListener() {
    dragSource = new DragSource(table_1, DND.DROP_MOVE);
    dragSource.setTransfer(new Transfer[] { TextTransfer.getInstance() });
    dragSource.addDragListener(new DragSourceAdapter() {
        public void dragSetData(DragSourceEvent event) {
            // Set the data to be the first selected item's text
            event.data = formatDataToTransfer(table_1.getSelection());
        }

    });
}
项目:Hydrograph    文件:SecondaryColumnKeysDialog.java   
private void createSourceTable(Composite composite_2) {
    sourceTable = new Table(composite_2, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    sourceTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDoubleClick(MouseEvent e) {
            if(sourceTable.getSelection().length==1){
                addNewProperty(targetTableViewer, sourceTable.getSelection()[0].getText());
                enableControlButtons();
            }
        }
    });
    GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
    gd_table.widthHint = 221;
    gd_table.heightHint = 407;
    sourceTable.setLayoutData(gd_table);
    sourceTable.setHeaderVisible(true);
    sourceTable.setLinesVisible(true);

    TableColumn sourceTableColumnFieldName = new TableColumn(sourceTable, SWT.LEFT);
    if(OSValidator.isMac()){
        sourceTableColumnFieldName.setWidth(212);
    }else{
        sourceTableColumnFieldName.setWidth(202);
    }

    sourceTableColumnFieldName.setText(Messages.AVAILABLE_FIELDS_HEADER);
    getSourceFieldsFromPropagatedSchema(sourceTable);
    dragSource = new DragSource(sourceTable, DND.DROP_MOVE);
    dragSource.setTransfer(new Transfer[] { TextTransfer.getInstance() });
    dragSource.addDragListener(new DragSourceAdapter() {
        public void dragSetData(DragSourceEvent event) {
            // Set the data to be the first selected item's text
            event.data = formatDataToTransfer(sourceTable.getSelection());
        }

    });
}
项目:Hydrograph    文件:AvailableFieldComposite.java   
private void addDoubleClickListener(TableViewer availableFieldtableViewer) {
    DragSource  dragSource = new DragSource(availableFieldsTable, DND.DROP_COPY);
    dragSource.setTransfer(new Transfer[] { ObjectTransfer.getInstance() });

    dragSource.addDragListener(new DragSourceAdapter() {
        public void dragSetData(DragSourceEvent event) { // Set the data to be the first selected item's text
            List<Object> list=new ArrayList<Object>();
            for(TableItem tableItem:availableFieldsTable.getSelection()){
                list.add(tableItem.getData());
            }
            event.data=list.toArray(new Object[list.size()]);
        }
    });
}
项目:fluentmark    文件:DndConfigurationStrategy.java   
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());
    }
项目:triquetrum    文件:PaletteTreeViewer.java   
/**
 * Creates or disposes a DragSource as needed, and sets the supported transfer types. Clients should not need to call or
 * override this method.
 */
@Override
protected void refreshDragSourceAdapter() {
  if (getControl() == null)
    return;
  if (getDelegatingDragAdapter().isEmpty())
    setDragSource(null);
  else {
    if (getDragSource() == null)
      setDragSource(new DragSource(getTreeControl(), DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK));
    getDragSource().setTransfer(getDelegatingDragAdapter().getTransfers());
  }
}
项目:PDFReporter-Studio    文件:CrosstabStyleView.java   
/**
 * Add the drag support to the element of the gallery
 */
private void addDragSupport() {
    int operations = DND.DROP_MOVE;
    final Transfer[] types = new Transfer[] { CrosstrabRestrictedTransferType.getInstance() };
    DragSource source = new DragSource(checkedGallery, operations);
    source.setTransfer(types);
    source.addDragListener(new StyleDragListener());
}
项目:PDFReporter-Studio    文件:TableStyleView.java   
/**
 * Add the drag support
 */
private void addDragSupport() {
    int operations = DND.DROP_MOVE;
    final Transfer[] types = new Transfer[] { TableRestrictedTransferType.getInstance() };
    DragSource source = new DragSource(checkedGallery, operations);
    source.setTransfer(types);
    source.addDragListener(new StyleDragListener());
}
项目:PDFReporter-Studio    文件:TextStyleView.java   
/**
 * Add the drag support to move a text template on a textual element
 * 
 * @param control control where the drag operation where added
 */
private void addDragSupport(Control control) {
    int operations = DND.DROP_MOVE;
    final Transfer[] types = new Transfer[] { TextRestrictedTransferType.getInstance() };
    DragSource source = new DragSource(control, operations);
    source.setTransfer(types);
    source.addDragListener(new StyleDragListener(control));
}
项目:jo-widgets    文件:SwtDragSource.java   
private void createDragSourceIfNecessary() {
    if (dragSource == null && isActive() && !EmptyCheck.isEmpty(actions) && !EmptyCheck.isEmpty(supportedTypes)) {
        this.dragSource = new DragSource(control, DragDropUtil.createOperations(actions));
        dragSource.setTransfer(DragDropUtil.createTransfers(supportedTypes));
        dragSource.addDragListener(new DragSourceListenerImpl());
    }
}
项目:OpenSPIFe    文件:ProfileTreeDragSourceListener.java   
@Override
protected ITransferable getTransferable(DragSource source, long time) {
    ISelection selection = viewer.getSelection();
    if (selection instanceof StructuredSelection) {
        List<Profile> profiles = getResourceProfiles(selection);
        if (!profiles.isEmpty()) {
            return new ProfileTransferable(profiles);
        }
    }
    return null;
}
项目:OpenSPIFe    文件:EnsembleDragAndDropOracle.java   
public static synchronized void releaseDragging(DragSource source) {
    if (currentDragSource != source) {
        LogUtil.warn("current drag source released from wrong model");
    }
    currentDragSource = null;
    currentDropTarget = null;
}
项目:OpenSPIFe    文件:AbstractTreeViewerDragSourceListener.java   
@Override
protected boolean isDragPossible(DragSource source, long time) {
    transferable = getTransferable(source, time);
    if (transferable == null) {
        return false;
    }
    Transfer transfers[] = TransferRegistry.getInstance().getTransfersFor(transferable);
    source.setTransfer(transfers);
    viewer.cancelEditing();
    return true;
}
项目:OpenSPIFe    文件:AbstractTreeViewerDragSourceListener.java   
@Override
protected void finishDrag(DragSource source, long time, boolean doit, int detail) {
    if (doit) {
        // Nothing to do here since we typically create an undoable operation
        // in the drop listener which actually does all the work.
    }
    transferable = null;
}
项目:OpenSPIFe    文件:TreeTableViewerDragSourceListener.java   
@Override
protected ITransferable getTransferable(DragSource source, long time) {
    ISelection selection = viewer.getSelection();
    TreeTableContentProvider contentProvider = (TreeTableContentProvider)viewer.getContentProvider();
    IStructureModifier modifier = contentProvider.getStructureModifier();
    return modifier.getTransferable(selection);
}
项目:DropTillLate_Application    文件:ViewController.java   
/**
 * Register DragDropAdapter
 */
private void registerDragDrop() {
    // Drag-Part //////////////////////////////////////////////////////////
    DragSource source = new DragSource(tree, DND.DROP_COPY | DND.DROP_MOVE);
    source.setTransfer(new Transfer[] { TextTransfer.getInstance() });
    source.addDragListener(new TreeDragSourceListener(tree));

    // Drop-Part //////////////////////////////////////////////////////////
    DropTarget dropTarget = new DropTarget(tree, DND.DROP_COPY
            | DND.DROP_DEFAULT);
    dropTarget.setTransfer(new Transfer[] { TextTransfer.getInstance(),
            FileTransfer.getInstance() });
    dropTarget.addDropListener(new TreeDropTargetAdapter(viewer, root));
}
项目:gef-gwt    文件:AbstractEditPartViewer.java   
/**
 * Creates or disposes a DragSource as needed, and sets the supported
 * transfer types. Clients should not need to call or override this method.
 */
protected void refreshDragSourceAdapter() {
    if (getControl() == null)
        return;
    if (getDelegatingDragAdapter().isEmpty())
        setDragSource(null);
    else {
        if (getDragSource() == null)
            setDragSource(new DragSource(getControl(), DND.DROP_MOVE
                    | DND.DROP_COPY | DND.DROP_LINK));
        getDragSource().setTransfer(
                getDelegatingDragAdapter().getTransfers());
    }
}
项目:gef-gwt    文件:AbstractEditPartViewer.java   
/**
 * Sets the drag source. Called from {@link #refreshDragSourceAdapter()}.
 * 
 * @param source
 *            <code>null</code> or a drag source
 */
protected void setDragSource(DragSource source) {
    if (dragSource != null)
        dragSource.dispose();
    dragSource = source;
    if (dragSource != null)
        hookDragSource();
}
项目:gef-gwt    文件:DelegatingDragAdapter.java   
/**
   * A drag operation has started.
   * Forwards this event to each listener. A listener must set <code>event.doit</code> 
   * to <code>false</code> if it cannot handle the drag operation. If a listener can  
   * handle the drag, it is added to the list of active listeners.  
   * The drag is aborted if there are no listeners that can handle it.  
   * 
   * @param event the drag source event
   * @see DragSourceListener#dragStart(DragSourceEvent)
   */
  public void dragStart(final DragSourceEvent event) {
      //        if (Policy.DEBUG_DRAG_DROP)
      //            System.out.println("Drag Start: " + toString()); //$NON-NLS-1$
      boolean doit = false; // true if any one of the listeners can handle the drag
      List transfers = new ArrayList(listeners.size());

      activeListeners.clear();
      for (int i = 0; i < listeners.size(); i++) {
          final TransferDragSourceListener listener = (TransferDragSourceListener) listeners
                  .get(i);
          event.doit = true; // restore event.doit
          SafeRunnable.run(new SafeRunnable() {
              public void run() throws Exception {
                  listener.dragStart(event);
              }
          });
          if (event.doit) { // the listener can handle this drag
              transfers.add(listener.getTransfer());
              activeListeners.add(listener);
          }
          doit |= event.doit;
      }

      if (doit) {
    ((DragSource) event.widget).setTransfer((Transfer[]) transfers
                  .toArray(new Transfer[transfers.size()]));
}

      event.doit = doit;
  }
项目:JXTN    文件:FXCanvas.java   
@Override
public void setEmbeddedScene(EmbeddedSceneInterface embeddedScene) {
    FXCanvas.this.scenePeer = embeddedScene;
    if (FXCanvas.this.scenePeer == null) {
        return;
    }
    if (FXCanvas.this.pWidth > 0 && FXCanvas.this.pHeight > 0) {
        FXCanvas.this.scenePeer.setSize(FXCanvas.this.pWidth, FXCanvas.this.pHeight);
    }
    double scaleFactor = FXCanvas.this.getScaleFactor();
    FXCanvas.this.resizePixelBuffer(scaleFactor);
    FXCanvas.this.lastScaleFactor = scaleFactor;
    FXCanvas.this.scenePeer.setPixelScaleFactor((float)scaleFactor);
    FXCanvas.this.scenePeer.setDragStartListener((fxDragSource, dragAction) -> {
        Platform.runLater(() -> {
            DragSource dragSource = this.createDragSource(fxDragSource, dragAction);
            if (dragSource == null) {
                fxDragSource.dragDropEnd(null);
            } else {
                updateDropTarget();
                FXCanvas.this.notifyListeners(SWT.DragDetect, null);
            }
        });
    });
    //Force the old drop target to be disposed before creating a new one
    FXCanvas.this.setDropTarget(null);
    FXCanvas.this.setDropTarget(this.createDropTarget(embeddedScene));
}
项目:codeexamples-eclipse    文件:View.java   
private void addDragListener(Control control) {
    LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();

    DragSourceAdapter dragAdapter = new DragSourceAdapter() {
        @Override
        public void dragSetData(DragSourceEvent event) {
            transfer.setSelection(new StructuredSelection(control));
        }
    };

    DragSource dragSource = new DragSource(control, DND.DROP_MOVE | DND.DROP_COPY);
    dragSource.setTransfer(new Transfer[] { transfer });
    dragSource.addDragListener(dragAdapter);
}
项目:birt    文件:CustomPreviewTable.java   
protected void addDragListenerToHeaderButton( Button button )
{
    DragSource ds = new DragSource( button, DND.DROP_COPY );
    ds.setTransfer( new Transfer[]{
        SimpleTextTransfer.getInstance( )
    } );
    CustomPreviewTableDragListener dragSourceAdapter = new CustomPreviewTableDragListener( this,
            button.getText( ) );
    ds.addDragListener( dragSourceAdapter );
}
项目:birt    文件:CubeGroupContent.java   
private void createDataField( )
{
    Composite dataField = new Composite( this, SWT.NONE );
    dataField.setLayoutData( new GridData( GridData.FILL_BOTH ) );
    dataField.setLayout( new GridLayout( ) );

    Label dataLabel = new Label( dataField, SWT.NONE );
    dataLabel.setText( Messages.getString( "GroupsPage.Label.DataField" ) ); //$NON-NLS-1$
    dataFieldsViewer = new TreeViewer( dataField, SWT.SINGLE
            | SWT.H_SCROLL
            | SWT.V_SCROLL
            | SWT.BORDER );
    cubeLabelProvider = getCubeLabelProvider( );
    cubeLabelProvider.setProivderViewer( true );
    dataFieldsViewer.setLabelProvider( cubeLabelProvider );
    dataFieldsViewer.setContentProvider( dataContentProvider );
    dataFieldsViewer.setAutoExpandLevel( 3 );
    GridData gd = new GridData( GridData.FILL_BOTH );
    dataFieldsViewer.getTree( ).setLayoutData( gd );
    ( (GridData) dataFieldsViewer.getTree( ).getLayoutData( ) ).heightHint = 250;
    ( (GridData) dataFieldsViewer.getTree( ).getLayoutData( ) ).widthHint = 200;
    dataFieldsViewer.addSelectionChangedListener( new ISelectionChangedListener( ) {

        public void selectionChanged( SelectionChangedEvent event )
        {
            updateButtons( );
        }

    } );

    final DragSource fieldsSource = new DragSource( dataFieldsViewer.getTree( ),
            operations );
    fieldsSource.setTransfer( types );
    fieldsSource.addDragListener( new CustomDragListener( dataFieldsViewer ) );

}
项目:xiliary    文件:ScrolledCompositeAdapterTest.java   
@Test
public void disposalWithDragSourceOnScrolledComposite() {
  ScrolledComposite scrolledComposite = new TestScrolledCompositeFactory().create( shell );
  ScrollableAdapterFactoryHelper.adapt( scrolledComposite, ScrolledCompositeAdapter.class );
  DragSource dragSource = new DragSource( scrolledComposite, DND.DROP_MOVE | DND.DROP_COPY );

  shell.dispose();

  assertThat( dragSource.isDisposed() ).isTrue();
}
项目:xiliary    文件:StyledTextAdapterTest.java   
@Test
public void disposalWithDragSourceOnStyledText() {
  StyledText styledText = new TestStyledTextFactory().create( shell );
  ScrollableAdapterFactoryHelper.adapt( styledText, StyledTextAdapter.class );
  DragSource dragSource = new DragSource( styledText, DND.DROP_MOVE | DND.DROP_COPY );

  shell.dispose();

  assertThat( dragSource.isDisposed() ).isTrue();
}
项目:xiliary    文件:TreeAdapterTest.java   
@Test
public void disposalWithDragSourceOnTree() {
  Tree tree = new TestTreeFactory().create( shell );
  ScrollableAdapterFactoryHelper.adapt( tree, TreeAdapter.class );
  DragSource dragSource = new DragSource( tree, DND.DROP_MOVE | DND.DROP_COPY );

  shell.dispose();

  assertThat( dragSource.isDisposed() ).isTrue();
}
项目:xiliary    文件:DisposalRoutingTest.java   
@Test
public void adaptableDisposalWithDragSource() {
  DragSource dragSource = createDragSource();

  adaptable.dispose();

  assertThat( adapter.isDisposed() ).isTrue();
  assertThat( dragSource.isDisposed() ).isTrue();
}
项目:xiliary    文件:DisposalRoutingTest.java   
@Test
public void adapterDisposalWithDragSource() {
  DragSource dragSource = createDragSource();

  adapter.dispose();

  assertThat( adaptable.isDisposed() ).isTrue();
  assertThat( dragSource.isDisposed() ).isTrue();
}
项目:xiliary    文件:TableAdapterTest.java   
@Test
public void disposalWithDragSourceOnTable() {
  Table table = new TestTableFactory().create( shell );
  ScrollableAdapterFactoryHelper.adapt( table, TableAdapter.class );
  DragSource dragSource = new DragSource( table, DND.DROP_MOVE | DND.DROP_COPY );

  shell.dispose();

  assertThat( dragSource.isDisposed() ).isTrue();
}