class: AbstractLauncherApplication
authorClaus Gittinger <cg@exept.de>
Sat, 21 Feb 2015 14:42:56 +0100
changeset 15352 f62436b30ab8
parent 15351 a6745c3d13da
child 15353 d750b93079f8
class: AbstractLauncherApplication added: #expandSettingsList: changed: #initializeSettingsList separated settingsList expansion into a utility method (needed by System browser's settings dialog)
AbstractLauncherApplication.st
--- a/AbstractLauncherApplication.st	Sat Feb 21 13:50:28 2015 +0100
+++ b/AbstractLauncherApplication.st	Sat Feb 21 14:42:56 2015 +0100
@@ -246,10 +246,22 @@
     ^ SettingsDialog defaultSettingsApplicationList
 !
 
-initializeSettingsList
-    |rawList cookedList settingsList|
-
-    rawList := self defaultSettingsApplicationList.
+expandSettingsList:rawList
+    "this expands a raw settings list,
+     by looking for entries with '[...]' in their class name.
+     If any such is present, it is evaluated as a block, returning
+     a collection of actual entries to use.
+     This allows for easy dynamic construction of more complicated
+     lists, for example to adapt to the set of loaded classes dynamically."
+
+    "I am not sure. if this is is a good idea; although it makes heavy use of
+     Smalltalk's dynamic features, it is probably better done differently
+     (using a brace construct, to generate the entries).
+     use of a string which is evaluated makes it harder to debug, and also
+     harder to find using the browser's sender/implementor search functions"
+    
+    |cookedList settingsList|
+
     cookedList := OrderedCollection new.
 
     rawList do:[:eachEntry|
@@ -309,12 +321,20 @@
             newEntry.
         ].
 
-    SettingsList := settingsList.
     ^ settingsList.
 
     "
      self withAllSubclassesDo:[:cls | cls initializeSettingsList ]
     "
+!
+
+initializeSettingsList
+    SettingsList := self expandSettingsList:(self defaultSettingsApplicationList).
+    ^ SettingsList.
+
+    "
+     self withAllSubclassesDo:[:cls | cls initializeSettingsList ]
+    "
 
     "Modified: / 16-12-2002 / 18:12:50 / penk"
     "Modified: / 20-04-2011 / 17:03:33 / cg"
@@ -7034,14 +7054,14 @@
 !AbstractLauncherApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.470 2015-02-13 18:22:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.471 2015-02-21 13:42:56 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.470 2015-02-13 18:22:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.471 2015-02-21 13:42:56 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: AbstractLauncherApplication.st,v 1.470 2015-02-13 18:22:14 cg Exp $'
+    ^ '$Id: AbstractLauncherApplication.st,v 1.471 2015-02-21 13:42:56 cg Exp $'
 ! !