com.corticon.eclipse.core.util

## Class ClipboardMonitor

- java.lang.Object
- - com.corticon.eclipse.core.util.ClipboardMonitor

-     public class ClipboardMonitor
      extends java.lang.Object

  ClipboardMonitor listens to the system clipboard and notifies subscribers of relevant changes in the clipboard contents.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClipboardMonitor()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addClipboardListener(IClipboardListener aIClipboardListener)` Add a clipboard listener (i.e., subscribe).
    `static java.awt.datatransfer.Transferable` | `getContents()` Get the contents of the system clipboard.
    `static java.lang.String` | `getContentsString()` Get the contents of the system clipboard as a String.
    `static boolean` | `isStringFlavor()` Determine whether String data exists in system clipboard.
    `static void` | `removeClipboardListener(IClipboardListener aIClipboardListener)` Remove clipboard listener (i.e., un-subscribe).
    `static void` | `setContents(java.lang.String astrText)` Set the contents of the system clipboard and notify listeners that contents have changed.
    `static void` | `setContents(java.awt.datatransfer.Transferable aTransferable)` Set the contents of the system clipboard and notify listeners that contents have changed.
    `static void` | `start()` Start monitoring system clipboard changes.
    `static void` | `stop()` Stop monitoring system clipboard changes.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ClipboardMonitor

          public ClipboardMonitor()

  - ### Method Detail

    - #### addClipboardListener

          public static void addClipboardListener(IClipboardListener aIClipboardListener)

      Add a clipboard listener (i.e., subscribe).
      Parameters:
        `aIClipboardListener` - Clipboard listener instance to add to subscription list.

    - #### getContents

          public static java.awt.datatransfer.Transferable getContents()

      Get the contents of the system clipboard. If the clipboard is currently in use, wait for a while and retry to avoid concurrent access, which will cause the system to throw IllegalStateException ("cannot open system clipboard").
      Returns:
        Transferable from system clipboard or `null`.

    - #### getContentsString

          public static java.lang.String getContentsString()

      Get the contents of the system clipboard as a String.
      Returns:
        String contents of clipboard or `null`.

    - #### isStringFlavor

          public static boolean isStringFlavor()

      Determine whether String data exists in system clipboard.
      Returns:
        `true` if system clipboard contains string data.

    - #### setContents

          public static void setContents(java.awt.datatransfer.Transferable aTransferable)

      Set the contents of the system clipboard and notify listeners that contents have changed.
      Parameters:
        `aTransferable` - Transferable containing contents.

    - #### setContents

          public static void setContents(java.lang.String astrText)

      Set the contents of the system clipboard and notify listeners that contents have changed. This is a convenience overload for type String.
      Parameters:
        `astrText` - String (automatically creates StringSelection).

    - #### removeClipboardListener

          public static void removeClipboardListener(IClipboardListener aIClipboardListener)

      Remove clipboard listener (i.e., un-subscribe).
      Parameters:
        `aIClipboardListener` - Clipboard listener instance to remove from subscription list.

    - #### start

          public static void start()

      Start monitoring system clipboard changes.

    - #### stop

          public static void stop()

      Stop monitoring system clipboard changes.

Copyright © 2005-2013 Progress Software Corporation and/or its subsidiaries and affiliates. All rights reserved.