Package org.eclipse.swt.dnd

Examples of org.eclipse.swt.dnd.DropTarget


  private void addDropSupport(Section section) {
    int ops = DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT;
    Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };

    DropTarget dropTarget = new DropTarget(section, ops);
    dropTarget.setTransfer(transfers);
    dropTarget.addDropListener(servicesDropListener);
  }
View Full Code Here


   * @see org.eclipse.swt.dnd.DND
   */
  public void addDropSupport(int operations, Transfer[] transferTypes,
      final DropTargetListener listener) {
    Control control = getControl();
    DropTarget dropTarget = new DropTarget(control, operations);
    dropTarget.setTransfer(transferTypes);
    dropTarget.addDropListener(listener);
  }
View Full Code Here

    private void addDropSupport() {
        if (dropTarget == null) {
            WorkbenchWindowConfigurer winConfigurer = ((WorkbenchWindow) page
                    .getWorkbenchWindow()).getWindowConfigurer();

            dropTarget = new DropTarget(getControl(), DND.DROP_DEFAULT
                    | DND.DROP_COPY | DND.DROP_LINK);
            dropTarget.setTransfer(winConfigurer.getTransfers());
            if (winConfigurer.getDropTargetListener() != null) {
                dropTarget.addDropListener(winConfigurer
                        .getDropTargetListener());
View Full Code Here

            Transfer[] transfers = new Transfer[transferTypes.size()];
            transferTypes.toArray(transfers);
            IWorkbenchPage[] pages = window.getPages();
            for (int i = 0; i < pages.length; i++) {
                WorkbenchPage page = (WorkbenchPage) pages[i];
                DropTarget dropTarget = ((EditorSashContainer) page
                        .getEditorPresentation().getLayoutPart())
                        .getDropTarget();
                if (dropTarget != null) {
                    dropTarget.setTransfer(transfers);
                }
            }
        }
    }
View Full Code Here

        if (dropTargetListener != null) {
            this.dropTargetListener = dropTargetListener;
            IWorkbenchPage[] pages = window.getPages();
            for (int i = 0; i < pages.length; i++) {
                WorkbenchPage page = (WorkbenchPage) pages[i];
                DropTarget dropTarget = ((EditorSashContainer) page
                        .getEditorPresentation().getLayoutPart())
                        .getDropTarget();
                if (dropTarget != null) {
                    dropTarget.addDropListener(this.dropTargetListener);
                }
            }
        }
    }
View Full Code Here

    fdata1.top = new FormAttachment(0, 1000, 5);
    fdata1.right = new FormAttachment(1000, 1000, -5);
    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

        try {
          IEditorPart editor = PluginUI.getActiveEditor();
          if (editor != null) {
            Control ctrl = (Control) editor
                .getAdapter(Control.class);
            DropTarget dropTarget = (DropTarget) ctrl
                .getData(DND.DROP_TARGET_KEY);
            if (dropTarget != null) {
              try {
                // Add drop listener to editor
                logger.debug("Add drop listener to "
                    + dropTarget.toString());
                dropTarget
                    .addDropListener(new JavaEditorDropListener());

              } catch (Exception e) {
                CrashReporter.reportException(e);
                logger.debug("Could not register drop service: "
View Full Code Here

        ev.doit = false;
        ((CTabItem) ev.item).notifyListeners(SWT.CLOSE, new Event());
      }
    });
   
    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

        try {
          IEditorPart editor = PluginUI.getActiveEditor();
          if (editor != null) {
            Control ctrl = (Control) editor
                .getAdapter(Control.class);
            DropTarget dropTarget = (DropTarget) ctrl
                .getData(DND.DROP_TARGET_KEY);
            if (dropTarget != null) {
              try {
                // Add drop listener to editor
                logger.debug("Add drop listener to "
                    + dropTarget.toString());
                dropTarget
                    .addDropListener(JavaEditorDropListener.getInstance());

              } catch (Exception e) {
                CrashReporter.reportException(e);
                logger.debug("Could not register drop service: "
View Full Code Here

   */
  public static DropTargetDescriptor addDropSupport(Control control, IDropTargetProvider destination,
      UDIGDropHandler dropHandler) {
    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_DEFAULT;
      Set<Transfer> transfers = getTransfers();
      DropTarget target=new DropTarget(control, dndOperations);
      target.setTransfer(transfers.toArray(new Transfer[transfers.size()]));
      UDIGControlDropListener controlDropListener = new UDIGControlDropListener(destination,dropHandler);
        target.addDropListener(controlDropListener);
        return new DropTargetDescriptor(target, controlDropListener);   
  }
View Full Code Here

TOP

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

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.