Class ClipboardHelper


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

      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static booleandoesClipboardContainText​(boolean emptyAllowed)
      Checks if the clipboard contains text.
      static GProp<?>[]getClipboardProps()
      Gets the clip board data as a valid Properties Container.
      static java.lang.StringgetClipboardText()
      Gets the text contained in the clipboard.
      static voidsetClipboard​(GProp<?>[] gps, org.eclipse.jface.viewers.ISelection selection, boolean doCopy)
      Sets the clip board with the properties.
      static voidsetClipboard​(java.lang.String text)
      Sets the clipboard text.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClipboardHelper

        public ClipboardHelper()
    • Method Detail

      • getClipboardText

        public static java.lang.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​(java.lang.String text)
        Sets the clipboard text.
        Parameters:
        text - The clipboard text, formatted by LF for new lines.
      • setClipboard

        public static void setClipboard​(GProp<?>[] gps,
                                        org.eclipse.jface.viewers.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).