#REFACTORING by cg draft
authorClaus Gittinger <cg@exept.de>
Sun, 29 Jul 2018 10:22:44 +0200
changeset 3582 5606394265f9
parent 3581 e8ae5a7267d8
child 3583 8eb5579befae
#REFACTORING by cg class: MenuEditor::RegularMenuItem changed: #menu:labeled: (send #synchronized: instead of #criticalDo:)
MenuEditor.st
--- a/MenuEditor.st	Sun Jul 29 10:01:24 2018 +0200
+++ b/MenuEditor.st	Sun Jul 29 10:22:44 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1997 by eXept Software AG
 	      All Rights Reserved
@@ -5896,41 +5898,42 @@
 menu:aMenu labeled:aString
     |expanded item menu|
 
-    self criticalDo:[
-	self isRootItem ifTrue:[ expanded := true ]
-		       ifFalse:[ expanded := isExpanded ].
-
-	self removeAll.
-	self rawLabel:aString.
-
-	menu := aMenu value.
-
-	(menu isNil or:[menu isString]) ifTrue:[
-	    menu := nil
-	] ifFalse:[
-	    aMenu isCollection ifTrue:[ menu := Menu decodeFromLiteralArray:aMenu ]
-			      ifFalse:[ menu := aMenu ].
-
-	    menu hasItems ifFalse:[
-		menu := nil
-	    ].
-	].
-	menu notNil ifTrue:[
-	    isExpanded := false.        "/ discard change notifications
-	    children   := OrderedCollection new.
-
-	    menu itemsDo:[:el|
-		item := self class menuItem:el.
-		item parent:self.
-		children add:item.
-	    ].
-	    expanded ifTrue:[ self expand ].
-	].
-	isExpanded := expanded.
+    self synchronized:[
+        self isRootItem ifTrue:[ expanded := true ]
+                       ifFalse:[ expanded := isExpanded ].
+
+        self removeAll.
+        self rawLabel:aString.
+
+        menu := aMenu value.
+
+        (menu isNil or:[menu isString]) ifTrue:[
+            menu := nil
+        ] ifFalse:[
+            aMenu isCollection ifTrue:[ menu := Menu decodeFromLiteralArray:aMenu ]
+                              ifFalse:[ menu := aMenu ].
+
+            menu hasItems ifFalse:[
+                menu := nil
+            ].
+        ].
+        menu notNil ifTrue:[
+            isExpanded := false.        "/ discard change notifications
+            children   := OrderedCollection new.
+
+            menu itemsDo:[:el|
+                item := self class menuItem:el.
+                item parent:self.
+                children add:item.
+            ].
+            expanded ifTrue:[ self expand ].
+        ].
+        isExpanded := expanded.
     ].
     self changed
 
     "Modified: / 29-11-2011 / 11:28:33 / cg"
+    "Modified: / 28-07-2018 / 15:49:52 / Claus Gittinger"
 !
 
 menuItem