class: Workspace
authorClaus Gittinger <cg@exept.de>
Sat, 22 Feb 2014 16:55:26 +0100
changeset 4924 c911b709e213
parent 4923 d61e27d85c66
child 4925 ae3aa45c3879
class: Workspace added: #workspaceVariableAt:put: #workspaceVariableHolderAt: comment/format in: #workspaceVariables changed: #drop: #workspaceVariableAt: changed the interface to workspace variables: wsVariableAt: / wsVariableAt:put: get/set the value (just like a classVar would do); to get the holder, you NOW have to use wsVariableHolderAt:
Workspace.st
--- a/Workspace.st	Fri Feb 21 12:24:15 2014 +0100
+++ b/Workspace.st	Sat Feb 22 16:55:26 2014 +0100
@@ -475,12 +475,32 @@
 !
 
 workspaceVariableAt:name
+    "retrieve a workspace variable's value"
+
+    ^ (self workspaceVariableHolderAt:name) value
+
+    "
+     Workspace workspaceVariableAt:'foo' put:1234.
+     Workspace workspaceVariableAt:'foo' 
+    "
+!
+
+workspaceVariableAt:name put:aValue
+    "set or define a workspace variable"
+
+    (self workspaceVariables at:name ifAbsentPut:[ ValueHolder new]) value:aValue
+!
+
+workspaceVariableHolderAt:name
     "retrieve a workspace variable (actually, a holder onto it)"
 
     WorkspaceVariables isNil ifTrue:[^ nil].
     ^ WorkspaceVariables at:name ifAbsent:nil.
 
-
+    "
+     Workspace workspaceVariableAt:'foo' put:1234.
+     Workspace workspaceVariableAt:'foo' put:1234.
+    "
 !
 
 workspaceVariableNames
@@ -493,7 +513,7 @@
 !
 
 workspaceVariables
-    "retrieve the collection of workspace variables.
+    "retrieve the collection of workspace variable holders.
      That is a dictionary associating names to values."
 
     WorkspaceVariables isNil ifTrue:[
@@ -1199,7 +1219,7 @@
 
                 name notEmptyOrNil ifTrue:[
                     Workspace addWorkspaceVariable:name.
-                    (Workspace workspaceVariableAt:name) value:dropObject theObject.
+                    Workspace workspaceVariableAt:name put:dropObject theObject.
                     self paste:name.
                 ].
             ].
@@ -2217,10 +2237,10 @@
 !Workspace class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.316 2014-02-21 11:24:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.317 2014-02-22 15:55:26 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.316 2014-02-21 11:24:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.317 2014-02-22 15:55:26 cg Exp $'
 ! !