DeviceWorkstation.st
changeset 5937 ab867dbe42dd
parent 5917 d5b5e701a6e8
child 5947 9b29e25d9ff4
--- a/DeviceWorkstation.st	Mon Oct 22 19:20:54 2012 +0200
+++ b/DeviceWorkstation.st	Mon Oct 22 20:07:32 2012 +0200
@@ -565,6 +565,39 @@
     ].
 ! !
 
+!DeviceWorkstation class methodsFor:'clipboard support'!
+
+bufferAsString:aBuffer
+    "aBuffer (my current selection) as a string"
+
+    aBuffer isString ifTrue:[
+        ^ aBuffer string.
+    ].
+
+    aBuffer isNil ifTrue:[
+        ^ ''
+    ].
+
+    aBuffer isStringCollection ifTrue:[
+        ^ aBuffer 
+            from:1
+            to:aBuffer size
+            asStringWith:Character cr
+            compressTabs:false
+            final:nil
+            withEmphasis:false.
+    ].
+
+    RecursiveStoreError handle:[:ex |
+       ^ ''
+    ] do:[
+       ^ aBuffer storeString
+    ]
+
+    "Created: / 13.2.1997 / 13:10:30 / cg"
+    "Modified: / 20.1.1998 / 14:11:01 / stefan"
+! !
+
 !DeviceWorkstation class methodsFor:'defaults'!
 
 defaultButtonPressTimeForMenu
@@ -3112,34 +3145,7 @@
 copyBufferAsString
     "return my current selection as a string"
 
-    |o|
-
-    o := self getCopyBuffer.
-    o isString ifTrue:[
-	^ o string.
-    ].
-
-    o isNil ifTrue:[
-	^ ''
-    ].
-
-    o isStringCollection ifTrue:[
-	^ o from:1
-	    to:o size
-	    asStringWith:Character cr
-	    compressTabs:false
-	    final:nil
-	    withEmphasis:false.
-    ].
-
-    RecursiveStoreError handle:[:ex |
-       ^ ''
-    ] do:[
-       ^ o storeString
-    ]
-
-    "Created: / 13.2.1997 / 13:10:30 / cg"
-    "Modified: / 20.1.1998 / 14:11:01 / stefan"
+    ^ self class bufferAsString:self getCopyBuffer.
 !
 
 getClipboardObjectFor:drawableId
@@ -8142,11 +8148,11 @@
 !DeviceWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.568 2012-07-12 16:43:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.569 2012-10-22 18:07:32 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.568 2012-07-12 16:43:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.569 2012-10-22 18:07:32 stefan Exp $'
 ! !
 
 DeviceWorkstation initialize!