Package com.iizigo.dnd
Class ClipboardHelper
java.lang.Object
com.iizigo.dnd.ClipboardHelper
The clip board helper class is used to interface with the clip board in Eclipse/SWT with the Properties.
- Author:
- Christopher Mindus
Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
doesClipboardContainText
(boolean emptyAllowed) Checks if the clipboard contains text.static GProp<?>[]
Gets the clip board data as a valid Properties Container.static String
Gets the text contained in the clipboard.static void
setClipboard
(GProp<?>[] gps, org.eclipse.jface.viewers.ISelection selection, boolean doCopy) Sets the clip board with the properties.static void
setClipboard
(String text) Sets the clipboard text.
Constructor Details
ClipboardHelper
public ClipboardHelper()
Method Details
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
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
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).