SettingsDialog.st
changeset 6127 ffab88b8b1e5
parent 6126 fbe0461cda6b
child 6293 1c16cd8fdb79
equal deleted inserted replaced
6126:fbe0461cda6b 6127:ffab88b8b1e5
   449 
   449 
   450     ^ requestor
   450     ^ requestor
   451 !
   451 !
   452 
   452 
   453 requestor:something
   453 requestor:something
   454     "set the value of the instance variable 'requestor' (automatically generated)"
       
   455 
       
   456     requestor := something.
   454     requestor := something.
   457 !
   455 !
   458 
   456 
   459 rootItemLabel
   457 rootItemLabel
   460     ^ self applicationList root label.
   458     ^ self applicationList root label.
   469 ! !
   467 ! !
   470 
   468 
   471 !SettingsDialog methodsFor:'actions'!
   469 !SettingsDialog methodsFor:'actions'!
   472 
   470 
   473 changeLabelTo:aLabel application:aApplication
   471 changeLabelTo:aLabel application:aApplication
   474 
       
   475     | item |
   472     | item |
   476 
   473 
   477     item := self getItemByApplication:aApplication.
   474     item := self getItemByApplication:aApplication.
   478     item notNil ifTrue:[
   475     item notNil ifTrue:[
   479         item label:aLabel.
   476         item label:aLabel.
   480         item changed.
   477         item changed.
   481     ].
   478     ].
   482 !
   479 !
   483 
   480 
   484 destroyAll
   481 destroyAll
   485 
   482     self applicationList do:[ :applItem |
   486     self applicationList do:[ : applItem |
       
   487         (applItem isCategory not and:[applItem application notNil]) ifTrue:[
   483         (applItem isCategory not and:[applItem application notNil]) ifTrue:[
   488             applItem application close.
   484             applItem application close.
   489         ].
   485         ].
   490     ].
   486     ].
   491     ^ true
   487     ^ true
   492 !
   488 !
   493 
   489 
   494 doIndicatorClick:index 
   490 doIndicatorClick:index 
   495     "handle a click on the indicator
   491     "handle a click on the indicator"
   496     "
       
   497 
   492 
   498     (self applicationList at:index) toggleExpand
   493     (self applicationList at:index) toggleExpand
   499 !
   494 !
   500 
   495 
   501 doReload
   496 doReload
   517         item application saveSettingsIfUnsavedChangesArePresent.
   512         item application saveSettingsIfUnsavedChangesArePresent.
   518     ].
   513     ].
   519 !
   514 !
   520 
   515 
   521 expandItemForApplication:aApplication
   516 expandItemForApplication:aApplication
   522 
       
   523     | item |
   517     | item |
       
   518 
   524     item := self applicationList detect:[:item | item application = aApplication] ifNone:[nil].
   519     item := self applicationList detect:[:item | item application = aApplication] ifNone:[nil].
   525     item notNil ifTrue:[
   520     item notNil ifTrue:[
   526         item expand
   521         item expand
   527     ].
   522     ].
   528 !
   523 !
   529 
   524 
   530 help
   525 help
   531 
       
   532     | item |
   526     | item |
   533 
   527 
   534     item := self selectedItem value.
   528     item := self selectedItem value.
   535     (item isNil or:[item isCategory or:[item application isNil]]) ifTrue:[ ^ self].
   529     (item isNil or:[item isCategory or:[item application isNil]]) ifTrue:[ ^ self].
   536     item application help.
   530     item application help.
   552     ].
   546     ].
   553     ^ true
   547     ^ true
   554 !
   548 !
   555 
   549 
   556 sendSaveRequestToAll
   550 sendSaveRequestToAll
   557 
       
   558     self applicationList do:[ : applItem |
   551     self applicationList do:[ : applItem |
   559         (applItem isCategory not and:[applItem application notNil]) ifTrue:[
   552         (applItem isCategory not and:[applItem application notNil]) ifTrue:[
   560             applItem application saveRequest ifFalse:[
   553             applItem application saveRequest ifFalse:[
   561                 ^ false
   554                 ^ false
   562             ].
   555             ].
   564     ].
   557     ].
   565     ^ true
   558     ^ true
   566 !
   559 !
   567 
   560 
   568 sendSaveRequestToCurrent
   561 sendSaveRequestToCurrent
   569 
       
   570     | item |
   562     | item |
   571 
   563 
   572     item := self selectedItem value.
   564     item := self selectedItem value.
   573     (item isNil or:[item isCategory or:[item application isNil]]) ifTrue:[ ^ true].
   565     (item isNil or:[item isCategory or:[item application isNil]]) ifTrue:[ ^ true].
   574     self withWaitCursorDo:[
   566     self withWaitCursorDo:[
   578 ! !
   570 ! !
   579 
   571 
   580 !SettingsDialog methodsFor:'application list access'!
   572 !SettingsDialog methodsFor:'application list access'!
   581 
   573 
   582 addApplClass:aClass forApplication:anApplication label:aLabel expand:aBoolean
   574 addApplClass:aClass forApplication:anApplication label:aLabel expand:aBoolean
   583 " add a application in the to the settingsTree, take the icon from the application class defaultIcon method"
   575     "add an application to the settingsTree, take the icon from the application classes defaultIcon method"
       
   576 
   584     | class |
   577     | class |
   585 
   578 
   586     class := Smalltalk classNamed:aClass.
   579     class := Smalltalk classNamed:aClass.
   587     class isNil ifTrue:[
   580     class isNil ifTrue:[
   588         ('SettingsDialog [warning]:cant find ', aClass asString, ' for register') infoPrintCR.
   581         ('SettingsDialog [warning]:cant find ', aClass asString, ' for register') infoPrintCR.
   591     class autoload.
   584     class autoload.
   592     ^ self createItemForApplication:anApplication class:aClass label:aLabel icon:class defaultIcon expandParent:aBoolean replaceExisting:false
   585     ^ self createItemForApplication:anApplication class:aClass label:aLabel icon:class defaultIcon expandParent:aBoolean replaceExisting:false
   593 !
   586 !
   594 
   587 
   595 addApplClass:aClass withName:aName
   588 addApplClass:aClass withName:aName
   596 " add a application in the to the settingsTree, take the icon from the application class defaultIcon method"
   589    "add an application to the settingsTree, take the icon from the application classes defaultIcon method"
   597 
   590 
   598     ^ self addApplClass:aClass withName:aName icon:nil.
   591     ^ self addApplClass:aClass withName:aName icon:nil.
   599 !
   592 !
   600 
   593 
   601 addApplClass:aClass withName:aName expand:aBoolean
   594 addApplClass:aClass withName:aName expand:aBoolean
   602 " add a application in the to the settingsTree, take the icon from the application class defaultIcon method"
   595    "add an application to the settingsTree, take the icon from the application classes defaultIcon method"
   603 
   596 
   604     ^ self addApplClass:aClass withName:aName icon:nil expand:aBoolean.
   597     ^ self addApplClass:aClass withName:aName icon:nil expand:aBoolean.
   605 !
   598 !
   606 
   599 
   607 addApplClass:aClass withName:aName icon:icon
   600 addApplClass:aClass withName:aName icon:icon
   608 
       
   609     ^ self addApplClass:aClass withName:aName icon:icon expand:false
   601     ^ self addApplClass:aClass withName:aName icon:icon expand:false
   610 !
   602 !
   611 
   603 
   612 addApplClass:aClass withName:aName icon:icon expand:doExpand
   604 addApplClass:aClass withName:aName icon:icon expand:doExpand
   613 
       
   614     |applicationLabel locIcon locClass|
   605     |applicationLabel locIcon locClass|
   615 
   606 
   616 "/    (self applicationNames includes:aName) ifTrue:[
   607 "/    (self applicationNames includes:aName) ifTrue:[
   617 "/        ^ self getItemForName:aName.
   608 "/        ^ self getItemForName:aName.
   618 "/    ].
   609 "/    ].
   636 
   627 
   637     ^ self createItemName:aName label:(resources string:applicationLabel) class:locClass icon:locIcon expandParent:doExpand replaceExisting:false
   628     ^ self createItemName:aName label:(resources string:applicationLabel) class:locClass icon:locIcon expandParent:doExpand replaceExisting:false
   638 !
   629 !
   639 
   630 
   640 addIcon:aIcon forCategory:aCategoryName
   631 addIcon:aIcon forCategory:aCategoryName
   641 
   632     "add a new category Icon for a category"
   642 " add a new category Icon for a categorie "
       
   643 
   633 
   644     |existingItem|
   634     |existingItem|
   645 
   635 
   646     self categoryIcons at:aCategoryName put:aIcon.
   636     self categoryIcons at:aCategoryName put:aIcon.
   647     existingItem := self getItemForName:aCategoryName.
   637     existingItem := self getItemForName:aCategoryName.
   649         existingItem icon:aIcon
   639         existingItem icon:aIcon
   650     ].
   640     ].
   651 !
   641 !
   652 
   642 
   653 applicationNames
   643 applicationNames
   654 
       
   655     ^ self applicationList collect:[:item | item nameString].
   644     ^ self applicationList collect:[:item | item nameString].
   656 !
   645 !
   657 
   646 
   658 categoryIcons
   647 categoryIcons
   659 
       
   660     categoryIcons isNil ifTrue:[
   648     categoryIcons isNil ifTrue:[
   661         categoryIcons := Dictionary new.
   649         categoryIcons := Dictionary new.
   662     ].
   650     ].
   663     ^ categoryIcons 
   651     ^ categoryIcons 
   664 !
   652 !
   665 
   653 
   666 childrenApplicationItemFor:aApplication fromItem:anItem
   654 childrenApplicationItemFor:aApplication fromItem:anItem
   667 
       
   668     anItem application = aApplication ifTrue:[
   655     anItem application = aApplication ifTrue:[
   669         ^ anItem
   656         ^ anItem
   670     ].
   657     ].
   671     anItem hasChildren ifTrue:[
   658     anItem hasChildren ifTrue:[
   672         anItem children do:[:aChildItem |
   659         anItem children do:[:aChildItem |
   675     ].
   662     ].
   676     ^ nil
   663     ^ nil
   677 !
   664 !
   678 
   665 
   679 getAllChildrenAppsForApplication:aApplication 
   666 getAllChildrenAppsForApplication:aApplication 
   680 
       
   681     ^ self getAllChildrenAppsForApplication:aApplication matchBlock:nil
   667     ^ self getAllChildrenAppsForApplication:aApplication matchBlock:nil
   682 !
   668 !
   683 
   669 
   684 getAllChildrenAppsForApplication:aApplication childrenClass:aClass
   670 getAllChildrenAppsForApplication:aApplication childrenClass:aClass 
   685 
   671     |matchBlock|
   686     | matchBlock |
   672 
   687     matchBlock := [:aSubApplication| aSubApplication class == aClass].
   673     matchBlock := [:aSubApplication | aSubApplication class == aClass ].
   688     ^ self getAllChildrenAppsForApplication:aApplication matchBlock:matchBlock
   674     ^ self getAllChildrenAppsForApplication:aApplication matchBlock:matchBlock
   689 !
   675 !
   690 
   676 
   691 getAllChildrenAppsForApplication:aApplication matchBlock:aMatchBlock
   677 getAllChildrenAppsForApplication:aApplication matchBlock:aMatchBlock
   692 
       
   693     | children |
   678     | children |
       
   679 
   694     children := self getAllChildrenByApplication:aApplication.
   680     children := self getAllChildrenByApplication:aApplication.
   695     aMatchBlock notNil ifTrue:[
   681     aMatchBlock notNil ifTrue:[
   696         children := children select:[:aChild | aMatchBlock value:(aChild application)]
   682         children := children select:[:aChild | aMatchBlock value:(aChild application)]
   697     ].
   683     ].
   698     ^ children collect:[:item | item application].
   684     ^ children collect:[:item | item application].
   699 !
   685 !
   700 
   686 
   701 getAllChildrenByApplication:aApplication
   687 getAllChildrenByApplication:aApplication
   702 
       
   703     | item |
   688     | item |
       
   689 
   704     item := self getItemByApplication:aApplication.
   690     item := self getItemByApplication:aApplication.
   705     item isNil ifTrue:[ ^ #()].
   691     item isNil ifTrue:[ ^ #()].
   706     ^ item children.
   692     ^ item children.
   707 !
   693 !
   708 
   694 
   709 getApplicationsByClass:aClass
   695 getApplicationsByClass:aClass
   710 
       
   711     | classEntries|
   696     | classEntries|
   712 
   697 
   713     self applicationList isNil ifTrue:[
   698     self applicationList isNil ifTrue:[
   714         self initialize.
   699         self initialize.
   715     ].
   700     ].
   716     classEntries := self applicationList select:[:aEntry | aEntry application class == aClass].
   701     classEntries := self applicationList select:[:aEntry | aEntry application class == aClass].
   717     ^ classEntries collect:[:aItem | aItem application].
   702     ^ classEntries collect:[:aItem | aItem application].
   718 !
   703 !
   719 
   704 
   720 getItemByApplication:anApplication
   705 getItemByApplication:anApplication
   721 
       
   722     |item|
   706     |item|
   723 
   707 
   724     self applicationList do:[:anItem |
   708     self applicationList do:[:anItem |
   725         item := self childrenApplicationItemFor:anApplication fromItem:anItem.
   709         item := self childrenApplicationItemFor:anApplication fromItem:anItem.
   726         item notNil ifTrue:[ ^ item ].
   710         item notNil ifTrue:[ ^ item ].
   727     ].
   711     ].
   728     ^ nil
   712     ^ nil
   729 !
   713 !
   730 
   714 
   731 getNameOfApplication:aApplication
   715 getNameOfApplication:aApplication
   732 
       
   733     |item|
   716     |item|
   734 
   717 
   735     self applicationList do:[:anItem |
   718     self applicationList do:[:anItem |
   736         item := self childrenApplicationItemFor:aApplication fromItem:anItem.
   719         item := self childrenApplicationItemFor:aApplication fromItem:anItem.
   737         item notNil ifTrue:[ ^ item nameString].
   720         item notNil ifTrue:[ ^ item nameString].
   753     iconHolderOrNil := entry at:3 ifAbsent:nil.
   736     iconHolderOrNil := entry at:3 ifAbsent:nil.
   754     self addApplClass:applClassOrNil withName:applName icon:iconHolderOrNil value
   737     self addApplClass:applClassOrNil withName:applName icon:iconHolderOrNil value
   755 !
   738 !
   756 
   739 
   757 parentApplicationFor:aApplication
   740 parentApplicationFor:aApplication
   758 
       
   759     |item parent|
   741     |item parent|
   760 
   742 
   761     item := (self getItemByApplication:aApplication).
   743     item := (self getItemByApplication:aApplication).
   762     parent := item parent.
   744     parent := item parent.
   763     parent notNil ifTrue:[
   745     parent notNil ifTrue:[
   765     ].
   747     ].
   766     ^ nil
   748     ^ nil
   767 !
   749 !
   768 
   750 
   769 remApplClassByName:aName 
   751 remApplClassByName:aName 
   770 " remove a application from the settingsTree"
   752     "remove an application from the settingsTree"
   771 
   753 
   772     |item|
   754     |item|
   773 
   755 
   774     item := self getItemForName:aName.
   756     item := self getItemForName:aName.
   775     self removeItem:item 
   757     self removeItem:item 
   776 !
   758 !
   777 
   759 
   778 removeAllApplicationsByClass:aClass
   760 removeAllApplicationsByClass:aClass
   779 
       
   780     |apps|
   761     |apps|
   781 
   762 
   782     apps := self getApplicationsByClass:aClass.
   763     apps := self getApplicationsByClass:aClass.
   783     apps do:[:aApp |
   764     apps do:[:aApp |
   784         self removeByApplication:aApp.
   765         self removeByApplication:aApp.
   785     ].
   766     ].
   786 !
   767 !
   787 
   768 
   788 removeAllSubApplicationsFor:aApp
   769 removeAllSubApplicationsFor:aApp
   789 
       
   790     |apps|
   770     |apps|
   791 
   771 
   792     apps := self getAllChildrenAppsForApplication:aApp.
   772     apps := self getAllChildrenAppsForApplication:aApp.
   793     apps do:[:aApp |
   773     apps do:[:aApp |
   794         self removeByApplication:aApp.
   774         self removeByApplication:aApp.
   795     ].
   775     ].
   796 !
   776 !
   797 
   777 
   798 removeApplicationByClass:aClass
   778 removeApplicationByClass:aClass
   799 
       
   800     | classEntries|
   779     | classEntries|
   801 
   780 
   802     self applicationList isNil ifTrue:[
   781     self applicationList isNil ifTrue:[
   803         self initialize.
   782         self initialize.
   804     ].
   783     ].
   807         self removeItem:aItem.
   786         self removeItem:aItem.
   808     ].
   787     ].
   809 !
   788 !
   810 
   789 
   811 removeApplicationFromTree:aApplication
   790 removeApplicationFromTree:aApplication
   812 
       
   813     | classEntries|
   791     | classEntries|
   814 
   792 
   815     self applicationList isNil ifTrue:[
   793     self applicationList isNil ifTrue:[
   816         self initialize.
   794         self initialize.
   817     ].
   795     ].
   821     ].
   799     ].
   822     self applicationList removeAllFoundIn:classEntries.
   800     self applicationList removeAllFoundIn:classEntries.
   823 !
   801 !
   824 
   802 
   825 removeByApplication:aApplication
   803 removeByApplication:aApplication
   826 
       
   827     | item |
   804     | item |
       
   805 
   828     item := self getItemByApplication:aApplication.
   806     item := self getItemByApplication:aApplication.
   829     item notNil ifTrue:[
   807     item notNil ifTrue:[
   830         self removeItem:item.
   808         self removeItem:item.
   831     ]
   809     ]
   832 
       
   833 
       
   834 
       
   835 !
   810 !
   836 
   811 
   837 sortSubApplicationsFor:anApplication
   812 sortSubApplicationsFor:anApplication
   838 
       
   839     |item|
   813     |item|
   840 
   814 
   841     item := self getItemByApplication:anApplication.
   815     item := self getItemByApplication:anApplication.
   842     item sort:[:a :b|
   816     item sort:[:a :b|
   843         a label < b label
   817         a label < b label
   845 ! !
   819 ! !
   846 
   820 
   847 !SettingsDialog methodsFor:'application list access -private'!
   821 !SettingsDialog methodsFor:'application list access -private'!
   848 
   822 
   849 addCategoriesFor:aName
   823 addCategoriesFor:aName
   850 
   824     "create all the categories"
   851     " create all the categories before application itself
       
   852     "
       
   853 
   825 
   854     (aName includes:$/) ifFalse:[ ^ self].
   826     (aName includes:$/) ifFalse:[ ^ self].
   855     self treeName:aName butLast:1 do:[:currentLabel :currentName| | length icon|
   827     self treeName:aName butLast:1 do:[:currentLabel :currentName| | length icon|
   856         currentLabel notEmpty ifTrue:[
   828         currentLabel notEmpty ifTrue:[
   857             icon := self categoryIcons at:currentName ifAbsent:[nil].
   829             icon := self categoryIcons at:currentName ifAbsent:[nil].
   859         ]
   831         ]
   860     ].
   832     ].
   861 !
   833 !
   862 
   834 
   863 createItemForApplication:anApplication class:aClass label:aLabel icon:aIcon expandParent:expandParent replaceExisting:doReplaceExisting
   835 createItemForApplication:anApplication class:aClass label:aLabel icon:aIcon expandParent:expandParent replaceExisting:doReplaceExisting
   864 
   836     "create an application item in my application list"
   865     " create an application item in my application list 
   837 
   866     "
       
   867     | newItem parent locIcon item|
   838     | newItem parent locIcon item|
   868 
   839 
   869     parent := self getItemByApplication:anApplication.
   840     parent := self getItemByApplication:anApplication.
   870     parent isNil ifTrue:[
   841     parent isNil ifTrue:[
   871         ^ nil
   842         ^ nil
   893     ].
   864     ].
   894     ^ newItem
   865     ^ newItem
   895 !
   866 !
   896 
   867 
   897 createItemName:aNameString label:aLabel class:aClass icon:aIcon
   868 createItemName:aNameString label:aLabel class:aClass icon:aIcon
   898 
       
   899     ^ self createItemName:aNameString label:aLabel class:aClass icon:aIcon expandParent:false
   869     ^ self createItemName:aNameString label:aLabel class:aClass icon:aIcon expandParent:false
   900 !
   870 !
   901 
   871 
   902 createItemName:aNameString label:aLabel class:aClass icon:aIcon expandParent:expandParent
   872 createItemName:aNameString label:aLabel class:aClass icon:aIcon expandParent:expandParent
   903     ^ self
   873     ^ self
   905         expandParent:expandParent
   875         expandParent:expandParent
   906         replaceExisting:true
   876         replaceExisting:true
   907 !
   877 !
   908 
   878 
   909 createItemName:aNameString label:aLabel class:aClass icon:aIcon expandParent:expandParent replaceExisting:doReplaceExisting
   879 createItemName:aNameString label:aLabel class:aClass icon:aIcon expandParent:expandParent replaceExisting:doReplaceExisting
   910 
   880     "create an application item in my application list"
   911     " create an application item in my application list 
   881 
   912     "
       
   913     | newItem parentsName parent locIcon item|
   882     | newItem parentsName parent locIcon item|
   914 
   883 
   915     (aNameString includes:$/) ifTrue:[
   884     (aNameString includes:$/) ifTrue:[
   916         parentsName := aNameString copyTo:(aNameString lastIndexOf:$/)-1.
   885         parentsName := aNameString copyTo:(aNameString lastIndexOf:$/)-1.
   917         parent := self getItemForName:parentsName.
   886         parent := self getItemForName:parentsName.
   942     ].
   911     ].
   943     ^ newItem
   912     ^ newItem
   944 !
   913 !
   945 
   914 
   946 createItemName:aNameString label:aLabel icon:aIcon
   915 createItemName:aNameString label:aLabel icon:aIcon
   947 
   916     "create an application item in my application list"
   948     " create an application item in my application list 
   917 
   949     "
       
   950     self createItemName:aNameString label:aLabel class:nil icon:aIcon expandParent:false
   918     self createItemName:aNameString label:aLabel class:nil icon:aIcon expandParent:false
   951 !
   919 !
   952 
   920 
   953 createItemName:aNameString label:aLabel icon:aIcon replaceExisting:doReplaceExisting
   921 createItemName:aNameString label:aLabel icon:aIcon replaceExisting:doReplaceExisting
   954 
   922     "create an application item in my application list"
   955     " create an application item in my application list 
   923 
   956     "
       
   957     self createItemName:aNameString label:aLabel class:nil icon:aIcon expandParent:false replaceExisting:doReplaceExisting
   924     self createItemName:aNameString label:aLabel class:nil icon:aIcon expandParent:false replaceExisting:doReplaceExisting
   958 !
   925 !
   959 
   926 
   960 getItemForName:aName
   927 getItemForName:aName
   961 
       
   962     | searchItem|
   928     | searchItem|
   963 
   929 
   964     searchItem := self applicationList root.
   930     searchItem := self applicationList root.
   965     self treeName:aName do:[:currentLabel :currentName|
   931     self treeName:aName do:[:currentLabel :currentName|
   966         searchItem children isNil ifTrue:[ ^ nil].
   932         searchItem children isNil ifTrue:[ ^ nil].
   969     ].
   935     ].
   970     ^ searchItem
   936     ^ searchItem
   971 !
   937 !
   972 
   938 
   973 removeItem:aItem 
   939 removeItem:aItem 
   974 " remove a application from the settingsTree"
   940     "remove a application from the settingsTree"
   975 
   941 
   976     |parent remParent|
   942     |parent remParent|
   977 
   943 
   978     aItem application release.
   944     aItem application release.
   979 
   945 
   989     self applicationList remove:aItem ifAbsent:[nil].
   955     self applicationList remove:aItem ifAbsent:[nil].
   990     self selectedItem value:parent.
   956     self selectedItem value:parent.
   991 !
   957 !
   992 
   958 
   993 treeName:aName butLast:last do:aBlock 
   959 treeName:aName butLast:last do:aBlock 
   994 
       
   995     | tree  length|
   960     | tree  length|
   996 
   961 
   997     tree := aName asCollectionOfSubstringsSeparatedBy:$/.
   962     tree := aName asCollectionOfSubstringsSeparatedBy:$/.
   998     tree from:1 to:(tree size - last) keysAndValuesDo:[:idx :aCategory| | itemName |
   963     tree from:1 to:(tree size - last) keysAndValuesDo:[:idx :aCategory| | itemName |
   999         length := 0.
   964         length := 0.
  1005         aBlock value:aCategory value:itemName.
   970         aBlock value:aCategory value:itemName.
  1006     ].
   971     ].
  1007 !
   972 !
  1008 
   973 
  1009 treeName:aName do:aBlock
   974 treeName:aName do:aBlock
  1010 
       
  1011     self treeName:aName butLast:0 do:aBlock
   975     self treeName:aName butLast:0 do:aBlock
  1012 ! !
   976 ! !
  1013 
   977 
  1014 !SettingsDialog methodsFor:'aspects'!
   978 !SettingsDialog methodsFor:'aspects'!
  1015 
   979 
  1016 applicationList
   980 applicationList
  1017 
       
  1018     applicationList isNil ifTrue:[
   981     applicationList isNil ifTrue:[
  1019         applicationList := SettingsDialog::HierarchicalApplicationList new.
   982         applicationList := SettingsDialog::HierarchicalApplicationList new.
  1020     ].
   983     ].
  1021     ^ applicationList.
   984     ^ applicationList.
  1022 !
   985 !
  1023 
   986 
  1024 enableHelp
   987 enableHelp
  1025 
       
  1026     enableHelp isNil ifTrue:[
   988     enableHelp isNil ifTrue:[
  1027         enableHelp := true asValue.
   989         enableHelp := true asValue.
  1028     ].
   990     ].
  1029     ^ enableHelp.
   991     ^ enableHelp.
  1030 !
   992 !
  1031 
   993 
  1032 enableOK
   994 enableOK
  1033 
       
  1034     enableOK isNil ifTrue:[
   995     enableOK isNil ifTrue:[
  1035         enableOK := true asValue.
   996         enableOK := true asValue.
  1036     ].
   997     ].
  1037     ^ enableOK.
   998     ^ enableOK.
  1038 !
   999 !
  1039 
  1000 
  1040 enableReload
  1001 enableReload
  1041 
       
  1042     enableReload isNil ifTrue:[
  1002     enableReload isNil ifTrue:[
  1043         enableReload := true asValue.
  1003         enableReload := true asValue.
  1044     ].
  1004     ].
  1045     ^ enableReload.
  1005     ^ enableReload.
  1046 !
  1006 !
  1047 
  1007 
  1048 selectedItem
  1008 selectedItem
  1049 
       
  1050     selectedItem isNil ifTrue:[
  1009     selectedItem isNil ifTrue:[
  1051         selectedItem := ValueHolder new.
  1010         selectedItem := ValueHolder new.
  1052         selectedItem addDependent:self.
  1011         selectedItem addDependent:self.
  1053     ].
  1012     ].
  1054     ^ selectedItem.
  1013     ^ selectedItem.
  1055 !
  1014 !
  1056 
  1015 
  1057 subCanvasApplicationHolder
  1016 subCanvasApplicationHolder
  1058 
       
  1059     subCanvasApplicationHolder isNil ifTrue:[
  1017     subCanvasApplicationHolder isNil ifTrue:[
  1060         subCanvasApplicationHolder := ValueHolder new.
  1018         subCanvasApplicationHolder := ValueHolder new.
  1061     ].
  1019     ].
  1062     ^ subCanvasApplicationHolder.
  1020     ^ subCanvasApplicationHolder.
  1063 ! !
  1021 ! !
  1064 
  1022 
  1065 !SettingsDialog methodsFor:'change & update'!
  1023 !SettingsDialog methodsFor:'change & update'!
  1066 
  1024 
  1067 modifiedChanged
  1025 modifiedChanged
  1068 
       
  1069     |changedObject|
  1026     |changedObject|
  1070 
  1027 
  1071     changedObject := self subCanvasApplicationHolder value modifiedChannel.
  1028     changedObject := self subCanvasApplicationHolder value modifiedChannel.
  1072     self enableOK value:(changedObject value).
  1029     self enableOK value:(changedObject value).
  1073     self enableReload value:(changedObject value).
  1030     self enableReload value:(changedObject value).
  1074 !
  1031 !
  1075 
  1032 
  1076 selectionChanged
  1033 selectionChanged
  1077 
       
  1078     | item oldAppl noApp lbl window app itemLabel|
  1034     | item oldAppl noApp lbl window app itemLabel|
  1079 
  1035 
  1080     self selectedItem value == lastSelection  ifTrue:[ ^ self].
  1036     self selectedItem value == lastSelection  ifTrue:[ ^ self].
  1081     oldAppl := self subCanvasApplicationHolder value.
  1037     oldAppl := self subCanvasApplicationHolder value.
  1082     oldAppl notNil ifTrue:[
  1038     oldAppl notNil ifTrue:[
  1171     |rootItem|
  1127     |rootItem|
  1172 
  1128 
  1173     resources := AbstractLauncherApplication resources.
  1129     resources := AbstractLauncherApplication resources.
  1174     rootItem := self class itemClass new.
  1130     rootItem := self class itemClass new.
  1175     rootItem label:(resources string:'Settings') "allBold".
  1131     rootItem label:(resources string:'Settings') "allBold".
  1176     rootItem nameString:'Settings'.
  1132     rootItem nameString:(resources string:'Settings').
  1177     rootItem icon:self class settingsIcon.
  1133     rootItem icon:self class settingsIcon.
  1178     self applicationList root:rootItem; showRoot:true "false".
  1134     self applicationList root:rootItem; showRoot:true "false".
  1179     self selectedItem value:rootItem.
  1135     self selectedItem value:rootItem.
  1180     super initialize.
  1136     super initialize.
  1181 !
  1137 !
  1194 askForFileAndSaveSettings
  1150 askForFileAndSaveSettings
  1195     self class askForFileAndSaveSettings.
  1151     self class askForFileAndSaveSettings.
  1196 !
  1152 !
  1197 
  1153 
  1198 loadSettingsFromFile
  1154 loadSettingsFromFile
  1199 
       
  1200     "restore settings from a settings-file."
  1155     "restore settings from a settings-file."
  1201 
  1156 
  1202     "a temporary kludge - we need a central systemSettings object for this,
  1157     "a temporary kludge - we need a central systemSettings object for this,
  1203      which can be saved/restored with a single store/read."
  1158      which can be saved/restored with a single store/read."
  1204 
  1159 
  1331 ! !
  1286 ! !
  1332 
  1287 
  1333 !SettingsDialog class methodsFor:'documentation'!
  1288 !SettingsDialog class methodsFor:'documentation'!
  1334 
  1289 
  1335 version
  1290 version
  1336     ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.59 2004-11-11 08:31:05 cg Exp $'
  1291     ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.60 2004-11-11 09:06:09 cg Exp $'
  1337 ! !
  1292 ! !
  1338 
  1293 
  1339 SettingsDialog initialize!
  1294 SettingsDialog initialize!