*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Mon, 16 Nov 2009 14:20:20 +0100
changeset 27244bd4ad9083fb
parent 2723 d03a850ebc29
child 2725 168192759cae
*** empty log message ***
Tools__ProjectBuilderAssistantApplication.st
     1.1 --- a/Tools__ProjectBuilderAssistantApplication.st	Sun Nov 15 23:19:23 2009 +0100
     1.2 +++ b/Tools__ProjectBuilderAssistantApplication.st	Mon Nov 16 14:20:20 2009 +0100
     1.3 @@ -17,7 +17,9 @@
     1.4  		selectedApplicationsComment buildDirectoryHolder makeProcess
     1.5  		listOfClassesInProject makeOutputWindow projectBuilder
     1.6  		newStartupClassName usedCompilerHolder listOfNewProjectsName
     1.7 -		newProjectsNameListExtendedComboBox'
     1.8 +		newProjectsNameListExtendedComboBox productNameHolder
     1.9 +		companyNameHolder compilerWarnMessageHolder
    1.10 +		compilerWarnMessageVisibleHolder'
    1.11  	classVariableNames:''
    1.12  	poolDictionaries:''
    1.13  	category:'System-Support-Projects'
    1.14 @@ -155,12 +157,22 @@
    1.15          )
    1.16  
    1.17          (AssistantPageSpec
    1.18 +            pageTitle: 'Specify Project Attributes'
    1.19 +            windowSpecSelector: page6a_specifyProjectAttributes
    1.20 +            infoText: 'Define additional attributes.'
    1.21 +            enterCallbackSelector: updateProjectAttributes
    1.22 +            leaveCallbackSelector: #rememberProjectAttributes
    1.23 +        )
    1.24 +
    1.25 +        (AssistantPageSpec
    1.26              pageTitle: 'Specify Build Directory'
    1.27 -            windowSpecSelector: page6_specifyBuildDirectorySpec
    1.28 +            windowSpecSelector: page6b_specifyBuildDirectorySpec
    1.29              infoText: 'Define where the build-process is to be performed.
    1.30                         All generated files are created below that directory.
    1.31                         After deployment, the build directory is no longer needed
    1.32                         (but you can keep it for a faster compile the next time).'
    1.33 +
    1.34 +            enterCallbackSelector: #checkCompilerAvailability
    1.35          )
    1.36  
    1.37          (AssistantPageSpec
    1.38 @@ -868,7 +880,7 @@
    1.39        )
    1.40  !
    1.41  
    1.42 -page6_specifyBuildDirectorySpec
    1.43 +page6a_specifyProjectAttributes
    1.44      "This resource specification was automatically generated
    1.45       by the UIPainter of ST/X."
    1.46  
    1.47 @@ -876,15 +888,15 @@
    1.48       the UIPainter may not be able to read the specification."
    1.49  
    1.50      "
    1.51 -     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page6_specifyBuildDirectorySpec
    1.52 -     Tools::ProjectBuilderAssistantApplication new openInterface:#page6_specifyBuildDirectorySpec
    1.53 +     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page6a_specifyProjectAttributes
    1.54 +     Tools::ProjectBuilderAssistantApplication new openInterface:#page6a_specifyProjectAttributes
    1.55      "
    1.56  
    1.57      <resource: #canvas>
    1.58  
    1.59      ^ 
    1.60       #(FullSpec
    1.61 -        name: #'page6_specifyBuildDirectorySpec'
    1.62 +        name: #'page6a_specifyProjectAttributes'
    1.63          window: 
    1.64         (WindowSpec
    1.65            label: 'Project Selection'
    1.66 @@ -896,6 +908,82 @@
    1.67         (SpecCollection
    1.68            collection: (
    1.69             (FramedBoxSpec
    1.70 +              label: 'Product Information'
    1.71 +              name: 'FramedBox3'
    1.72 +              layout: (LayoutFrame 0 0.0 5 0 4 1.0 101 0)
    1.73 +              labelPosition: topLeft
    1.74 +              translateLabel: true
    1.75 +              component: 
    1.76 +             (SpecCollection
    1.77 +                collection: (
    1.78 +                 (LabelSpec
    1.79 +                    label: 'Product Name:'
    1.80 +                    name: 'Label1'
    1.81 +                    layout: (LayoutFrame 0 0 10 0 148 0 32 0)
    1.82 +                    translateLabel: true
    1.83 +                    adjust: right
    1.84 +                  )
    1.85 +                 (InputFieldSpec
    1.86 +                    name: 'EntryField4'
    1.87 +                    layout: (LayoutFrame 150 0.0 10 0 0 1.0 32 0)
    1.88 +                    model: productNameHolder
    1.89 +                    acceptOnLostFocus: true
    1.90 +                    acceptOnPointerLeave: true
    1.91 +                    viewClassName: ''
    1.92 +                  )
    1.93 +                 (LabelSpec
    1.94 +                    label: 'Company Name:'
    1.95 +                    name: 'Label2'
    1.96 +                    layout: (LayoutFrame 0 0 39 0 148 0 61 0)
    1.97 +                    translateLabel: true
    1.98 +                    adjust: right
    1.99 +                  )
   1.100 +                 (InputFieldSpec
   1.101 +                    name: 'EntryField3'
   1.102 +                    layout: (LayoutFrame 150 0.0 39 0 0 1.0 61 0)
   1.103 +                    model: companyNameHolder
   1.104 +                    acceptOnLostFocus: true
   1.105 +                    acceptOnPointerLeave: true
   1.106 +                    viewClassName: ''
   1.107 +                  )
   1.108 +                 )
   1.109 +               
   1.110 +              )
   1.111 +            )
   1.112 +           )
   1.113 +         
   1.114 +        )
   1.115 +      )
   1.116 +!
   1.117 +
   1.118 +page6b_specifyBuildDirectorySpec
   1.119 +    "This resource specification was automatically generated
   1.120 +     by the UIPainter of ST/X."
   1.121 +
   1.122 +    "Do not manually edit this!! If it is corrupted,
   1.123 +     the UIPainter may not be able to read the specification."
   1.124 +
   1.125 +    "
   1.126 +     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page6b_specifyBuildDirectorySpec
   1.127 +     Tools::ProjectBuilderAssistantApplication new openInterface:#page6b_specifyBuildDirectorySpec
   1.128 +    "
   1.129 +
   1.130 +    <resource: #canvas>
   1.131 +
   1.132 +    ^ 
   1.133 +     #(FullSpec
   1.134 +        name: #'page6b_specifyBuildDirectorySpec'
   1.135 +        window: 
   1.136 +       (WindowSpec
   1.137 +          label: 'Project Selection'
   1.138 +          name: 'Project Selection'
   1.139 +          min: (Point 0 0)
   1.140 +          bounds: (Rectangle 0 0 521 361)
   1.141 +        )
   1.142 +        component: 
   1.143 +       (SpecCollection
   1.144 +          collection: (
   1.145 +           (FramedBoxSpec
   1.146                label: 'Build Directory'
   1.147                name: 'FramedBox3'
   1.148                layout: (LayoutFrame 0 0.0 5 0 4 1.0 79 0)
   1.149 @@ -935,6 +1023,17 @@
   1.150                 
   1.151                )
   1.152              )
   1.153 +           (LabelSpec
   1.154 +              label: 'Compiler Warn-Label'
   1.155 +              name: 'Label1'
   1.156 +              layout: (LayoutFrame 2 0.0 158 0 -2 1.0 303 0)
   1.157 +              level: -1
   1.158 +              visibilityChannel: compilerWarnMessageVisibleHolder
   1.159 +              backgroundColor: (Color 100.0 49.999237048905 49.999237048905)
   1.160 +              translateLabel: true
   1.161 +              labelChannel: compilerWarnMessageHolder
   1.162 +              adjust: left
   1.163 +            )
   1.164             )
   1.165           
   1.166          )
   1.167 @@ -1106,7 +1205,7 @@
   1.168                         (ActionButtonSpec
   1.169                            label: 'Open Console'
   1.170                            name: 'Button2'
   1.171 -                          visibilityChannel: false
   1.172 +                          visibilityChannel: isUnixOS
   1.173                            translateLabel: true
   1.174                            resizeForLabel: true
   1.175                            model: doOpenConsoleTerminal
   1.176 @@ -1202,7 +1301,8 @@
   1.177                              category:'Applications'.
   1.178              CodeGeneratorTool createApplicationCodeFor:newAppClass.
   1.179          ].
   1.180 -        self updateListOfApplicationsInProject
   1.181 +        self updateListOfApplicationsInProject.
   1.182 +        self selectedApplicationIndexHolder value:(listOfApplicationsInProject value indexOf:newAppClass).
   1.183      ].
   1.184  !
   1.185  
   1.186 @@ -1290,7 +1390,8 @@
   1.187              self projectTypeIsGuiApplication ifTrue: [startupApplication := selectedApplication].
   1.188              CodeGeneratorTool createStartupCodeFor:newStartupClass forStartOf:startupApplication.
   1.189          ].
   1.190 -        self updateListOfStartupClassesInProject
   1.191 +        self updateListOfStartupClassesInProject.
   1.192 +        self selectedStartupClassIndexHolder value:(listOfStartupClassesInProject value indexOf:newStartupClass).
   1.193      ].
   1.194  !
   1.195  
   1.196 @@ -1362,9 +1463,13 @@
   1.197  "/    OperatingSystem
   1.198  "/        executeCommand:'cmd.exe'        
   1.199  "/        inDirectory:(projectBuilder packageBuildDirectory)
   1.200 -    OperatingSystem
   1.201 -        executeCommand:'c:\windows\System32\cmd.exe'        
   1.202 -        inDirectory:(projectBuilder packageBuildDirectory)
   1.203 +    OperatingSystem isUNIXlike ifTrue:[
   1.204 +        VT100TerminalView openShellIn:(projectBuilder packageBuildDirectory)
   1.205 +    ] ifFalse:[
   1.206 +        OperatingSystem
   1.207 +            executeCommand:'c:\windows\System32\cmd.exe'        
   1.208 +            inDirectory:(projectBuilder packageBuildDirectory)
   1.209 +    ]
   1.210  !
   1.211  
   1.212  doOpenExplorer
   1.213 @@ -1378,6 +1483,7 @@
   1.214      self stopMakeButtonVisible value:true.
   1.215      self startMakeButtonEnabled value:false.
   1.216  
   1.217 +    self infoHolder value:'Building (make) - please wait...'.
   1.218      makeOutputWindow clear.
   1.219  
   1.220      makeProcess := 
   1.221 @@ -1389,6 +1495,7 @@
   1.222                      self startMakeButtonEnabled value:true.
   1.223                      makeProcess := nil.
   1.224                      self updateButtonEnableState.
   1.225 +                    self infoHolder value:''.
   1.226                  ].
   1.227              ] newProcess.
   1.228  
   1.229 @@ -1403,6 +1510,7 @@
   1.230      self stopMakeButtonVisible value:true.
   1.231      self startMakeButtonEnabled value:false.
   1.232  
   1.233 +    self infoHolder value:'Building (make) - please wait...'.
   1.234      makeOutputWindow clear.
   1.235  
   1.236      makeProcess := 
   1.237 @@ -1414,6 +1522,7 @@
   1.238                      self startMakeButtonEnabled value:true.
   1.239                      makeProcess := nil.
   1.240                      self updateButtonEnableState.
   1.241 +                    self infoHolder value:''.
   1.242                  ].
   1.243              ] newProcess.
   1.244  
   1.245 @@ -1562,6 +1671,33 @@
   1.246      ^ buildDirectoryHolder.
   1.247  !
   1.248  
   1.249 +companyNameHolder
   1.250 +    <resource: #uiAspect>
   1.251 +
   1.252 +    companyNameHolder isNil ifTrue:[
   1.253 +        companyNameHolder := 'MyCompany' asValue.
   1.254 +    ].
   1.255 +    ^ companyNameHolder.
   1.256 +!
   1.257 +
   1.258 +compilerWarnMessageHolder
   1.259 +    <resource: #uiAspect>
   1.260 +
   1.261 +    compilerWarnMessageHolder isNil ifTrue:[
   1.262 +        compilerWarnMessageHolder := '' asValue.
   1.263 +    ].
   1.264 +    ^ compilerWarnMessageHolder.
   1.265 +!
   1.266 +
   1.267 +compilerWarnMessageVisibleHolder
   1.268 +    <resource: #uiAspect>
   1.269 +
   1.270 +    compilerWarnMessageVisibleHolder isNil ifTrue:[
   1.271 +        compilerWarnMessageVisibleHolder := false asValue.
   1.272 +    ].
   1.273 +    ^ compilerWarnMessageVisibleHolder.
   1.274 +!
   1.275 +
   1.276  hasApplicationSelectedHolder
   1.277      <resource: #uiAspect>
   1.278  
   1.279 @@ -1667,7 +1803,7 @@
   1.280  
   1.281  listOfPossibleCompilers
   1.282      OperatingSystem isMSWINDOWSlike ifTrue:[
   1.283 -        ^ #('bcc' 'vc' 'lcc')
   1.284 +        ^ #('bcc' 'vc' 'lcc' 'gcc' )
   1.285      ].
   1.286      ^ #('gcc')
   1.287  !
   1.288 @@ -1748,6 +1884,15 @@
   1.289      ^ newStartupClassName.
   1.290  !
   1.291  
   1.292 +productNameHolder
   1.293 +    <resource: #uiAspect>
   1.294 +
   1.295 +    productNameHolder isNil ifTrue:[
   1.296 +        productNameHolder := 'MyProduct' asValue.
   1.297 +    ].
   1.298 +    ^ productNameHolder.
   1.299 +!
   1.300 +
   1.301  projectType
   1.302      self projectTypeHolder value == #libraryType ifTrue:[
   1.303          ^ ProjectDefinition libraryType
   1.304 @@ -1878,7 +2023,8 @@
   1.305  
   1.306      usedCompilerHolder isNil ifTrue:[
   1.307          usedCompilerHolder := ValueHolder new.
   1.308 -        usedCompilerHolder value:(OperatingSystem isMSWINDOWSlike ifTrue:['bcc'] ifFalse:['gcc'])
   1.309 +        usedCompilerHolder value:(OperatingSystem isMSWINDOWSlike ifTrue:['bcc'] ifFalse:['gcc']).
   1.310 +        usedCompilerHolder onChangeSend:#checkCompilerAvailability to:self.
   1.311      ].
   1.312      ^ usedCompilerHolder.
   1.313  ! !
   1.314 @@ -1894,7 +2040,11 @@
   1.315  
   1.316      browser := FileBrowserV2 new.
   1.317      browser onDirectory:targetDirectory.
   1.318 -    browser filter:'*.exe'.
   1.319 +    OperatingSystem isMSWINDOWSlike ifTrue:[
   1.320 +        browser filter:'*.exe;*.com'.
   1.321 +    ] ifFalse:[
   1.322 +        browser filter:'*'.
   1.323 +    ].
   1.324      ^ browser.
   1.325  !
   1.326  
   1.327 @@ -2026,6 +2176,10 @@
   1.328      ^ self hasProjectSelected "and:[ self hasApplicationSelected ]"
   1.329  !
   1.330  
   1.331 +isUnixOS
   1.332 +    ^ OperatingSystem isUNIXlike
   1.333 +!
   1.334 +
   1.335  isWindowsOS
   1.336      ^ OperatingSystem isMSWINDOWSlike
   1.337  !
   1.338 @@ -2050,6 +2204,55 @@
   1.339  
   1.340  !ProjectBuilderAssistantApplication methodsFor:'update'!
   1.341  
   1.342 +checkCompilerAvailability
   1.343 +    |cmd suite warnMsg1 warnMsg2 sep|
   1.344 +
   1.345 +    cmd := 'cc'.
   1.346 +    suite := 'C-Compiler'.
   1.347 +    warnMsg1 := warnMsg2 := ''.
   1.348 +
   1.349 +    self usedCompilerHolder value = 'bcc' ifTrue:[
   1.350 +        cmd := 'bcc32'.
   1.351 +        suite := 'Borland C-Compiler'.
   1.352 +    ].
   1.353 +    self usedCompilerHolder value = 'vc' ifTrue:[
   1.354 +        cmd := 'cl'.
   1.355 +        suite := 'Microsoft Visual C C-Compiler'.
   1.356 +        warnMsg2 := 'Due to bugs in this C-compiler, some classes may not be compilable.'.
   1.357 +    ].
   1.358 +    self usedCompilerHolder value = 'lcc' ifTrue:[
   1.359 +        cmd := 'lcc'.
   1.360 +        suite := 'LCC C-Compiler'.
   1.361 +        warnMsg2 := 'The LCC C-compiler suite is not yet supported (linkage).'.
   1.362 +    ].
   1.363 +    self usedCompilerHolder value = 'gcc' ifTrue:[
   1.364 +        cmd := 'gcc'.
   1.365 +        suite := 'GNU C-Compiler'.
   1.366 +        OperatingSystem isMSWINDOWSlike ifTrue:[
   1.367 +            warnMsg2 := 'The GNU C-compiler suite is not yet supported on MSDOS systems.'.
   1.368 +        ].
   1.369 +    ].
   1.370 +
   1.371 +    (OperatingSystem canExecuteCommand:cmd) ifFalse:[
   1.372 +        warnMsg1 :=
   1.373 +'The "%1"-command seems to be not in your path.
   1.374 +Please ensure that you installed the 
   1.375 +"%2" compiler suite correctly.' bindWith:cmd with:suite.
   1.376 +    ].
   1.377 +
   1.378 +    (warnMsg1 notEmpty or:[warnMsg2 notEmpty]) ifTrue:[
   1.379 +        sep := ''.
   1.380 +        (warnMsg2 notEmpty) ifTrue:[ sep := '\\' withCRs ].
   1.381 +
   1.382 +        self compilerWarnMessageHolder value:('Warning:
   1.383 +
   1.384 +',warnMsg1,sep,warnMsg2).
   1.385 +        self compilerWarnMessageVisibleHolder value:true.
   1.386 +    ] ifFalse:[
   1.387 +        self compilerWarnMessageVisibleHolder value:false
   1.388 +    ].
   1.389 +!
   1.390 +
   1.391  enterContentsSpecification
   1.392      |toAdd|
   1.393  
   1.394 @@ -2078,6 +2281,20 @@
   1.395      makeOutputHolder value:(makeOutputWindow contents)
   1.396  !
   1.397  
   1.398 +rememberProjectAttributes
   1.399 +    self assert:selectedProjectDefinition notNil.
   1.400 +    Class withoutUpdatingChangesDo:[
   1.401 +        self productNameHolder value ~= selectedProjectDefinition productName ifTrue:[
   1.402 +            selectedProjectDefinition class compile:(selectedProjectDefinition 
   1.403 +                        productName_codeFor:(self productNameHolder value)).
   1.404 +        ].
   1.405 +        self companyNameHolder value ~= selectedProjectDefinition companyName ifTrue:[
   1.406 +            selectedProjectDefinition class compile:(selectedProjectDefinition 
   1.407 +                        companyName_codeFor:(self companyNameHolder value)).
   1.408 +        ]
   1.409 +    ].
   1.410 +!
   1.411 +
   1.412  restoreMakeOutputsContents
   1.413      makeOutputWindow contents:makeOutputHolder value
   1.414  !
   1.415 @@ -2260,6 +2477,12 @@
   1.416  
   1.417      self listOfStartupClassesInProject value:startupClasses.
   1.418      self selectedStartupClassIndexHolder value:startupClassIndex.
   1.419 +!
   1.420 +
   1.421 +updateProjectAttributes
   1.422 +    self assert:selectedProjectDefinition notNil.
   1.423 +    self productNameHolder value:(selectedProjectDefinition productName).
   1.424 +    self companyNameHolder value:(selectedProjectDefinition companyName).
   1.425  ! !
   1.426  
   1.427  !ProjectBuilderAssistantApplication class methodsFor:'documentation'!