AbstractSettingsApplication.st
changeset 16332 bf165cac21fd
parent 16324 5f36246be507
child 16336 57393d9e51b3
child 16338 2fa0985a4a6d
--- a/AbstractSettingsApplication.st	Wed Apr 27 15:00:56 2016 +0200
+++ b/AbstractSettingsApplication.st	Wed Apr 27 15:03:27 2016 +0200
@@ -242,6 +242,13 @@
 	privateIn:AbstractSettingsApplication
 !
 
+AbstractSettingsApplication subclass:#PackagePathSettingsAppl
+	instanceVariableNames:'listOfFoldersInPath selectedFolder'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:AbstractSettingsApplication
+!
+
 AbstractSettingsApplication subclass:#PrinterSettingsAppl
 	instanceVariableNames:'selectedUnit supportsColor topMargin rightMargin bottomMargin
 		landscape pageFormatList pageFormat unitList leftMargin
@@ -442,7 +449,7 @@
     For a real settings dialog, you need a concrete settings dialog class to hold the pages
     (as an example, see SettingsDialog)
     and someone who specifies the hierarchy of settings-pages in a spec.
-    (as an example, see NewLauncher class>>defaultSettingsApplicationList)
+    (as an example, see SettingsDialog class>>defaultSettingsApplicationList)
 
     typical use:
 
@@ -1324,7 +1331,8 @@
     <resource: #help>
 
     ^ super flyByHelpSpec addPairsFrom:#(
-
+#autoloadedPackages
+'Select known packages from the left list, and click on ">>>" to add them to the autoloaded list.\These will be automatically loaded when ST/X is started without a snapshot image.\Packages are searched along the packagePath.'
 
 )
 ! !
@@ -1359,8 +1367,8 @@
        name: windowSpec
        window: 
       (WindowSpec
-         label: 'Memory Manager Settings'
-         name: 'Memory Manager Settings'
+         label: 'Autoloaded Packages Settings'
+         name: 'Autoloaded Packages Settings'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 705 722)
        )
@@ -1373,6 +1381,7 @@
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              labelPosition: topLeft
              translateLabel: true
+             activeHelpKey: autoloadedPackages
              component: 
             (SpecCollection
                collection: (
@@ -3376,8 +3385,8 @@
        name: windowSpec
        window:
       (WindowSpec
-         label: 'Tool Settings'
-         name: 'Tool Settings'
+         label: 'Code Generator Settings'
+         name: 'Code Generator Settings'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 607 786)
        )
@@ -5945,6 +5954,8 @@
 createServerApplicationFor:aServerInstance
     |settingsApp itemPathName newItem openApps|
 
+    "/ settingsDialog isNil ifTrue:[^ self].
+    
     openApps := settingsDialog getAllChildrenAppsForApplication:self childrenClass:HTTPServerSettingsAppl.
     (openApps contains:[:app | app httpServerInstance == aServerInstance]) ifTrue:[
         " already have an Item for this application "
@@ -5959,15 +5970,15 @@
     ].
 
     settingsApp := HTTPServerSettingsAppl basicNew.
-    settingsApp settingsDialog:self settingsDialog.
+    settingsApp settingsDialog:settingsDialog.
     settingsApp httpServerInstance:aServerInstance.
     settingsApp defaultSettingsApplication:false.
     settingsApp basicInitialize.
     itemPathName := self itemPathName , '/', settingsApp nameInSettingsDialog.
-    newItem := self settingsDialog addApplClass:#'HTTPServerSettingsAppl' withName:itemPathName.
+    newItem := settingsDialog addApplClass:#'HTTPServerSettingsAppl' withName:itemPathName.
     newItem application:settingsApp.
     self createdServerChanged.
-    self settingsDialog expandItemForApplication:self.
+    settingsDialog expandItemForApplication:self.
     settingsApp readSettings.
     settingsApp initialize.
 
@@ -6084,6 +6095,8 @@
 !
 
 removeAllServerSubApplications
+    "/ settingsDialog isNil ifTrue:[^ self].
+ 
     settingsDialog removeAllSubApplicationsFor:self
 !
 
@@ -6104,6 +6117,8 @@
 setPortOnFreePort
     |serverClass highestUsedPortNr portToUse instances|
 
+    "/ settingsDialog isNil ifTrue:[^ self].
+
     serverClass := self serverClass.
     (serverClass notNil and:[serverClass isLoaded]) ifTrue:[
         instances := serverClass runningServers asNewSet.
@@ -6227,6 +6242,7 @@
 !AbstractSettingsApplication::HTTPStartServerSettingsApplication methodsFor:'queries'!
 
 hasCreatedServer
+    "/ settingsDialog isNil ifTrue:[^ false].
     ^ (settingsDialog getAllChildrenAppsForApplication:self childrenClass:HTTPServerSettingsAppl)
         notEmpty
 !
@@ -11284,6 +11300,192 @@
         self osiCMISEMessageLogging value ~= OSI::CMISE messageLogging]]])
 ! !
 
+!AbstractSettingsApplication::PackagePathSettingsAppl class methodsFor:'help specs'!
+
+flyByHelpSpec
+    "This resource specification was automatically generated
+     by the UIHelpTool of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIHelpTool may not be able to read the specification."
+
+    "
+     UIHelpTool openOnClass:AbstractSettingsApplication::MemorySettingsAppl    
+    "
+
+    <resource: #help>
+
+    ^ super flyByHelpSpec addPairsFrom:#(
+
+
+)
+! !
+
+!AbstractSettingsApplication::PackagePathSettingsAppl class methodsFor:'image specs'!
+
+defaultIcon
+    <resource: #programImage>
+
+    ^ ToolbarIconLibrary packageOpen24x24Icon 
+! !
+
+!AbstractSettingsApplication::PackagePathSettingsAppl class methodsFor:'interface specs'!
+
+windowSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:AbstractSettingsApplication::PackagePathSettingsAppl andSelector:#windowSpec
+     AbstractSettingsApplication::PackagePathSettingsAppl new openInterface:#windowSpec
+     AbstractSettingsApplication::PackagePathSettingsAppl open
+    "
+
+    <resource: #canvas>
+
+    ^ 
+    #(FullSpec
+       name: windowSpec
+       window: 
+      (WindowSpec
+         label: 'Package Path Settings'
+         name: 'Package Path Settings'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 659 287)
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (FramedBoxSpec
+             label: 'Package Path'
+             name: 'FramedBox1'
+             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             labelPosition: topLeft
+             translateLabel: true
+             component: 
+            (SpecCollection
+               collection: (
+                (LabelSpec
+                   label: 'Folders in Package Path'
+                   name: 'Label1'
+                   layout: (LayoutFrame 0 0.0 10 0 0 1.0 40 0)
+                   translateLabel: true
+                 )
+                (SequenceViewSpec
+                   name: 'List1'
+                   layout: (LayoutFrame 0 0 40 0 0 1 -40 1)
+                   model: selectedFolder
+                   hasHorizontalScrollBar: true
+                   hasVerticalScrollBar: true
+                   useIndex: false
+                   sequenceList: listOfFoldersInPath
+                 )
+                (HorizontalPanelViewSpec
+                   name: 'HorizontalPanel1'
+                   layout: (LayoutFrame 0 0.0 -36 1 0 1.0 4 1)
+                   horizontalLayout: right
+                   verticalLayout: center
+                   horizontalSpace: 3
+                   verticalSpace: 3
+                   component: 
+                  (SpecCollection
+                     collection: (
+                      (ActionButtonSpec
+                         label: 'Add...'
+                         name: 'Button1'
+                         translateLabel: true
+                         model: addFolder
+                         extent: (Point 93 31)
+                         usePreferredWidth: true
+                         usePreferredHeight: true
+                       )
+                      (ActionButtonSpec
+                         label: 'Remove Selected'
+                         name: 'Button2'
+                         translateLabel: true
+                         model: removeSelectedFolder
+                         extent: (Point 144 31)
+                         usePreferredWidth: true
+                         usePreferredHeight: true
+                       )
+                      )
+                    
+                   )
+                 )
+                )
+              
+             )
+           )
+          )
+        
+       )
+     )
+! !
+
+!AbstractSettingsApplication::PackagePathSettingsAppl methodsFor:'actions'!
+
+addFolder
+    |folder|
+
+    folder := Dialog requestDirectoryName:'Additional Folder with Packages:'.
+    folder isEmptyOrNil ifTrue:[^ self].
+    (self listOfFoldersInPath includes:folder) ifFalse:[
+        self listOfFoldersInPath add:folder.
+        self updateModifiedChannel.
+    ].
+!
+
+basicReadSettings
+    self listOfFoldersInPath contents:(Smalltalk packagePath).
+!
+
+basicSaveSettings
+    Smalltalk packagePath:(self listOfFoldersInPath asOrderedCollection).
+!
+
+removeSelectedFolder
+    self listOfFoldersInPath remove:(self selectedFolder value) ifAbsent:[].
+    self updateModifiedChannel.
+! !
+
+!AbstractSettingsApplication::PackagePathSettingsAppl methodsFor:'aspects'!
+
+aspects
+    ^ #(
+    )
+!
+
+listOfFoldersInPath 
+    listOfFoldersInPath isNil ifTrue:[
+        listOfFoldersInPath := List new.
+        listOfFoldersInPath addAll:Smalltalk packagePath
+    ].    
+    ^ listOfFoldersInPath
+!
+
+selectedFolder 
+    selectedFolder isNil ifTrue:[
+        selectedFolder := nil asValue.
+    ].    
+    ^ selectedFolder
+! !
+
+!AbstractSettingsApplication::PackagePathSettingsAppl methodsFor:'help'!
+
+helpFilename
+    ^ 'Launcher/packagePathSettings.html'
+! !
+
+!AbstractSettingsApplication::PackagePathSettingsAppl methodsFor:'queries'!
+
+hasUnsavedChanges
+    self listOfFoldersInPath asOrderedCollection ~= Smalltalk packagePath asOrderedCollection ifTrue:[^ true].
+    ^ false.
+! !
+
 !AbstractSettingsApplication::PrinterSettingsAppl class methodsFor:'image specs'!
 
 defaultIcon
@@ -19174,8 +19376,8 @@
        name: windowSpec
        window: 
       (WindowSpec
-         label: 'Editor Settings'
-         name: 'Editor Settings'
+         label: 'Terminalview Settings'
+         name: 'Terminalview Settings'
          flags: 1
          min: (Point 10 10)
          bounds: (Rectangle 0 0 658 543)