AbstractLauncherApplication.st
changeset 9860 5225713f415e
parent 9806 80452f6ab4f6
child 9875 062f2c80dff0
equal deleted inserted replaced
9859:38ac3e126c5b 9860:5225713f415e
   263 
   263 
   264     ^ SettingsDialog defaultSettingsApplicationList
   264     ^ SettingsDialog defaultSettingsApplicationList
   265 !
   265 !
   266 
   266 
   267 initializeSettingsList
   267 initializeSettingsList
   268     |rawList filteredList settingsList|
   268     |rawList cookedList settingsList|
   269 
   269 
   270     rawList := self defaultSettingsApplicationList.
   270     rawList := self defaultSettingsApplicationList.
   271     filteredList := rawList select:[:eachEntry|
   271     cookedList := OrderedCollection new.
   272 			|className|
   272 
   273 
   273     rawList do:[:eachEntry|
   274 			className := eachEntry at:2 ifAbsent:nil.
   274         |treeName className newEntry code classList name nameCode nameBlock nameList iconCode iconBlock|
   275 			className isNil
   275 
   276 			or:[ (Smalltalk at:className) notNil ]
   276         className := eachEntry at:2 ifAbsent:nil.
   277 		    ].
   277         (className notNil and:[className startsWith:'[']) ifTrue:[
   278 
   278             code := className copyFrom:2 to:(className size - 1).
   279     settingsList := filteredList collect:[:eachEntry|
   279             classList := Parser evaluate:code.
   280 			|iconSelector newEntry|
   280             name := eachEntry at:1.
   281 
   281             self assert:(name includesString:'[').
   282 			iconSelector := eachEntry at:3 ifAbsent:nil.
   282 
   283 			iconSelector isNil ifTrue:[
   283             nameCode := name copyFrom:(name indexOf:$[)+1 to:(name indexOf:$])-1.
   284 			    eachEntry
   284             nameCode := '^ [:each | ' , (nameCode copyReplaceString:'%' withString:'each') ,']'.
   285 			] ifFalse:[
   285             nameBlock := Parser evaluate:nameCode.
   286 			    newEntry := eachEntry copy.
   286 
   287 			    newEntry at:3 put:(self perform:iconSelector).
   287             nameList := classList collect:nameBlock.
   288 			    newEntry
   288             nameList sortWith:classList.
   289 			].
   289             nameList with:classList do:[:eachName :eachClass |
   290 		    ].
   290                 |newEntry|
       
   291 
       
   292                 newEntry := eachEntry copy.
       
   293                 newEntry at:1 put:(name copyTo:(name indexOf:$[)-1),eachName.
       
   294                 newEntry at:2 put:eachClass name.
       
   295                 cookedList add:newEntry.
       
   296             ].
       
   297         ] ifFalse:[
       
   298             (className isNil "a directory entry"
       
   299             or:[ (Smalltalk at:className) notNil "a valid entry"]) ifTrue:[
       
   300                 cookedList add:eachEntry.
       
   301             ].
       
   302         ].
       
   303     ].
       
   304 
       
   305     settingsList := 
       
   306         cookedList collect:[:eachEntry |
       
   307             |iconCodeOrSelector iconCode iconBlock newEntry|
       
   308 
       
   309             iconCodeOrSelector := eachEntry at:3 ifAbsent:nil.
       
   310             iconCodeOrSelector isNil ifTrue:[
       
   311                 newEntry := eachEntry
       
   312             ] ifFalse:[
       
   313                 newEntry := eachEntry copy.
       
   314                 (iconCodeOrSelector startsWith:'[') ifTrue:[
       
   315                     iconCode := iconCodeOrSelector copyFrom:(iconCodeOrSelector indexOf:$[)+1 to:(iconCodeOrSelector indexOf:$])-1.
       
   316                     iconCode := '^ [:each | ' , (iconCode copyReplaceString:'%' withString:'each') ,']'.
       
   317                     iconBlock := Parser evaluate:iconCode.
       
   318                     newEntry at:3 put:(iconBlock value:(Smalltalk classNamed:(eachEntry at:2))).
       
   319                 ] ifFalse:[
       
   320                     newEntry at:3 put:(self perform:iconCodeOrSelector).
       
   321                 ].
       
   322             ].
       
   323             newEntry.
       
   324         ].
       
   325 
   291     SettingsList := settingsList.
   326     SettingsList := settingsList.
   292     ^ settingsList.
   327     ^ settingsList.
   293 
   328 
   294     "
   329     "
   295      self withAllSubclassesDo:[:cls | cls initializeSettingsList ]
   330      self withAllSubclassesDo:[:cls | cls initializeSettingsList ]
   296     "
   331     "
   297 
   332 
   298     "Modified: / 16-12-2002 / 18:12:50 / penk"
   333     "Modified: / 16-12-2002 / 18:12:50 / penk"
   299     "Modified: / 01-12-2006 / 14:01:12 / cg"
   334     "Modified: / 19-04-2011 / 12:53:26 / cg"
   300 !
   335 !
   301 
   336 
   302 removeSettingsApplicationByClass:aClass
   337 removeSettingsApplicationByClass:aClass
   303 
   338 
   304     | userSetList remItem|
   339     | userSetList remItem|
   323 !
   358 !
   324 
   359 
   325 settingsList
   360 settingsList
   326     "/ do NOT cache SettingsList
   361     "/ do NOT cache SettingsList
   327     "/ use UserSettingsList to add settings from loaded libraries
   362     "/ use UserSettingsList to add settings from loaded libraries
       
   363 
   328     SettingsList := nil.
   364     SettingsList := nil.
   329     SettingsList isNil ifTrue: [
   365     SettingsList isNil ifTrue: [
   330         SettingsList := self initializeSettingsList
   366         SettingsList := self initializeSettingsList
   331     ].
   367     ].
   332     ^ SettingsList
   368     ^ SettingsList
       
   369 
       
   370     "Modified: / 19-04-2011 / 12:08:17 / cg"
   333 !
   371 !
   334 
   372 
   335 userSettingsList
   373 userSettingsList
   336 
   374 
   337     UserSettingsList isNil ifTrue: [
   375     UserSettingsList isNil ifTrue: [
  1019                 ]
  1057                 ]
  1020             ]
  1058             ]
  1021         ].
  1059         ].
  1022         OpenSettingsDialog := nil.
  1060         OpenSettingsDialog := nil.
  1023     ].
  1061     ].
       
  1062 
  1024     settingsApp := SettingsDialog new.
  1063     settingsApp := SettingsDialog new.
  1025     settingsApp requestor:self.
  1064     settingsApp requestor:self.
  1026     settingsApp installSettingsEntries:(self class allSettingsList).
  1065     settingsApp installSettingsEntries:(self class allSettingsList).
  1027     "/ settingsApp requestor:self.
  1066     "/ settingsApp requestor:self.
  1028     OpenSettingsDialog := settingsApp.
  1067     OpenSettingsDialog := settingsApp.
  1029     settingsApp allButOpen.
  1068     settingsApp allButOpen.
  1030     settingsApp window label:(resources string:'ST/X Settings').
  1069     settingsApp window label:(resources string:'ST/X Settings').
  1031     settingsApp openWindow.
  1070     settingsApp openWindow.
       
  1071 
       
  1072     "Modified: / 19-04-2011 / 12:09:10 / cg"
  1032 !
  1073 !
  1033 
  1074 
  1034 settingsClosed
  1075 settingsClosed
  1035 
  1076 
  1036     OpenSettingsDialog := nil.
  1077     OpenSettingsDialog := nil.
  6771 ! !
  6812 ! !
  6772 
  6813 
  6773 !AbstractLauncherApplication class methodsFor:'documentation'!
  6814 !AbstractLauncherApplication class methodsFor:'documentation'!
  6774 
  6815 
  6775 version
  6816 version
  6776     ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.401 2011-03-25 18:53:19 stefan Exp $'
  6817     ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.402 2011-04-19 10:58:46 cg Exp $'
  6777 !
  6818 !
  6778 
  6819 
  6779 version_CVS
  6820 version_CVS
  6780     ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.401 2011-03-25 18:53:19 stefan Exp $'
  6821     ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.402 2011-04-19 10:58:46 cg Exp $'
  6781 ! !
  6822 ! !