Package org.eclipse.swt.dnd

Examples of org.eclipse.swt.dnd.Clipboard


   *
   * @return the shared instance of <code>Clipboard</code>.
   */
  public static Clipboard getClipboard() {
    if (fgClipboard == null)
      fgClipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());

    return fgClipboard;
  }
View Full Code Here



  public static void copyClipboard(String content, Display display) {

    if (_cb == null)
      _cb = new Clipboard(display);

    TextTransfer transfer = TextTransfer.getInstance();
    _cb.setContents(new Object[] { content }, new Transfer[] { transfer });

  }
View Full Code Here

         * buffer.append(unresolvedLabelProvider.getLabel(reason.getRequirement ()).getString()); buffer.append('\t');
         * buffer.append(unresolvedLabelProvider .getLabel(reason.getResource())); if (iter.hasNext())
         * buffer.append('\n'); } }
         */

        Clipboard clipboard = new Clipboard(sashForm.getDisplay());
        TextTransfer transfer = TextTransfer.getInstance();
        clipboard.setContents(new Object[] {
            builder.toString()
        }, new Transfer[] {
            transfer
        });
        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

     *      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

         * buffer.append(unresolvedLabelProvider.getLabel(reason.getRequirement ()).getString()); buffer.append('\t');
         * buffer.append(unresolvedLabelProvider .getLabel(reason.getResource())); if (iter.hasNext())
         * buffer.append('\n'); } }
         */

        Clipboard clipboard = new Clipboard(composite.getDisplay());
        TextTransfer transfer = TextTransfer.getInstance();
        clipboard.setContents(new Object[] {
            builder.toString()
        }, new Transfer[] {
            transfer
        });
        clipboard.dispose();
    }
View Full Code Here

    public CopyTunnelInformation(String actionName, ImageDescriptor actionImage) {
      super(actionName, actionImage);
    }

    public void run() {
      Clipboard clipBoard = new Clipboard(shell.getDisplay());
      CaldecottTunnelDescriptor descriptor = getSelectedTunnelDescriptor();
      if (descriptor != null) {
        String value = getTunnelInformation(descriptor);
        clipBoard.setContents(new Object[] { value }, new TextTransfer[] { TextTransfer.getInstance() });
      }
    }
View Full Code Here

  /**
   * The constructor.
   */
  public JcrNodeCopyAction() {
      clipboard = new Clipboard(Display.getDefault());
  }
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.