Package org.eclipse.swt.dnd

Examples of org.eclipse.swt.dnd.DragSource


     *            cleanup after the drag and drop operation finishes
     * @see org.eclipse.swt.dnd.DND
     */
    public void addDragSupport(final int operations,
            final Transfer[] transferTypes, final DragSourceListener listener) {
        final DragSource dragSource = new DragSource(this, operations);
        dragSource.setTransfer(transferTypes);

        DragSourceListener wrapper = new DragSourceListener() {

            @Override
            public void dragStart(DragSourceEvent event) {
                listener.dragStart(event);
            }

            @Override
            public void dragSetData(DragSourceEvent event) {
                listener.dragSetData(event);
            }

            @Override
            public void dragFinished(DragSourceEvent event) {
                listener.dragFinished(event);
                // ensure to stop any current active internal drag mode
                NatTable.this.modeSupport.switchMode(Mode.NORMAL_MODE);
            }
        };

        dragSource.addDragListener(wrapper);
    }
View Full Code Here


                moveDownAction.attach( moveActionHandlerListener );
               
                final ElementsTransfer transfer = new ElementsTransfer( element().type().getModelElementClass().getClassLoader() );
                final Transfer[] transfers = new Transfer[] { transfer };
               
                final DragSource dragSource = new DragSource( this.table, DND.DROP_COPY | DND.DROP_MOVE );
                dragSource.setTransfer( transfers );

                final List<Element> dragElements = new ArrayList<Element>();
               
                dragSource.addDragListener
                (
                    new DragSourceListener()
                    {
                        public void dragStart( final DragSourceEvent event )
                        {
View Full Code Here

    {
        if ( ConnectionTransfer.getInstance().isSupportedType( event.dataType ) )
        {
            if ( event.widget instanceof DragSource )
            {
                DragSource dragSource = ( DragSource ) event.widget;
                if ( dragSource.getControl() instanceof Tree )
                {
                    List<Object> objectList = new ArrayList<Object>();
                    if ( selection != null )
                    {
                        for ( Iterator<?> iterator = selection.iterator(); iterator.hasNext(); )
View Full Code Here

  }

  private void createDragSource() {
    if (dragSource != null)
      dragSource.dispose();
    dragSource = new DragSource(dragControl, dragOperation);
    dragSource.setTransfer(dragTypes);
    dragSource.addDragListener(new DragSourceListener() {
      public void dragFinished(org.eclipse.swt.dnd.DragSourceEvent event) {
        dragConsole.append(">>dragFinished\n");
        printEvent(event);
View Full Code Here

   * Creates the Drag & Drop DragSource for items being dragged from the table.
   *
   * @return the DragSource for the table
   */
  private DragSource createTableDragSource(final Table table) {
    DragSource dragSource = new DragSource(table, DND.DROP_MOVE | DND.DROP_COPY);
    dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dragSource.addDragListener(new DragSourceListener() {
      TableItem[]  dndSelection  = null;
      String[]  sourceNames    = null;

      public void dragFinished(DragSourceEvent event) {
        dragSourceHandleDragFinished(event, sourceNames);
View Full Code Here

   * Creates the Drag & Drop DragSource for items being dragged from the tree.
   *
   * @return the DragSource for the tree
   */
  private DragSource createTreeDragSource(final Tree tree) {
    DragSource dragSource = new DragSource(tree, DND.DROP_MOVE | DND.DROP_COPY);
    dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dragSource.addDragListener(new DragSourceListener() {
      TreeItem[]  dndSelection  = null;
      String[]  sourceNames    = null;

      public void dragFinished(DragSourceEvent event) {
        dragSourceHandleDragFinished(event, sourceNames);
View Full Code Here

            handleDeletePreviousWord = new HandleDeletePreviousWord();
            handleLineStartAction = new HandleLineStartAction();
        }

        private void initDragDrop() {
            DragSource dragSource = new DragSource(this, DND.DROP_COPY | DND.DROP_MOVE);
            dragSource.addDragListener(new DragSourceAdapter());
            dragSource.setTransfer(new Transfer[] { org.eclipse.swt.dnd.TextTransfer.getInstance() });

            DropTarget dropTarget = new DropTarget(this, DND.DROP_COPY | DND.DROP_MOVE);
            dropTarget.setTransfer(new Transfer[] { LocalSelectionTransfer.getTransfer(),
                    org.eclipse.swt.dnd.TextTransfer.getInstance() });
            dropTarget.addDropListener(new DragTargetAdapter());
View Full Code Here

      addDragSupport(menuHyperlink, operations, transferTypes, listener);
  }

  private DragSource addDragSupport(Control control, int operations,
      Transfer[] transferTypes, DragSourceListener listener) {
    DragSource source = new DragSource(control, operations);
    source.setTransfer(transferTypes);
    source.addDragListener(listener);
    source.setDragSourceEffect(new DragSourceEffect(control) {
      public void dragStart(DragSourceEvent event) {
        event.image = createDragEffectImage();
      }
    });
    return source;
View Full Code Here

        filteredTree.changeFilterText( outline.getFilterText() );
       
        final ElementsTransfer transfer = new ElementsTransfer( getModelElement().type().getModelElementClass().getClassLoader() );
        final Transfer[] transfers = new Transfer[] { transfer };
       
        final DragSource dragSource = new DragSource( tree, DND.DROP_COPY | DND.DROP_MOVE );
        dragSource.setTransfer( transfers );

        final List<Element> dragElements = new ArrayList<Element>();
       
        dragSource.addDragListener
        (
            new DragSourceListener()
            {
                public void dragStart( final DragSourceEvent event )
                {
View Full Code Here

      public void dropAccept(DropTargetEvent event) {
      }
    });


    DragSource source = new DragSource(viewer.getTree(), DND.DROP_COPY);

    source.setTransfer(new Transfer[] { FeatureStructureTransfer.getInstance() });

    source.addDragListener(new DragSourceListener() {
      TreeItem dragSourceItem = null;

      public void dragStart(DragSourceEvent event) {

        event.doit = false;
View Full Code Here

TOP

Related Classes of org.eclipse.swt.dnd.DragSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.