diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-15 23:20:01 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-15 23:20:01 +0000 |
commit | 3b3101d8b5ae4f08a16c0b7111da6cad41bbd282 (patch) | |
tree | a5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/javax/swing/TransferHandler.java | |
parent | 7e55c49d7d91ef9f09e93c1100119b1ab3652446 (diff) | |
download | ppe42-gcc-3b3101d8b5ae4f08a16c0b7111da6cad41bbd282.tar.gz ppe42-gcc-3b3101d8b5ae4f08a16c0b7111da6cad41bbd282.zip |
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107049 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/javax/swing/TransferHandler.java')
-rw-r--r-- | libjava/classpath/javax/swing/TransferHandler.java | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/libjava/classpath/javax/swing/TransferHandler.java b/libjava/classpath/javax/swing/TransferHandler.java index 96cb9d42abf..4828fdbfa98 100644 --- a/libjava/classpath/javax/swing/TransferHandler.java +++ b/libjava/classpath/javax/swing/TransferHandler.java @@ -75,30 +75,38 @@ public class TransferHandler implements Serializable } } + /** + * Get the system cliboard. If not available, create and return the VM-local + * clipboard. + * + * @param component a component, used to get the toolkit. + * @return the clipboard + */ private static Clipboard getClipboard(JComponent component) { - SecurityManager sm = System.getSecurityManager(); - - if (sm != null) - { - try - { - sm.checkSystemClipboardAccess(); - - // We may access system clipboard. - return component.getToolkit().getSystemClipboard(); - } - catch (SecurityException e) - { - // We may not access system clipboard. - } - } - - // Create VM-local clipboard if non exists yet. - if (clipboard == null) - clipboard = new Clipboard("Clipboard"); - - return clipboard; + // Avoid throwing exception if the system clipboard access failed + // in the past. + if (clipboard != null) + return clipboard; + else + { + try + { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkSystemClipboardAccess(); + + // We may access system clipboard. + return component.getToolkit().getSystemClipboard(); + } + catch (Exception e) + { + // We may not access system clipboard. + // Create VM-local clipboard if none exists yet. + clipboard = new Clipboard("Clipboard"); + return clipboard; + } + } } } @@ -162,15 +170,18 @@ public class TransferHandler implements Serializable } public void exportAsDrag (JComponent c, InputEvent e, int action) - { + { + // TODO: Implement this properly } protected void exportDone (JComponent c, Transferable data, int action) { + // TODO: Implement this properly } public void exportToClipboard(JComponent c, Clipboard clip, int action) { + // TODO: Implement this properly } public int getSourceActions (JComponent c) |