Class ClipboardHelper

java.lang.Object
com.iizigo.dnd.ClipboardHelper

public class ClipboardHelper extends Object
The clip board helper class is used to interface with the clip board in Eclipse/SWT with the Properties.
Author:
Christopher Mindus
  • Constructor Details

    • ClipboardHelper

      public ClipboardHelper()
  • Method Details

    • getClipboardText

      public static String getClipboardText()
      Gets the text contained in the clipboard.
      Returns:
      The text String, null for none.
    • doesClipboardContainText

      public static boolean doesClipboardContainText(boolean emptyAllowed)
      Checks if the clipboard contains text.
    • getClipboardProps

      public static GProp<?>[] getClipboardProps()
      Gets the clip board data as a valid Properties Container.
      Returns:
      The PropCnr [] or null if clip board doesn't contain a valid property container.
    • setClipboard

      public static void setClipboard(String text)
      Sets the clipboard text.
      Parameters:
      text - The clipboard text, formatted by LF for new lines.
    • setClipboard

      public static void setClipboard(GProp<?>[] gps, ISelection selection, boolean doCopy)
      Sets the clip board with the properties.

      The clip board is set with the transfer types PropertiesTransfer and ResourceTransfer if possible.

      If the properties are all IPropDesigner instances with IResource's attached, the ResourceTransfer is only used.

      When ResourceTransfer is used, the FileTransfer is also set.

      If the selection parameter is non-null, the clip board is set with the LocalSelectionTransfer type for use in the same Eclipse instance.

      Parameters:
      gps - The array of property containers.
      selection - The selection (or null for none).
      doCopy - Causes the selection to be saved to clipboard too (for cut or delete, this is not possible).