Runtime

org.eclipse.gmf.runtime.diagram.ui.render.clipboard
Class AWTClipboardHelper

java.lang.Object
  extended byorg.eclipse.gmf.runtime.diagram.ui.render.clipboard.AWTClipboardHelper

public class AWTClipboardHelper
extends java.lang.Object

Used for image transfer to the clipboard. This is only supported when on Windows systems.

SWT does not currently support image transfer to the Clipboard. This utility class is provided in order to transfer an SWT Image to the system clipboard using AWT image transfer APIs.


Method Summary
 void copyToClipboard(CustomData data, java.awt.Image image)
          Copies an image to the system clipboard.
 CustomData getCustomData()
          Accessor method to retrieve the CustomData object from the clipboard.
static AWTClipboardHelper getInstance()
          Retrieves the singleton instance of AWTClipboardHelper.
 boolean hasCustomData()
          Query method to determine if a CustomData object is on the clipboard.
 boolean isImageCopySupported()
          Return true if image copy is supported, that is, when running under Windows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AWTClipboardHelper getInstance()
Retrieves the singleton instance of AWTClipboardHelper.

Returns:
the singleton instance of AWTClipboardHelper

isImageCopySupported

public final boolean isImageCopySupported()
Return true if image copy is supported, that is, when running under Windows. Workaround for RATLC00526604, ClipboardHelper's hasCustomData invoking SunClipboard's getContents which waits indefinitely

Returns:
true when running under Windows

hasCustomData

public boolean hasCustomData()
Query method to determine if a CustomData object is on the clipboard.

Returns:
true if CustomData is on the clipboard, false otherwise.

getCustomData

public CustomData getCustomData()
Accessor method to retrieve the CustomData object from the clipboard.

Returns:
the CustomData if it exists on the clipboard, null otherwise.

copyToClipboard

public void copyToClipboard(CustomData data,
                            java.awt.Image image)
Copies an image to the system clipboard. Creates an AWT BufferedImage from the SWT Image and transfers the bufferedImage to the system clipboard.

Parameters:
data - the custom data
image - the image to be copied

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.