Runtime

## org.eclipse.gmf.runtime.common.ui.action.actions.global
Class ClipboardManager

    java.lang.Object
      org.eclipse.gmf.runtime.common.ui.action.actions.global.ClipboardManager

    public final class ClipboardManager

extends java.lang.Object

This class is used to add/retrieve data to/from the system clipboard. This class should be used within the global action infrastructure framework.

Field Summary
`static java.lang.String` `COMMON_FORMAT` String constant for the common format (paste on ME or a daigram (usually as a result of Harvesting)

Method Summary
`void` `addToCache(java.lang.Object data, Transfer dataType)` Adds data to the internal cache.
`void` `addToCache(java.lang.Object data, Transfer dataType, ClipboardState state)` Adds data to the internal cache.
`protected void` `clearCache()` Clear the cache
`boolean` `doesCacheHaveType(Transfer dataType)` Checks if the cache has the specified transfer agent
`boolean` `doesClipboardHaveData(java.lang.String format, ClipboardContentsHelper contentsHelper)` Checks if the system clipboard has any ICustomData with the specified format
`boolean` `doesClipboardHaveData(Transfer dataType, ClipboardContentsHelper contentsHelper)` Checks if the system clipboard has any data with the specified transfer agent
`void` `flushCacheToClipboard()` Flushes the chache to the system clipboard and clears the cache NOTE: visibility changed from (protected) to (public) to support Harvesting feature
`java.lang.String[]` `getAvailableTypeNames()` Returns a platform specific list of the data types currently available on the system clipboard.
`java.lang.Object` `getClipboardContents(Transfer dataType, ClipboardContentsHelper helper)` Returns the system clipboard contents
`ICustomData[]` `getClipboardData(java.lang.String format, ClipboardContentsHelper contentsHelper)` Gets the ICustomData associated with the specified format from the system clipboard.
`ClipboardState` `getClipboardState()`
`static ClipboardManager` `getInstance()` Return the singleton.
`void` `removeFromCache(Transfer dataType)` Removes the transfer agent from the cache
`void` `setClipboardState(ClipboardState clipboardState)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### COMMON_FORMAT

    public static final java.lang.String COMMON_FORMAT

  String constant for the common format (paste on ME or a daigram (usually as a result of Harvesting)

  See Also:
    Constant Field Values

Method Detail

### getInstance

    public static ClipboardManager getInstance()

  Return the singleton.

  Returns:
    a singleton instance of `ClipboardManager`

### getClipboardContents

    public java.lang.Object getClipboardContents(Transfer dataType,
                                                 ClipboardContentsHelper helper)

  Returns the system clipboard contents

  Parameters:
    `dataType` - The transfer agent
  Returns:
    Object Data associated with the transfer agent

### addToCache

    public void addToCache(java.lang.Object data,
                           Transfer dataType)

  Adds data to the internal cache. The clipboard state is reset to NORMAL.

  Parameters:
    `data` - The data for the transfer agent
    `dataType` - The transfer agent

### addToCache

    public void addToCache(java.lang.Object data,
                           Transfer dataType,
                           ClipboardState state)

  Adds data to the internal cache. The clipboard state is set to the specified value.

  Parameters:
    `data` - The data for the transfer agent
    `dataType` - The transfer agent
    `state` - The clipboard state

### flushCacheToClipboard

    public void flushCacheToClipboard()

  Flushes the chache to the system clipboard and clears the cache NOTE: visibility changed from (protected) to (public) to support Harvesting feature

### clearCache

    protected void clearCache()

  Clear the cache

### getAvailableTypeNames

    public java.lang.String[] getAvailableTypeNames()

  Returns a platform specific list of the data types currently available on the system clipboard.

  Note: `getAvailableTypeNames` is a utility for writing a Transfer sub-class. It should NOT be used within an application because it provides platform specific information.

  Returns:
    a platform specific list of the data types currently available on the system clipboard

### removeFromCache

    public void removeFromCache(Transfer dataType)

  Removes the transfer agent from the cache

  Parameters:
    `dataType` - The transfer agent

### doesCacheHaveType

    public boolean doesCacheHaveType(Transfer dataType)

  Checks if the cache has the specified transfer agent

  Parameters:
    `dataType` - The transfer agent
  Returns:
    boolean

### doesClipboardHaveData

    public boolean doesClipboardHaveData(java.lang.String format,
                                         ClipboardContentsHelper contentsHelper)

  Checks if the system clipboard has any ICustomData with the specified format

  Parameters:
    `format` - The format
  Returns:
    boolean

### doesClipboardHaveData

    public boolean doesClipboardHaveData(Transfer dataType,
                                         ClipboardContentsHelper contentsHelper)

  Checks if the system clipboard has any data with the specified transfer agent

  Parameters:
    `dataType` - The transfer agent
  Returns:
    boolean

### getClipboardData

    public ICustomData[] getClipboardData(java.lang.String format,
                                          ClipboardContentsHelper contentsHelper)

  Gets the ICustomData associated with the specified format from the system clipboard.

  Parameters:
    `format` - The format
  Returns:
    ICustomData[]

### getClipboardState

    public ClipboardState getClipboardState()

  Returns:
    Returns the clipboard state.

### setClipboardState

    public void setClipboardState(ClipboardState clipboardState)

  Parameters:
    `clipboardState` - The clipboard state to set.

Runtime

Guidelines for using Eclipse APIs.

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