Package org.eclipse.swt.dnd

Examples of org.eclipse.swt.dnd.Clipboard


              StringBuffer statusBuffer = new StringBuffer();
              for (int i = 0; i < list.getItemCount(); ++i) {
                statusBuffer.append(list.getItem(i));
                statusBuffer.append("\r\n");
              }
              clipboard = new Clipboard(list.getDisplay());
              clipboard.setContents(
                  new Object[]{statusBuffer.toString()},
                  new Transfer[]{TextTransfer.getInstance()});
            }
View Full Code Here


    private void runCopyToClipboard() {
        if (text == null) {
      return;
    }

        Clipboard clipboard = null;
        try {
            clipboard = new Clipboard(getShell().getDisplay());
            clipboard.setContents(new Object[] { text.getText() },
                    new Transfer[] { TextTransfer.getInstance() });
        } 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

     * @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

        }
      }
    });
    mntmCopier.addArmListener(new ArmListener() {
      public void widgetArmed(ArmEvent e) {
        Clipboard clipboard = new Clipboard(getDisplay());
        TextTransfer textTransfer = TextTransfer.getInstance();

        clipboard.setContents(
            new String[] { "Terme: " + terme.getText()
                + "\nPrononciation: " + prononciation.getText()
                + "\n Nature: " + nature.getText()
                + "\nDescription: " + definition.getText() },
            new Transfer[] { textTransfer });

        clipboard.dispose();

      }
    });

  }
View Full Code Here

     *
     * @return the string from the clipboard
     */
    private String getStringFromClipboard()
    {
        Clipboard clipboard = null;
        try
        {
            clipboard = new Clipboard( Display.getCurrent() );
            Object contents = clipboard.getContents( TextTransfer.getInstance() );
            if ( contents != null && contents instanceof String )
            {
                return ( String ) contents;
            }
        }
        finally
        {
            if ( clipboard != null )
            {
                clipboard.dispose();
            }
        }
        return null;
    }
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

    }


    private static String getStringFromClipboard()
    {
        Clipboard clipboard = null;
        try
        {
            clipboard = new Clipboard( Display.getCurrent() );
            Object contents = clipboard.getContents( TextTransfer.getInstance() );
            if ( contents != null && contents instanceof String )
            {
                return ( String ) contents;
            }
        }
        finally
        {
            if ( clipboard != null )
            {
                clipboard.dispose();
            }
        }
        return null;
    }
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

     * @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

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.