Package org.eclipse.swt.dnd

Examples of org.eclipse.swt.dnd.DropTargetAdapter


    documentSource.setLayoutData(fdata1);
    documentSource.setToolTipText("Document source folder...");
    documentSource.setMessage("Document source folder...");
    DropTarget dt = new DropTarget(documentSource, DND.DROP_DEFAULT | DND.DROP_MOVE);
    dt.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dt.addDropListener(new DropTargetAdapter() {
      @Override
      public void drop(DropTargetEvent event) {
        String fileList[] = null;
        FileTransfer ft = FileTransfer.getInstance();
        if (ft.isSupportedType(event.currentDataType)) {
          fileList = (String[]) event.data;
        }
        if (fileList != null && fileList.length > 0) {
          String fileString = fileList[0];
          documentSource.setText(fileString);
        }
      }
    });

    documentSink = new Text(this, SWT.SINGLE | SWT.BORDER);
    FormData fdatag = new FormData();
    fdatag.width = 200;
    fdatag.left = new FormAttachment(0, 1000, 5);
    fdatag.top = new FormAttachment(0, 1000, 30);
    fdatag.right = new FormAttachment(1000, 1000, -5);
    documentSink.setLayoutData(fdatag);
    documentSink.setToolTipText("Document gold output folder...");
    documentSink.setMessage("Document gold output folder...");
    DropTarget dtg = new DropTarget(documentSink, DND.DROP_DEFAULT | DND.DROP_MOVE);
    dtg.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dtg.addDropListener(new DropTargetAdapter() {
      @Override
      public void drop(DropTargetEvent event) {
        String fileList[] = null;
        FileTransfer ft = FileTransfer.getInstance();
        if (ft.isSupportedType(event.currentDataType)) {
          fileList = (String[]) event.data;
        }
        if (fileList != null && fileList.length > 0) {
          String fileString = fileList[0];
          documentSink.setText(fileString);
        }
      }
    });

    typeSystem = new Text(this, SWT.SINGLE | SWT.BORDER);
    FormData fdata2 = new FormData();
    fdata2.width = 200;
    fdata2.left = new FormAttachment(0, 1000, 5);
    fdata2.top = new FormAttachment(0, 1000, 55);
    fdata2.right = new FormAttachment(1000, 1000, -5);
    typeSystem.setLayoutData(fdata2);
    typeSystem.setToolTipText("Type System...");
    typeSystem.setMessage("Type System...");
    DropTarget dt1 = new DropTarget(typeSystem, DND.DROP_DEFAULT | DND.DROP_MOVE);
    dt1.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dt1.addDropListener(new DropTargetAdapter() {
      @Override
      public void drop(DropTargetEvent event) {
        String fileList[] = null;
        FileTransfer ft = FileTransfer.getInstance();
        if (ft.isSupportedType(event.currentDataType)) {
View Full Code Here


    });
   
    DropTarget dt = new DropTarget(tabFolder,
        DND.DROP_DEFAULT | DND.DROP_MOVE);
    dt.setTransfer(new Transfer[] {FileTransfer.getInstance()});
    dt.addDropListener(new DropTargetAdapter() {
      public void drop(DropTargetEvent ev) {
        for (final String s : (String[])ev.data) {
          TabPanelController.instance().openLocalFileReq(
              new File(s).toURI(),
              Configurer.application.getInt("reader.remote.defaultNrLines"));
View Full Code Here

  private void setupDataManagerViewForDragAndDropInto(Composite parent) {
    DropTarget dropTarget =
        new DropTarget(parent.getParent(), DND.DROP_DEFAULT | DND.DROP_MOVE);
      dropTarget.setTransfer(new Transfer[] { FileTransfer.getInstance() });
      dropTarget.addDropListener(new DropTargetAdapter() {
        @Override
        public void drop(DropTargetEvent event) {
          String fileNames[] = null;
          FileTransfer fileTransfer = FileTransfer.getInstance();
View Full Code Here

        }
      }
    });
   
    // Install drag target
    DropTargetListener dropTargetListener= new DropTargetAdapter() {
     
      private Point fSelection;
     
      public void dragEnter(DropTargetEvent event) {
        fTextDragAndDropToken= null;
View Full Code Here

                // setup drop target
                Transfer[] types = new Transfer[] { LocalSelectionTransfer.getTransfer() };
                DropTarget target = new DropTarget(table, DND.DROP_COPY);
                target.setTransfer(types);
                target.addDropListener(new DropTargetAdapter() {
                    @Override
                    public void dragEnter(DropTargetEvent event) {
                        logger.debug("drag enter: " + event);
                        event.operations = DND.DROP_COPY;
                        event.feedback = DND.FEEDBACK_INSERT_BEFORE;
View Full Code Here

            // Since move is allowed we need a drop target for the left list
            DropTarget leftDropTarget = new DropTarget(leftListController.list,
                    DND.DROP_MOVE);
            leftDropTarget.setTransfer(types);
            leftDropTarget.addDropListener(new DropTargetAdapter() {
                public void dragOver(DropTargetEvent event) {
                    event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
                }

                public void drop(DropTargetEvent event) {
View Full Code Here

        DropTarget rightDropTarget = new DropTarget(selectedItemsList,
                DND.DROP_COPY | DND.DROP_MOVE);

        rightDropTarget.setTransfer(types);

        rightDropTarget.addDropListener(new DropTargetAdapter() {

            public void dragOver(DropTargetEvent event) {
                event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
            }
View Full Code Here

      }
    });
   
     DropTarget dt = new DropTarget(tv.getTree(), DND.DROP_LINK);
     dt.setTransfer(new Transfer[] { TextTransfer.getInstance() });
     dt.addDropListener(new DropTargetAdapter() {
       public void drop(DropTargetEvent event) {
         try{
           String uriStr = String.valueOf(event.data).trim();
           URI uri = URI.create(uriStr);
           HFiles.getInstance().add(new File(uri).getAbsolutePath());
View Full Code Here

      }
    });

    DropTarget dt = new DropTarget(table, DND.DROP_DEFAULT | DND.DROP_MOVE);
    dt.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dt.addDropListener(new DropTargetAdapter() {
      @Override
      public void drop(DropTargetEvent event) {
        String fileList[] = null;
        FileTransfer ft = FileTransfer.getInstance();
        if (ft.isSupportedType(event.currentDataType)) {
          fileList = (String[]) event.data;
        }
        if (fileList != null && fileList.length > 0) {
          for (int i = 0; i < fileList.length; i++) {
            File file = new File(fileList[i]);
            if (file.isDirectory()) {

            } else {
              DocumentData newDocument = new DocumentData(file);
              documentList.add(newDocument);
              tableViewer.setInput(documentList);
              tableViewer.refresh();
            }
          }
        }
      }
    });

    DropTarget dt2 = new DropTarget(inputDirectoryText, DND.DROP_DEFAULT | DND.DROP_MOVE);
    dt2.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dt2.addDropListener(new DropTargetAdapter() {
      @Override
      public void drop(DropTargetEvent event) {
        String fileList[] = null;
        FileTransfer ft = FileTransfer.getInstance();
        if (ft.isSupportedType(event.currentDataType)) {
          fileList = (String[]) event.data;
        }
        if (fileList != null && fileList.length == 1) {
          String string = fileList[0];
          inputDirectoryText.setText(string);
          setDocumentsByDir();
        }
      }
    });

    DropTarget dt3 = new DropTarget(testDirectoryText, DND.DROP_DEFAULT | DND.DROP_MOVE);
    dt3.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dt3.addDropListener(new DropTargetAdapter() {
      @Override
      public void drop(DropTargetEvent event) {
        String fileList[] = null;
        FileTransfer ft = FileTransfer.getInstance();
        if (ft.isSupportedType(event.currentDataType)) {
          fileList = (String[]) event.data;
        }
        if (fileList != null && fileList.length == 1) {
          String string = fileList[0];
          testDirectoryText.setText(string);
        }
      }
    });

    DropTarget dt4 = new DropTarget(tsLocationText, DND.DROP_DEFAULT | DND.DROP_MOVE);
    dt4.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dt4.addDropListener(new DropTargetAdapter() {
      @Override
      public void drop(DropTargetEvent event) {
        String fileList[] = null;
        FileTransfer ft = FileTransfer.getInstance();
        if (ft.isSupportedType(event.currentDataType)) {
View Full Code Here

    pathToTypeSystem.setLayoutData(fdata2);
    pathToTypeSystem.setToolTipText("Type System...");
    pathToTypeSystem.setMessage("Type System...");
    DropTarget dt1 = new DropTarget(pathToTypeSystem, DND.DROP_DEFAULT | DND.DROP_MOVE);
    dt1.setTransfer(new Transfer[] { FileTransfer.getInstance() });
    dt1.addDropListener(new DropTargetAdapter() {
      @Override
      public void drop(DropTargetEvent event) {
        String fileList[] = null;
        FileTransfer ft = FileTransfer.getInstance();
        if (ft.isSupportedType(event.currentDataType)) {
View Full Code Here

TOP

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

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.