Package org.eclipse.swt.dnd

Examples of org.eclipse.swt.dnd.Clipboard


     * @return
     *      the data obtained from the clipboard or null if no data of this type is available
     */
    protected Object getFromClipboard( Transfer dataType )
    {
        Clipboard clipboard = null;
        try
        {
            clipboard = new Clipboard( Display.getCurrent() );
            return clipboard.getContents( dataType );
        }
        finally
        {
            if ( clipboard != null )
                clipboard.dispose();
        }
    }
View Full Code Here


     *      the transfer agents that will convert the data to its platform specific format;
     *      each entry in the data array must have a corresponding dataType
     */
    public static void copyToClipboard( Object[] data, Transfer[] dataTypes )
    {
        Clipboard clipboard = null;
        try
        {
            clipboard = new Clipboard( Display.getCurrent() );
            clipboard.setContents( data, dataTypes );
        }
        finally
        {
            if ( clipboard != null )
                clipboard.dispose();
        }
    }
View Full Code Here

     * @return
     *      the data obtained from the clipboard or null if no data of this type is available
     */
    protected Object getFromClipboard( Transfer dataType )
    {
        Clipboard clipboard = null;
        try
        {
            clipboard = new Clipboard( Display.getCurrent() );
            return clipboard.getContents( dataType );
        }
        finally
        {
            if ( clipboard != null )
                clipboard.dispose();
        }
    }
View Full Code Here

     * @param text
     *      the Text to copy
     */
    protected void copyToClipboard( String text )
    {
        Clipboard clipboard = null;
        try
        {
            clipboard = new Clipboard( Display.getCurrent() );
            clipboard.setContents( new Object[]
                { text }, new Transfer[]
                { TextTransfer.getInstance() } );
        }
        finally
        {
            if ( clipboard != null )
                clipboard.dispose();
        }
    }
View Full Code Here

       * by letting the widget handle the copy operation in this special case.
       */
      textWidget.copy();
    } else if (copyText != null) {

      Clipboard clipboard= new Clipboard(textWidget.getDisplay());

      try {
        Transfer[] dataTypes= new Transfer[] { TextTransfer.getInstance() };
        Object[] data= new Object[] { copyText };
        try {
          clipboard.setContents(data, dataTypes);
        } catch (SWTError e) {
          if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
            throw e;
          /*
           * TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59459
           * we should either log and/or inform the user
           * silently fail for now.
           */
          return;
        }

      } finally {
        clipboard.dispose();
      }
    }

    if (delete) {
      try {
View Full Code Here

    sb.append(labelprovider.getColumnText(element, column));
    return sb;
  }

  private void copy(String text) {
    final Clipboard cb = new Clipboard(display);
    final TextTransfer transfer = TextTransfer.getInstance();
    cb.setContents(new Object[] { text }, new Transfer[] { transfer });
    cb.dispose();
  }
View Full Code Here

    sb.append(labelprovider.getColumnText(element, column));
    return sb;
  }

  private void copy(String text) {
    final Clipboard cb = new Clipboard(display);
    final TextTransfer transfer = TextTransfer.getInstance();
    cb.setContents(new Object[] { text }, new Transfer[] { transfer });
    cb.dispose();
  }
View Full Code Here

    sb.append(labelprovider.getColumnText(element, column));
    return sb;
  }

  private void copy(String text) {
    final Clipboard cb = new Clipboard(display);
    final TextTransfer transfer = TextTransfer.getInstance();
    cb.setContents(new Object[] { text }, new Transfer[] { transfer });
    cb.dispose();
  }
View Full Code Here

    copy(sb.toString());
    return null;
  }

  private void copy(String text) {
    final Clipboard cb = new Clipboard(display);
    final TextTransfer transfer = TextTransfer.getInstance();
    cb.setContents(new Object[] { text }, new Transfer[] { transfer });
    cb.dispose();
  }
View Full Code Here

    /**
     * Open the window
     */
    public void open() {
        final Display display = Display.getDefault();
        cb = new Clipboard(display);
        createContents();
        shell.open();
        shell.layout();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
View Full Code Here

TOP

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

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.