diff -r fbe0461cda6b -r ffab88b8b1e5 SettingsDialog.st --- a/SettingsDialog.st Thu Nov 11 09:31:05 2004 +0100 +++ b/SettingsDialog.st Thu Nov 11 10:06:09 2004 +0100 @@ -451,8 +451,6 @@ ! requestor:something - "set the value of the instance variable 'requestor' (automatically generated)" - requestor := something. ! @@ -471,7 +469,6 @@ !SettingsDialog methodsFor:'actions'! changeLabelTo:aLabel application:aApplication - | item | item := self getItemByApplication:aApplication. @@ -482,8 +479,7 @@ ! destroyAll - - self applicationList do:[ : applItem | + self applicationList do:[ :applItem | (applItem isCategory not and:[applItem application notNil]) ifTrue:[ applItem application close. ]. @@ -492,8 +488,7 @@ ! doIndicatorClick:index - "handle a click on the indicator - " + "handle a click on the indicator" (self applicationList at:index) toggleExpand ! @@ -519,8 +514,8 @@ ! expandItemForApplication:aApplication + | item | - | item | item := self applicationList detect:[:item | item application = aApplication] ifNone:[nil]. item notNil ifTrue:[ item expand @@ -528,7 +523,6 @@ ! help - | item | item := self selectedItem value. @@ -554,7 +548,6 @@ ! sendSaveRequestToAll - self applicationList do:[ : applItem | (applItem isCategory not and:[applItem application notNil]) ifTrue:[ applItem application saveRequest ifFalse:[ @@ -566,7 +559,6 @@ ! sendSaveRequestToCurrent - | item | item := self selectedItem value. @@ -580,7 +572,8 @@ !SettingsDialog methodsFor:'application list access'! addApplClass:aClass forApplication:anApplication label:aLabel expand:aBoolean -" add a application in the to the settingsTree, take the icon from the application class defaultIcon method" + "add an application to the settingsTree, take the icon from the application classes defaultIcon method" + | class | class := Smalltalk classNamed:aClass. @@ -593,24 +586,22 @@ ! addApplClass:aClass withName:aName -" add a application in the to the settingsTree, take the icon from the application class defaultIcon method" + "add an application to the settingsTree, take the icon from the application classes defaultIcon method" ^ self addApplClass:aClass withName:aName icon:nil. ! addApplClass:aClass withName:aName expand:aBoolean -" add a application in the to the settingsTree, take the icon from the application class defaultIcon method" + "add an application to the settingsTree, take the icon from the application classes defaultIcon method" ^ self addApplClass:aClass withName:aName icon:nil expand:aBoolean. ! addApplClass:aClass withName:aName icon:icon - ^ self addApplClass:aClass withName:aName icon:icon expand:false ! addApplClass:aClass withName:aName icon:icon expand:doExpand - |applicationLabel locIcon locClass| "/ (self applicationNames includes:aName) ifTrue:[ @@ -638,8 +629,7 @@ ! addIcon:aIcon forCategory:aCategoryName - -" add a new category Icon for a categorie " + "add a new category Icon for a category" |existingItem| @@ -651,12 +641,10 @@ ! applicationNames - ^ self applicationList collect:[:item | item nameString]. ! categoryIcons - categoryIcons isNil ifTrue:[ categoryIcons := Dictionary new. ]. @@ -664,7 +652,6 @@ ! childrenApplicationItemFor:aApplication fromItem:anItem - anItem application = aApplication ifTrue:[ ^ anItem ]. @@ -677,20 +664,19 @@ ! getAllChildrenAppsForApplication:aApplication - ^ self getAllChildrenAppsForApplication:aApplication matchBlock:nil ! -getAllChildrenAppsForApplication:aApplication childrenClass:aClass +getAllChildrenAppsForApplication:aApplication childrenClass:aClass + |matchBlock| - | matchBlock | - matchBlock := [:aSubApplication| aSubApplication class == aClass]. + matchBlock := [:aSubApplication | aSubApplication class == aClass ]. ^ self getAllChildrenAppsForApplication:aApplication matchBlock:matchBlock ! getAllChildrenAppsForApplication:aApplication matchBlock:aMatchBlock + | children | - | children | children := self getAllChildrenByApplication:aApplication. aMatchBlock notNil ifTrue:[ children := children select:[:aChild | aMatchBlock value:(aChild application)] @@ -699,15 +685,14 @@ ! getAllChildrenByApplication:aApplication + | item | - | item | item := self getItemByApplication:aApplication. item isNil ifTrue:[ ^ #()]. ^ item children. ! getApplicationsByClass:aClass - | classEntries| self applicationList isNil ifTrue:[ @@ -718,7 +703,6 @@ ! getItemByApplication:anApplication - |item| self applicationList do:[:anItem | @@ -729,7 +713,6 @@ ! getNameOfApplication:aApplication - |item| self applicationList do:[:anItem | @@ -755,7 +738,6 @@ ! parentApplicationFor:aApplication - |item parent| item := (self getItemByApplication:aApplication). @@ -767,7 +749,7 @@ ! remApplClassByName:aName -" remove a application from the settingsTree" + "remove an application from the settingsTree" |item| @@ -776,7 +758,6 @@ ! removeAllApplicationsByClass:aClass - |apps| apps := self getApplicationsByClass:aClass. @@ -786,7 +767,6 @@ ! removeAllSubApplicationsFor:aApp - |apps| apps := self getAllChildrenAppsForApplication:aApp. @@ -796,7 +776,6 @@ ! removeApplicationByClass:aClass - | classEntries| self applicationList isNil ifTrue:[ @@ -809,7 +788,6 @@ ! removeApplicationFromTree:aApplication - | classEntries| self applicationList isNil ifTrue:[ @@ -823,19 +801,15 @@ ! removeByApplication:aApplication + | item | - | item | item := self getItemByApplication:aApplication. item notNil ifTrue:[ self removeItem:item. ] - - - ! sortSubApplicationsFor:anApplication - |item| item := self getItemByApplication:anApplication. @@ -847,9 +821,7 @@ !SettingsDialog methodsFor:'application list access -private'! addCategoriesFor:aName - - " create all the categories before application itself - " + "create all the categories" (aName includes:$/) ifFalse:[ ^ self]. self treeName:aName butLast:1 do:[:currentLabel :currentName| | length icon| @@ -861,9 +833,8 @@ ! createItemForApplication:anApplication class:aClass label:aLabel icon:aIcon expandParent:expandParent replaceExisting:doReplaceExisting + "create an application item in my application list" - " create an application item in my application list - " | newItem parent locIcon item| parent := self getItemByApplication:anApplication. @@ -895,7 +866,6 @@ ! createItemName:aNameString label:aLabel class:aClass icon:aIcon - ^ self createItemName:aNameString label:aLabel class:aClass icon:aIcon expandParent:false ! @@ -907,9 +877,8 @@ ! createItemName:aNameString label:aLabel class:aClass icon:aIcon expandParent:expandParent replaceExisting:doReplaceExisting + "create an application item in my application list" - " create an application item in my application list - " | newItem parentsName parent locIcon item| (aNameString includes:$/) ifTrue:[ @@ -944,21 +913,18 @@ ! createItemName:aNameString label:aLabel icon:aIcon + "create an application item in my application list" - " create an application item in my application list - " self createItemName:aNameString label:aLabel class:nil icon:aIcon expandParent:false ! createItemName:aNameString label:aLabel icon:aIcon replaceExisting:doReplaceExisting + "create an application item in my application list" - " create an application item in my application list - " self createItemName:aNameString label:aLabel class:nil icon:aIcon expandParent:false replaceExisting:doReplaceExisting ! getItemForName:aName - | searchItem| searchItem := self applicationList root. @@ -971,7 +937,7 @@ ! removeItem:aItem -" remove a application from the settingsTree" + "remove a application from the settingsTree" |parent remParent| @@ -991,7 +957,6 @@ ! treeName:aName butLast:last do:aBlock - | tree length| tree := aName asCollectionOfSubstringsSeparatedBy:$/. @@ -1007,14 +972,12 @@ ! treeName:aName do:aBlock - self treeName:aName butLast:0 do:aBlock ! ! !SettingsDialog methodsFor:'aspects'! applicationList - applicationList isNil ifTrue:[ applicationList := SettingsDialog::HierarchicalApplicationList new. ]. @@ -1022,7 +985,6 @@ ! enableHelp - enableHelp isNil ifTrue:[ enableHelp := true asValue. ]. @@ -1030,7 +992,6 @@ ! enableOK - enableOK isNil ifTrue:[ enableOK := true asValue. ]. @@ -1038,7 +999,6 @@ ! enableReload - enableReload isNil ifTrue:[ enableReload := true asValue. ]. @@ -1046,7 +1006,6 @@ ! selectedItem - selectedItem isNil ifTrue:[ selectedItem := ValueHolder new. selectedItem addDependent:self. @@ -1055,7 +1014,6 @@ ! subCanvasApplicationHolder - subCanvasApplicationHolder isNil ifTrue:[ subCanvasApplicationHolder := ValueHolder new. ]. @@ -1065,7 +1023,6 @@ !SettingsDialog methodsFor:'change & update'! modifiedChanged - |changedObject| changedObject := self subCanvasApplicationHolder value modifiedChannel. @@ -1074,7 +1031,6 @@ ! selectionChanged - | item oldAppl noApp lbl window app itemLabel| self selectedItem value == lastSelection ifTrue:[ ^ self]. @@ -1173,7 +1129,7 @@ resources := AbstractLauncherApplication resources. rootItem := self class itemClass new. rootItem label:(resources string:'Settings') "allBold". - rootItem nameString:'Settings'. + rootItem nameString:(resources string:'Settings'). rootItem icon:self class settingsIcon. self applicationList root:rootItem; showRoot:true "false". self selectedItem value:rootItem. @@ -1196,7 +1152,6 @@ ! loadSettingsFromFile - "restore settings from a settings-file." "a temporary kludge - we need a central systemSettings object for this, @@ -1333,7 +1288,7 @@ !SettingsDialog class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.59 2004-11-11 08:31:05 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.60 2004-11-11 09:06:09 cg Exp $' ! ! SettingsDialog initialize!