Allow to edit a list in a spec inline
authorStefan Vogel <sv@exept.de>
Mon, 25 Feb 2008 20:19:32 +0100
changeset 2284 4116d91b6dda
parent 2283 b14becb50aac
child 2285 227688419a5c
Allow to edit a list in a spec inline
UIPainter.st
--- a/UIPainter.st	Mon Feb 25 20:18:24 2008 +0100
+++ b/UIPainter.st	Mon Feb 25 20:19:32 2008 +0100
@@ -522,6 +522,18 @@
     "Modified: / 17-09-2007 / 11:36:33 / cg"
 !
 
+editTableIcon
+    <resource: #programImage>
+
+    ^ SystemBrowser tableColumnsIcon
+!
+
+helpIcon
+    <resource: #programImage>
+
+    ^ Icon helpIcon
+!
+
 iconAlignB
     "This resource specification was automatically generated
      by the ImageEditor of ST/X."
@@ -2522,11 +2534,6 @@
     ^ self painter hasUndoHistoryHolder
 !
 
-helpIcon
-
-    ^Icon helpIcon
-!
-
 installAsWebPageVisible
     ^ true
 
@@ -4213,10 +4220,9 @@
 !
 
 doBrowseAspectMethod:aspectSelector
-    "browse or create the aspect method as entered in the field (button beside input filed pressed)"
+    "browse or create the aspect method as entered in the field (button beside input fieled pressed)"
 
     self acceptOrIgnoreSectionModification.
-
     self doBrowseAspectMethod:aspectSelector nameAs:aspectSelector
 
     "Modified: / 12-01-2008 / 10:32:15 / cg"
@@ -4236,10 +4242,13 @@
     spec := painter specForSelection.
     spec isNil ifTrue:[^ self].
     aspect := spec perform:aspectSelector.
-    aspect isNil ifTrue:[
-        Dialog information:(resources 
-                                string:'Please enter a Method name for "%1" first.'
-                                with:(resources string:aspectNameShown) allBold).
+    aspect isString ifFalse:[
+        "ignore non-strings (list may be an Array)"
+        aspect isNil ifTrue:[
+            Dialog information:(resources 
+                                    string:'Please enter a Method name for "%1" first.'
+                                    with:(resources string:aspectNameShown) allBold).
+        ].
         ^ self
     ].
         
@@ -4413,6 +4422,36 @@
     "Modified: / 4.2.1999 / 15:36:34 / cg"
 !
 
+doEditList:listSelector
+    "browse or create the aspect method as entered in the field (button beside input fieled pressed)"
+
+    |spec list editor|
+
+    self acceptOrIgnoreSectionModification.
+
+    spec := painter specForSelection.
+    spec isNil ifTrue:[^ self].
+
+    "Kludge: subject - fetch the AspectAdaptor behind the TypeConverter"
+    list := (specTool aspectFor:listSelector) subject value.
+    list isNil ifTrue:[
+        list := #()
+    ].
+
+    editor := UIListEditor new.
+    editor
+        informationLabel:'Edit List';
+        list:list;
+        useSymbols:(list notEmpty and:[list conform:[:e| e isSymbol]]);    "set use symbols, if all elements are symbols"
+        open.
+
+
+    editor accepted ifTrue:[
+        "Kludge: subject - fetch the AspectAdaptor behind the TypeConverter"
+        (specTool aspectFor:listSelector) subject value:editor list.
+    ].
+!
+
 doGenerateAspectMethodFor
     |cls code aspectList displayedList selectorsToGenerateCode 
      doBrowse methods|