Tools__ProjectBuilderAssistantApplication.st
changeset 2659 bec4c94bc628
parent 2656 491471c26771
child 2668 a762eafe51eb
equal deleted inserted replaced
2658:c284507a1279 2659:bec4c94bc628
     1 "{ Package: 'stx:libtool2' }"
     1 "{ Package: 'stx:libtool2' }"
     2 
     2 
     3 "{ NameSpace: Tools }"
     3 "{ NameSpace: Tools }"
     4 
     4 
     5 AssistantApplication subclass:#ProjectBuilderAssistantApplication
     5 AssistantApplication subclass:#ProjectBuilderAssistantApplication
     6 	instanceVariableNames:'packageToBuildHolder projectType selectedProjectIndexHolder
     6 	instanceVariableNames:'packageToBuildHolder projectType projectTypeHolder
     7 		selectedProjectDefinition listOfMatchingProjects
     7 		selectedProjectIndexHolder selectedProjectDefinition
     8 		selectedProjectsComment newProjectsName hideSTXProjects
     8 		listOfMatchingProjects selectedProjectsComment
       
     9 		hasProjectSelectedHolder newProjectsName hideSTXProjects
     9 		startMakeButtonEnabled stopMakeButtonVisible makeOutputHolder
    10 		startMakeButtonEnabled stopMakeButtonVisible makeOutputHolder
    10 		newApplicationsName listOfApplicationsInProject
    11 		newApplicationsName listOfApplicationsInProject
    11 		selectedApplicationIndexHolder selectedApplication
    12 		selectedApplicationIndexHolder selectedApplication
    12 		listOfStartupClassesInProject selectedStartupClassIndexHolder
    13 		hasApplicationSelectedHolder listOfStartupClassesInProject
    13 		selectedStartupClass selectedApplicationsComment
    14 		selectedStartupClassIndexHolder selectedStartupClass
       
    15 		hasStartupClassSelectedHolder selectedApplicationsComment
    14 		buildDirectoryHolder makeProcess listOfClassesInProject
    16 		buildDirectoryHolder makeProcess listOfClassesInProject
    15 		makeOutputWindow projectBuilder'
    17 		makeOutputWindow projectBuilder newStartupClassName'
    16 	classVariableNames:''
    18 	classVariableNames:''
    17 	poolDictionaries:''
    19 	poolDictionaries:''
    18 	category:'System-Support-Projects'
    20 	category:'System-Support-Projects'
    19 !
    21 !
    20 
    22 
    73                         )
    75                         )
    74                        (RadioButtonSpec
    76                        (RadioButtonSpec
    75                           label: 'GUI Application'
    77                           label: 'GUI Application'
    76                           name: 'RadioButton1'
    78                           name: 'RadioButton1'
    77                           translateLabel: true
    79                           translateLabel: true
    78                           model: projectType
    80                           model: projectTypeHolder
    79                           isTriggerOnDown: true
    81                           isTriggerOnDown: true
    80                           onCallBackSelector: projectTypeChanged
    82                           onCallBackSelector: projectTypeChanged
    81                           select: guiApplicationType
    83                           select: guiApplicationType
    82                           extent: (Point 136 22)
    84                           extent: (Point 136 22)
    83                         )
    85                         )
    84                        (RadioButtonSpec
    86                        (RadioButtonSpec
    85                           label: 'Non-GUI Application'
    87                           label: 'Non-GUI Application'
    86                           name: 'RadioButton2'
    88                           name: 'RadioButton2'
    87                           translateLabel: true
    89                           translateLabel: true
    88                           model: projectType
    90                           model: projectTypeHolder
    89                           isTriggerOnDown: true
    91                           isTriggerOnDown: true
    90                           onCallBackSelector: projectTypeChanged
    92                           onCallBackSelector: projectTypeChanged
    91                           select: nonGuiApplicationType
    93                           select: nonGuiApplicationType
    92                           extent: (Point 136 22)
    94                           extent: (Point 136 22)
    93                         )
    95                         )
    94                        (RadioButtonSpec
    96                        (RadioButtonSpec
    95                           label: 'Class Library'
    97                           label: 'Class Library'
    96                           name: 'RadioButton3'
    98                           name: 'RadioButton3'
    97                           translateLabel: true
    99                           translateLabel: true
    98                           model: projectType
   100                           model: projectTypeHolder
    99                           isTriggerOnDown: true
   101                           isTriggerOnDown: true
   100                           onCallBackSelector: projectTypeChanged
   102                           onCallBackSelector: projectTypeChanged
   101                           select: libraryType
   103                           select: libraryType
   102                           extent: (Point 136 22)
   104                           extent: (Point 136 22)
   103                         )
   105                         )
   146                     handles: (Any 0.34560327198364 1.0)
   148                     handles: (Any 0.34560327198364 1.0)
   147                   )
   149                   )
   148                  (CheckBoxSpec
   150                  (CheckBoxSpec
   149                     label: 'Hide ST/X Base Packages'
   151                     label: 'Hide ST/X Base Packages'
   150                     name: 'CheckBox1'
   152                     name: 'CheckBox1'
   151                     layout: (LayoutFrame -1 0 -18 1 275 0 4 1)
   153                     layout: (LayoutFrame -1 0 -18 1 0 1 4 1)
   152                     model: hideSTXProjects
   154                     model: hideSTXProjects
   153                     translateLabel: true
   155                     translateLabel: true
   154                   )
   156                   )
   155                  )
   157                  )
   156                
   158                
   198               component: 
   200               component: 
   199              (SpecCollection
   201              (SpecCollection
   200                 collection: (
   202                 collection: (
   201                  (InputFieldSpec
   203                  (InputFieldSpec
   202                     name: 'EntryField1'
   204                     name: 'EntryField1'
   203                     layout: (LayoutFrame 1 0 6 0 210 0 28 0)
   205                     layout: (LayoutFrame 1 0 6 0 -113 1 28 0)
   204                     model: newProjectsName
   206                     model: newProjectsName
   205                     acceptOnReturn: true
   207                     acceptOnReturn: true
   206                     acceptOnTab: true
   208                     acceptOnTab: true
   207                     acceptOnPointerLeave: true
   209                     acceptOnPointerLeave: true
   208                     emptyFieldReplacementText: 'module:directory'
   210                     emptyFieldReplacementText: 'module:directory'
   209                   )
   211                   )
   210                  (ActionButtonSpec
   212                  (ActionButtonSpec
   211                     label: 'Create'
   213                     label: 'Create'
   212                     name: 'Button1'
   214                     name: 'Button1'
   213                     layout: (LayoutFrame 216 0 6 0 341 0 28 0)
   215                     layout: (LayoutFrame -100 1 6 0 2 1 28 0)
   214                     translateLabel: true
   216                     translateLabel: true
   215                     model: createNewProject
   217                     model: createNewProject
   216                   )
   218                   )
   217                  )
   219                  )
   218                
   220                
   256                     handles: (Any 0.34560327198364 1.0)
   258                     handles: (Any 0.34560327198364 1.0)
   257                   )
   259                   )
   258                  (CheckBoxSpec
   260                  (CheckBoxSpec
   259                     label: 'Hide ST/X Base Packages'
   261                     label: 'Hide ST/X Base Packages'
   260                     name: 'CheckBox1'
   262                     name: 'CheckBox1'
   261                     layout: (LayoutFrame -1 0 -17 1 275 0 5 1)
   263                     layout: (LayoutFrame -1 0 -17 1 0 1 5 1)
   262                     model: hideSTXProjects
   264                     model: hideSTXProjects
   263                     translateLabel: true
   265                     translateLabel: true
   264                   )
   266                   )
   265                  )
   267                  )
   266                
   268                
   279                  (ActionButtonSpec
   281                  (ActionButtonSpec
   280                     label: 'Browse Selected Project'
   282                     label: 'Browse Selected Project'
   281                     name: 'Button3'
   283                     name: 'Button3'
   282                     translateLabel: true
   284                     translateLabel: true
   283                     model: doBrowseProject
   285                     model: doBrowseProject
       
   286                     enableChannel: hasProjectSelectedHolder
   284                     extent: (Point 180 22)
   287                     extent: (Point 180 22)
   285                   )
   288                   )
   286                  )
   289                  )
   287                
   290                
   288               )
   291               )
   329               component: 
   332               component: 
   330              (SpecCollection
   333              (SpecCollection
   331                 collection: (
   334                 collection: (
   332                  (InputFieldSpec
   335                  (InputFieldSpec
   333                     name: 'EntryField1'
   336                     name: 'EntryField1'
   334                     layout: (LayoutFrame 1 0 6 0 210 0 28 0)
   337                     layout: (LayoutFrame 1 0 6 0 -113 1 28 0)
   335                     model: newApplicationsName
   338                     model: newApplicationsName
   336                     acceptOnReturn: true
   339                     acceptOnReturn: true
   337                     acceptOnTab: true
   340                     acceptOnTab: true
   338                     acceptOnPointerLeave: true
   341                     acceptOnPointerLeave: true
   339                     emptyFieldReplacementText: 'MyApplication'
   342                     emptyFieldReplacementText: 'MyApplication'
   340                   )
   343                   )
   341                  (ActionButtonSpec
   344                  (ActionButtonSpec
   342                     label: 'Create'
   345                     label: 'Create'
   343                     name: 'Button1'
   346                     name: 'Button1'
   344                     layout: (LayoutFrame 216 0 6 0 341 0 28 0)
   347                     layout: (LayoutFrame -100 1 6 0 1 1 28 0)
   345                     translateLabel: true
   348                     translateLabel: true
   346                     model: createNewApplication
   349                     model: createNewApplication
   347                   )
   350                   )
   348                  )
   351                  )
   349                
   352                
   403                  (ActionButtonSpec
   406                  (ActionButtonSpec
   404                     label: 'Browse Selected Application'
   407                     label: 'Browse Selected Application'
   405                     name: 'Button3'
   408                     name: 'Button3'
   406                     translateLabel: true
   409                     translateLabel: true
   407                     model: doBrowseApplication
   410                     model: doBrowseApplication
       
   411                     enableChannel: hasApplicationSelectedHolder
       
   412                     extent: (Point 180 22)
       
   413                   )
       
   414                  (ActionButtonSpec
       
   415                     label: 'Launch Selected Application'
       
   416                     name: 'Button4'
       
   417                     translateLabel: true
       
   418                     model: doLaunchApplication
       
   419                     enableChannel: hasApplicationSelectedHolder
   408                     extent: (Point 180 22)
   420                     extent: (Point 180 22)
   409                   )
   421                   )
   410                  )
   422                  )
   411                
   423                
   412               )
   424               )
   453               component: 
   465               component: 
   454              (SpecCollection
   466              (SpecCollection
   455                 collection: (
   467                 collection: (
   456                  (InputFieldSpec
   468                  (InputFieldSpec
   457                     name: 'EntryField1'
   469                     name: 'EntryField1'
   458                     layout: (LayoutFrame 1 0 6 0 210 0 28 0)
   470                     layout: (LayoutFrame 1 0 6 0 -113 1 28 0)
   459                     model: newStartupClassName
   471                     model: newStartupClassName
   460                     acceptOnReturn: true
   472                     acceptOnReturn: true
   461                     acceptOnTab: true
   473                     acceptOnTab: true
   462                     acceptOnPointerLeave: true
   474                     acceptOnPointerLeave: true
   463                     emptyFieldReplacementText: 'MyStandAloneStartup'
   475                     emptyFieldReplacementText: 'MyStandAloneStartup'
   464                   )
   476                   )
   465                  (ActionButtonSpec
   477                  (ActionButtonSpec
   466                     label: 'Create'
   478                     label: 'Create'
   467                     name: 'Button1'
   479                     name: 'Button1'
   468                     layout: (LayoutFrame 216 0 6 0 341 0 28 0)
   480                     layout: (LayoutFrame -100 1 6 0 1 1 28 0)
   469                     translateLabel: true
   481                     translateLabel: true
   470                     model: createNewStartupClass
   482                     model: createNewStartupClass
   471                   )
   483                   )
   472                  )
   484                  )
   473                
   485                
   527                  (ActionButtonSpec
   539                  (ActionButtonSpec
   528                     label: 'Browse Selected StartupClass'
   540                     label: 'Browse Selected StartupClass'
   529                     name: 'Button3'
   541                     name: 'Button3'
   530                     translateLabel: true
   542                     translateLabel: true
   531                     model: doBrowseStartupClass
   543                     model: doBrowseStartupClass
       
   544                     enableChannel: hasStartupClassSelectedHolder
   532                     extent: (Point 180 22)
   545                     extent: (Point 180 22)
   533                   )
   546                   )
   534                  )
   547                  )
   535                
   548                
   536               )
   549               )
   602                 collection: (
   615                 collection: (
   603                  (ActionButtonSpec
   616                  (ActionButtonSpec
   604                     label: 'Browse Project Definition'
   617                     label: 'Browse Project Definition'
   605                     name: 'Button3'
   618                     name: 'Button3'
   606                     translateLabel: true
   619                     translateLabel: true
   607                     model: doBrowseProject
   620                     model: doBrowseProjectDefinitionClass
   608                     extent: (Point 180 22)
   621                     extent: (Point 180 22)
   609                   )
   622                   )
   610                  (ActionButtonSpec
   623                  (ActionButtonSpec
   611                     label: 'Update Contents (Scan)'
   624                     label: 'Update Contents (Scan)'
   612                     name: 'Button4'
   625                     name: 'Button4'
   855     newAppName isEmptyOrNil ifTrue:[
   868     newAppName isEmptyOrNil ifTrue:[
   856         Dialog warn:'Please enter the name of the Application-Class first.'.
   869         Dialog warn:'Please enter the name of the Application-Class first.'.
   857         ^ self
   870         ^ self
   858     ].
   871     ].
   859 
   872 
   860     Class packageQuerySignal answer:(selectedProjectDefinition package)
   873     self withWaitCursorDo:[
   861     do:[
   874         Class packageQuerySignal answer:(selectedProjectDefinition package)
   862         newAppClass := ApplicationModel
   875         do:[
   863                         subclass:newAppName asSymbol
   876             newAppClass := ApplicationModel
   864                         instanceVariableNames:''
   877                             subclass:newAppName asSymbol
   865                         classVariableNames:''
   878                             instanceVariableNames:''
   866                         poolDictionaries:''
   879                             classVariableNames:''
   867                         category:'Applications'.
   880                             poolDictionaries:''
   868         CodeGeneratorTool createApplicationCodeFor:newAppClass.
   881                             category:'Applications'.
   869     ].
   882             CodeGeneratorTool createApplicationCodeFor:newAppClass.
   870     self updateListOfApplicationsInProject
   883         ].
       
   884         self updateListOfApplicationsInProject
       
   885     ].
   871 !
   886 !
   872 
   887 
   873 createNewProject
   888 createNewProject
   874     <resource: #uiCallback>
   889     <resource: #uiCallback>
   875 
   890 
   878     newProjectID := self newProjectsName value.
   893     newProjectID := self newProjectsName value.
   879     newProjectID isEmptyOrNil ifTrue:[
   894     newProjectID isEmptyOrNil ifTrue:[
   880         Dialog warn:'Please enter a packageID first.'.
   895         Dialog warn:'Please enter a packageID first.'.
   881         ^ self
   896         ^ self
   882     ].
   897     ].
   883 
   898     newProjectID asPackageId isModuleId ifTrue:[
   884     projectDefinitionType := ProjectDefinition perform:(self projectType value).
   899         Dialog warn:'Please enter a corrent packageID (module:directory).'.
       
   900         ^ self
       
   901     ].
       
   902 
       
   903     projectDefinitionType := ProjectDefinition perform:(self projectTypeHolder value).
   885 
   904 
   886 
   905 
   887     projectDefinitionClass := ProjectDefinition
   906     projectDefinitionClass := ProjectDefinition
   888                                 definitionClassForPackage:newProjectID
   907                                 definitionClassForPackage:newProjectID
   889                                 projectType: projectDefinitionType
   908                                 projectType: projectDefinitionType
   895     self selectedProjectIndexHolder value:( self listOfMatchingProjects value indexOf:projectDefinitionClass).
   914     self selectedProjectIndexHolder value:( self listOfMatchingProjects value indexOf:projectDefinitionClass).
   896 
   915 
   897     projectClasses := projectDefinitionClass allClassNames 
   916     projectClasses := projectDefinitionClass allClassNames 
   898                             collect:[:nm |Smalltalk classNamed:nm].
   917                             collect:[:nm |Smalltalk classNamed:nm].
   899 
   918 
   900     projectDefinitionClass isGUIApplication ifTrue:[
   919 "/    projectDefinitionClass isGUIApplication ifTrue:[
   901         "/ see if it has an AppModel class
   920 "/        "/ see if it has an AppModel class
   902         (projectClasses contains:[:cls | cls isVisualStartable]) ifFalse:[
   921 "/        (projectClasses contains:[:cls | cls isVisualStartable]) ifFalse:[
   903             (Dialog confirm:'Create an Application Class ?') ifTrue:[
   922 "/            (Dialog confirm:'Create an Application Class ?') ifTrue:[
   904 self halt.
   923 "/                self halt.
   905             ].
   924 "/            ].
   906         ].
   925 "/        ].
   907     ].
   926 "/    ].
   908 
   927 
   909 "/    projectDefinitionClass isLibrary ifFalse:[
   928 "/    projectDefinitionClass isLibrary ifFalse:[
   910 "/        "/ see if it has a Startup class
   929 "/        "/ see if it has a Startup class
   911 "/        (projectClasses contains:[:cls | cls isStartable]) ifFalse:[
   930 "/        (projectClasses contains:[:cls | cls isStartable]) ifFalse:[
   912 "/        ].
   931 "/        ].
   913 "/    ].
   932 "/    ].
   914 !
   933 !
   915 
   934 
       
   935 createNewStartupClass
       
   936     <resource: #uiCallback>
       
   937 
       
   938     |newClassName newStartupClass|
       
   939 
       
   940     newClassName := self newStartupClassName value.
       
   941     newClassName isEmptyOrNil ifTrue:[
       
   942         Dialog warn:'Please enter the name of the Startup-Class first.'.
       
   943         ^ self
       
   944     ].
       
   945 
       
   946     self withWaitCursorDo:[
       
   947         Class packageQuerySignal answer:(selectedProjectDefinition package)
       
   948         do:[
       
   949             newStartupClass := StandaloneStartup
       
   950                             subclass:newClassName asSymbol
       
   951                             instanceVariableNames:''
       
   952                             classVariableNames:''
       
   953                             poolDictionaries:''
       
   954                             category:'Applications'.
       
   955             CodeGeneratorTool createStartupCodeFor:newStartupClass forStartOf:selectedApplication.
       
   956         ].
       
   957         self updateListOfStartupClassesInProject
       
   958     ].
       
   959 !
       
   960 
   916 doAddClassToProject
   961 doAddClassToProject
   917     <resource: #uiCallback>
   962     <resource: #uiCallback>
   918 
   963 
   919     Transcript showCR:self class name, ': action for doAddClassToProject ...'.
   964     Transcript showCR:self class name, ': action for doAddClassToProject ...'.
   920     self halt.
   965     self halt.
   923 doBrowseApplication
   968 doBrowseApplication
   924     <resource: #uiCallback>
   969     <resource: #uiCallback>
   925 
   970 
   926     |appClass|
   971     |appClass|
   927 
   972 
   928     appClass := self listOfApplicationsInProject value at:(self selectedApplicationIndexHolder value).
   973     self hasApplicationSelected ifTrue:[
   929     UserPreferences systemBrowserClass openInClass:appClass.
   974         appClass := self listOfApplicationsInProject value at:(self selectedApplicationIndexHolder value).
       
   975         UserPreferences systemBrowserClass 
       
   976             openInClass:appClass.
       
   977     ].
   930 !
   978 !
   931 
   979 
   932 doBrowseProject
   980 doBrowseProject
   933     <resource: #uiCallback>
   981     <resource: #uiCallback>
   934 
   982 
   935     UserPreferences systemBrowserClass openOnPackage:selectedProjectDefinition package.
   983     UserPreferences systemBrowserClass openOnPackage:selectedProjectDefinition package.
   936 !
   984 !
   937 
   985 
       
   986 doBrowseProjectDefinitionClass
       
   987     <resource: #uiCallback>
       
   988 
       
   989     |defClass|
       
   990 
       
   991     self hasProjectSelected ifTrue:[
       
   992         defClass := self selectedProjectDefinition.
       
   993         UserPreferences systemBrowserClass 
       
   994             openInClass:defClass class selector:#classNamesAndAttributes.
       
   995     ].
       
   996 !
       
   997 
       
   998 doBrowseStartupClass
       
   999     <resource: #uiCallback>
       
  1000 
       
  1001     |startupClass|
       
  1002 
       
  1003     self hasStartupClassSelected ifTrue:[
       
  1004         startupClass := self listOfStartupClassesInProject value at:(self selectedStartupClassIndexHolder value).
       
  1005         UserPreferences systemBrowserClass 
       
  1006             openInClass:startupClass.
       
  1007     ].
       
  1008 !
       
  1009 
   938 doGenerateProjectContentsDefinition
  1010 doGenerateProjectContentsDefinition
   939     self generatePackageContentsMethods
  1011     self generatePackageContentsMethods
       
  1012 !
       
  1013 
       
  1014 doLaunchApplication
       
  1015     <resource: #uiCallback>
       
  1016 
       
  1017     |appClass|
       
  1018 
       
  1019     self hasApplicationSelected ifTrue:[
       
  1020         appClass := self listOfApplicationsInProject value at:(self selectedApplicationIndexHolder value).
       
  1021         appClass open.
       
  1022     ].
   940 !
  1023 !
   941 
  1024 
   942 doOpenExplorer
  1025 doOpenExplorer
   943     OperatingSystem
  1026     OperatingSystem
   944         openApplicationForDocument:(projectBuilder packageBuildDirectory) operation:#explore.
  1027         openApplicationForDocument:(projectBuilder packageBuildDirectory) operation:#explore.
   979         p terminate.
  1062         p terminate.
   980         p waitUntilTerminated.
  1063         p waitUntilTerminated.
   981 
  1064 
   982         makeOutputWindow endEntry.
  1065         makeOutputWindow endEntry.
   983         makeOutputWindow cr.
  1066         makeOutputWindow cr.
   984         makeOutputWindow nextPutLine:('Make Cancelled' emphasizeAllWith:{#backgroundColor->Color red. #color->Color white.}).
  1067         makeOutputWindow nextPutLine:('Make Cancelled' colorizeAllWith:Color white on:Color red).
   985         makeOutputWindow endEntry.
  1068         makeOutputWindow endEntry.
   986     ].
  1069     ].
   987 !
       
   988 
       
   989 generatePackageContentsMethods
       
   990     <resource: #uiCallback>
       
   991 
       
   992     Class packageQuerySignal answer:(selectedProjectDefinition package)
       
   993     do:[
       
   994         selectedProjectDefinition 
       
   995             forEachContentsMethodsCodeToCompileDo:[:code :category |
       
   996                     CodeGeneratorTool
       
   997                         compile:code
       
   998                         forClass:selectedProjectDefinition theMetaclass
       
   999                         inCategory:category.
       
  1000                 ]
       
  1001             ignoreOldDefinition:true
       
  1002     ].
       
  1003     self updateListOfClassesInProject
       
  1004 !
  1070 !
  1005 
  1071 
  1006 projectTypeChanged
  1072 projectTypeChanged
  1007     <resource: #uiCallback>
  1073     <resource: #uiCallback>
  1008 
  1074 
  1017 
  1083 
  1018     ActivityNotification handle:[:ex |
  1084     ActivityNotification handle:[:ex |
  1019         ex messageText notNil ifTrue:[
  1085         ex messageText notNil ifTrue:[
  1020             makeOutputWindow endEntry.
  1086             makeOutputWindow endEntry.
  1021             makeOutputWindow cr.
  1087             makeOutputWindow cr.
  1022             makeOutputWindow nextPutLine:(ex messageText emphasizeAllWith:{#backgroundColor->Color blue. #color->Color white.}).
  1088             makeOutputWindow nextPutLine:(ex messageText colorizeAllWith:Color white on:Color blue).
  1023             makeOutputWindow endEntry.
  1089             makeOutputWindow endEntry.
  1024         ].
  1090         ].
  1025         ex proceed.
  1091         ex proceed.
  1026     ] do:[
  1092     ] do:[
  1027         projectBuilder := ProjectBuilder new.
  1093         projectBuilder := ProjectBuilder new.
  1034     self selectedApplicationIndexHolder value isNil ifTrue:[
  1100     self selectedApplicationIndexHolder value isNil ifTrue:[
  1035         selectedApplication := nil.
  1101         selectedApplication := nil.
  1036     ] ifFalse:[
  1102     ] ifFalse:[
  1037         selectedApplication := self listOfApplicationsInProject value at:(self selectedApplicationIndexHolder value).
  1103         selectedApplication := self listOfApplicationsInProject value at:(self selectedApplicationIndexHolder value).
  1038     ].
  1104     ].
       
  1105     self hasApplicationSelectedHolder value:(selectedApplication notNil).
       
  1106 
  1039 "/    selectedApplication notNil ifTrue:[
  1107 "/    selectedApplication notNil ifTrue:[
  1040 "/        "/ generate startupClass code
  1108 "/        "/ generate startupClass code
  1041 "/        CodeGeneratorTool
  1109 "/        CodeGeneratorTool
  1042 "/            compile:(selectedProjectDefinition startupClassName_codeFor:(selectedApplication name))
  1110 "/            compile:(selectedProjectDefinition startupClassName_codeFor:(selectedApplication name))
  1043 "/            forClass:selectedProjectDefinition theMetaclass
  1111 "/            forClass:selectedProjectDefinition theMetaclass
  1051     self selectedProjectIndexHolder value isNil ifTrue:[
  1119     self selectedProjectIndexHolder value isNil ifTrue:[
  1052         selectedProjectDefinition := nil.
  1120         selectedProjectDefinition := nil.
  1053     ] ifFalse:[
  1121     ] ifFalse:[
  1054         selectedProjectDefinition := self listOfMatchingProjects value at:(self selectedProjectIndexHolder value).
  1122         selectedProjectDefinition := self listOfMatchingProjects value at:(self selectedProjectIndexHolder value).
  1055     ].
  1123     ].
       
  1124     self hasProjectSelectedHolder value:(selectedProjectDefinition notNil).
       
  1125 
  1056     self updateComment.
  1126     self updateComment.
  1057     self updateListOfApplicationsInProject.
  1127     self updateListOfApplicationsInProject.
  1058     self updateButtonEnableState.
  1128     self updateButtonEnableState.
  1059 !
  1129 !
  1060 
  1130 
  1062     self selectedStartupClassIndexHolder value isNil ifTrue:[
  1132     self selectedStartupClassIndexHolder value isNil ifTrue:[
  1063         selectedStartupClass := nil.
  1133         selectedStartupClass := nil.
  1064     ] ifFalse:[
  1134     ] ifFalse:[
  1065         selectedStartupClass := self listOfStartupClassesInProject value at:(self selectedStartupClassIndexHolder value).
  1135         selectedStartupClass := self listOfStartupClassesInProject value at:(self selectedStartupClassIndexHolder value).
  1066     ].
  1136     ].
       
  1137     self hasStartupClassSelectedHolder value:(selectedStartupClass notNil).
       
  1138 
  1067     selectedStartupClass notNil ifTrue:[
  1139     selectedStartupClass notNil ifTrue:[
  1068         "/ generate startupClass code
  1140         "/ generate startupClass code
  1069         CodeGeneratorTool
  1141         CodeGeneratorTool
  1070             compile:(selectedProjectDefinition startupClassName_codeFor:(selectedStartupClass name))
  1142             compile:(selectedProjectDefinition startupClassName_codeFor:(selectedStartupClass name))
  1071             forClass:selectedProjectDefinition theMetaclass
  1143             forClass:selectedProjectDefinition theMetaclass
  1107     browser onDirectory:targetDirectory.
  1179     browser onDirectory:targetDirectory.
  1108     browser filter:'*setup*'.
  1180     browser filter:'*setup*'.
  1109     ^ browser.
  1181     ^ browser.
  1110 !
  1182 !
  1111 
  1183 
  1112 hasBuildDirectorySpecified
  1184 hasApplicationSelectedHolder
  1113     ^ self buildDirectoryHolder value notEmptyOrNil
  1185     <resource: #uiAspect>
  1114 !
  1186 
  1115 
  1187     hasApplicationSelectedHolder isNil ifTrue:[
  1116 hasProjectBuilder
  1188         hasApplicationSelectedHolder := nil asValue.
  1117     ^ projectBuilder notNil
  1189     ].
  1118 !
  1190     ^ hasApplicationSelectedHolder.
  1119 
  1191 !
  1120 hasProjectSelected
  1192 
  1121     ^ self selectedProjectIndexHolder value notNil
  1193 hasProjectSelectedHolder
       
  1194     <resource: #uiAspect>
       
  1195 
       
  1196     hasProjectSelectedHolder isNil ifTrue:[
       
  1197         hasProjectSelectedHolder := nil asValue.
       
  1198     ].
       
  1199     ^ hasProjectSelectedHolder.
       
  1200 !
       
  1201 
       
  1202 hasStartupClassSelectedHolder
       
  1203     <resource: #uiAspect>
       
  1204 
       
  1205     hasStartupClassSelectedHolder isNil ifTrue:[
       
  1206         hasStartupClassSelectedHolder := nil asValue.
       
  1207     ].
       
  1208     ^ hasStartupClassSelectedHolder.
  1122 !
  1209 !
  1123 
  1210 
  1124 hideSTXProjects
  1211 hideSTXProjects
  1125     <resource: #uiAspect>
  1212     <resource: #uiAspect>
  1126 
  1213 
  1202         newProjectsName := nil asValue.
  1289         newProjectsName := nil asValue.
  1203     ].
  1290     ].
  1204     ^ newProjectsName.
  1291     ^ newProjectsName.
  1205 !
  1292 !
  1206 
  1293 
       
  1294 newStartupClassName
       
  1295     <resource: #uiAspect>
       
  1296 
       
  1297     newStartupClassName isNil ifTrue:[
       
  1298         newStartupClassName := ValueHolder new.
       
  1299     ].
       
  1300     ^ newStartupClassName.
       
  1301 !
       
  1302 
  1207 projectType
  1303 projectType
  1208     <resource: #uiAspect>
  1304     self projectTypeHolder value == #libraryType ifTrue:[
  1209 
  1305         ^ ProjectDefinition libraryType
  1210     projectType isNil ifTrue:[
  1306     ].
  1211         projectType := RadioButtonGroup new.
  1307     self projectTypeHolder value == #guiApplicationType ifTrue:[
  1212         projectType value:#guiApplicationType.
  1308         ^ ProjectDefinition guiApplicationType
  1213     ].
  1309     ].
  1214     ^ projectType.
  1310     self projectTypeHolder value == #nonGuiApplicationType ifTrue:[
       
  1311         ^ ProjectDefinition nonGuiApplicationType
       
  1312     ].
       
  1313     self error.
       
  1314 !
       
  1315 
       
  1316 projectType:aProjectTypeSymbol
       
  1317     |pType|
       
  1318 
       
  1319     self assert:(ProjectDefinition projectTypes includes:aProjectTypeSymbol).
       
  1320     aProjectTypeSymbol == ProjectDefinition libraryType ifTrue:[
       
  1321         pType := #libraryType
       
  1322     ] ifFalse:[
       
  1323         aProjectTypeSymbol == ProjectDefinition guiApplicationType ifTrue:[
       
  1324             pType := #guiApplicationType
       
  1325         ] ifFalse:[
       
  1326             aProjectTypeSymbol == ProjectDefinition nonGuiApplicationType ifTrue:[
       
  1327                 pType := #nonGuiApplicationType
       
  1328             ] ifFalse:[
       
  1329                 self error.
       
  1330             ].
       
  1331         ]
       
  1332     ].
       
  1333     self projectTypeHolder value:aProjectTypeSymbol
       
  1334 !
       
  1335 
       
  1336 projectTypeHolder
       
  1337     <resource: #uiAspect>
       
  1338 
       
  1339     projectTypeHolder isNil ifTrue:[
       
  1340         projectTypeHolder := RadioButtonGroup new.
       
  1341         projectTypeHolder value:#guiApplicationType.
       
  1342     ].
       
  1343     ^ projectTypeHolder.
  1215 !
  1344 !
  1216 
  1345 
  1217 projectTypeIsNotLibrary
  1346 projectTypeIsNotLibrary
  1218     ^ self projectType value ~~ #libraryType
  1347     ^ self projectTypeHolder value ~~ #libraryType
  1219 !
  1348 !
  1220 
  1349 
  1221 selectedApplicationIndexHolder
  1350 selectedApplicationIndexHolder
  1222     <resource: #uiAspect>
  1351     <resource: #uiAspect>
  1223 
  1352 
  1314 !
  1443 !
  1315 
  1444 
  1316 release
  1445 release
  1317     Smalltalk removeDependent:self.
  1446     Smalltalk removeDependent:self.
  1318     super release
  1447     super release
       
  1448 ! !
       
  1449 
       
  1450 !ProjectBuilderAssistantApplication methodsFor:'menu actions'!
       
  1451 
       
  1452 openDocumentation
       
  1453    self openHTMLDocument:'tools/misc/TOP.html#PACKAGER'.
  1319 ! !
  1454 ! !
  1320 
  1455 
  1321 !ProjectBuilderAssistantApplication methodsFor:'private'!
  1456 !ProjectBuilderAssistantApplication methodsFor:'private'!
  1322 
  1457 
  1323 commentFromClass:aClass
  1458 commentFromClass:aClass
  1338             comment := comment collect:[:line | line copyFrom:minIndent].
  1473             comment := comment collect:[:line | line copyFrom:minIndent].
  1339         ].
  1474         ].
  1340         comment := comment asString.
  1475         comment := comment asString.
  1341     ].
  1476     ].
  1342     ^ comment
  1477     ^ comment
       
  1478 !
       
  1479 
       
  1480 generatePackageContentsMethods
       
  1481     <resource: #uiCallback>
       
  1482 
       
  1483     Class packageQuerySignal answer:(selectedProjectDefinition package)
       
  1484     do:[
       
  1485         selectedProjectDefinition 
       
  1486             forEachContentsMethodsCodeToCompileDo:[:code :category |
       
  1487                     CodeGeneratorTool
       
  1488                         compile:code
       
  1489                         forClass:selectedProjectDefinition theMetaclass
       
  1490                         inCategory:category.
       
  1491                 ]
       
  1492             ignoreOldDefinition:true
       
  1493     ].
       
  1494     self updateListOfClassesInProject
       
  1495 !
       
  1496 
       
  1497 hasApplicationSelected
       
  1498     ^ self selectedApplicationIndexHolder value notNil
       
  1499 !
       
  1500 
       
  1501 hasBuildDirectorySpecified
       
  1502     ^ self buildDirectoryHolder value notEmptyOrNil
       
  1503 !
       
  1504 
       
  1505 hasProjectBuilder
       
  1506     ^ projectBuilder notNil
       
  1507 !
       
  1508 
       
  1509 hasProjectSelected
       
  1510     ^ self selectedProjectIndexHolder value notNil
       
  1511 !
       
  1512 
       
  1513 hasStartupClassSelected
       
  1514     ^ self selectedStartupClassIndexHolder value notNil
  1343 ! !
  1515 ! !
  1344 
  1516 
  1345 !ProjectBuilderAssistantApplication methodsFor:'queries'!
  1517 !ProjectBuilderAssistantApplication methodsFor:'queries'!
  1346 
  1518 
  1347 canEnterApplicationSelection
  1519 canEnterApplicationSelection
  1350 
  1522 
  1351 canEnterBuild
  1523 canEnterBuild
  1352     ^ self hasBuildDirectorySpecified
  1524     ^ self hasBuildDirectorySpecified
  1353 !
  1525 !
  1354 
  1526 
       
  1527 canEnterContentsSelection
       
  1528     ^ self hasProjectSelected 
       
  1529     and:[ self hasApplicationSelected 
       
  1530     and:[ self hasStartupClassSelected ]]
       
  1531 !
       
  1532 
  1355 canEnterDeploy
  1533 canEnterDeploy
  1356     ^ self hasProjectBuilder
  1534     ^ self hasProjectBuilder
  1357 !
  1535 !
  1358 
  1536 
  1359 canEnterStartupClassSelection
  1537 canEnterStartupClassSelection
  1360     ^ self hasProjectSelected
  1538     ^ self hasProjectSelected and:[ self hasApplicationSelected ]
  1361 ! !
  1539 ! !
  1362 
  1540 
  1363 !ProjectBuilderAssistantApplication methodsFor:'specs'!
  1541 !ProjectBuilderAssistantApplication methodsFor:'specs'!
  1364 
  1542 
  1365 assistantSpec
  1543 assistantSpec
  1366     ^ #(Array
  1544     ^ #(Array
  1367         ( AssistantPageSpec
  1545         ( AssistantPageSpec
  1368             pageTitle: 'Project Type Selection'
  1546             pageTitle: 'Project Type Selection'
  1369             windowSpecSelector: page1_projectTypeSelectionSpec
  1547             windowSpecSelector: page1_projectTypeSelectionSpec
  1370             enterCallbackSelector: updateListOfMatchingProjects
  1548             enterCallbackSelector: updateListOfMatchingProjects
       
  1549             infoText: 'Choose the type of project you are about to build.'
  1371         )
  1550         )
  1372 
  1551 
  1373         (AssistantPageSpec
  1552         (AssistantPageSpec
  1374             pageTitle: 'Project Selection'
  1553             pageTitle: 'Project Selection'
  1375             windowSpecSelector: page2_projectSelectionSpec
  1554             windowSpecSelector: page2_projectSelectionSpec
  1376             enterCallbackSelector: updateListOfMatchingProjects
  1555             enterCallbackSelector: updateListOfMatchingProjects
       
  1556             infoText: 'Choose an existing project or create a new one.
       
  1557                        These are subclasses of <I>ProjectDefinition</I> and define the
       
  1558                        type and contents of a project.'
  1377         )
  1559         )
  1378 
  1560 
  1379         (AssistantPageSpec
  1561         (AssistantPageSpec
  1380             pageTitle: 'Application Selection'
  1562             pageTitle: 'Application Selection'
  1381             windowSpecSelector: page3_applicationSelectionSpec
  1563             windowSpecSelector: page3_applicationSelectionSpec
  1382             isEnabledQuerySelector: #projectTypeIsNotLibrary
  1564             isEnabledQuerySelector: #projectTypeIsNotLibrary
  1383             canEnterQuerySelector: #canEnterApplicationSelection
  1565             canEnterQuerySelector: #canEnterApplicationSelection
  1384             enterCallbackSelector: updateListOfApplicationsInProject
  1566             enterCallbackSelector: updateListOfApplicationsInProject
       
  1567             infoText: 'Choose an existing application or create a new one.
       
  1568                        These are subclasses of <I>ApplicationModel</I> and define
       
  1569                        the GUI and control flow inside the application.'
  1385         )
  1570         )
  1386 
  1571 
  1387         (AssistantPageSpec
  1572         (AssistantPageSpec
  1388             pageTitle: 'Startup Class Selection'
  1573             pageTitle: 'Startup Class Selection'
  1389             windowSpecSelector: page4_startupClassSelectionSpec
  1574             windowSpecSelector: page4_startupClassSelectionSpec
  1390             isEnabledQuerySelector: #projectTypeIsNotLibrary
  1575             isEnabledQuerySelector: #projectTypeIsNotLibrary
  1391             canEnterQuerySelector: #canEnterStartupClassSelection
  1576             canEnterQuerySelector: #canEnterStartupClassSelection
  1392             enterCallbackSelector: updateListOfStartupClassesInProject
  1577             enterCallbackSelector: updateListOfStartupClassesInProject
       
  1578             infoText: 'Choose an existing startup-class or create a new one.
       
  1579                        These are subclasses of <I>StandaloneStartup</I> and 
       
  1580                        start the application. Command line arguments can be
       
  1581                        interpreted there.'
  1393         )
  1582         )
  1394 
  1583 
  1395         (AssistantPageSpec
  1584         (AssistantPageSpec
  1396             pageTitle: 'Specify Contents'
  1585             pageTitle: 'Specify Contents'
  1397             windowSpecSelector: page5_specifyIncludedClasses
  1586             windowSpecSelector: page5_specifyIncludedClasses
  1398             enterCallbackSelector: updateListOfClassesInProject
  1587             enterCallbackSelector: updateListOfClassesInProject
       
  1588             canEnterQuerySelector: #canEnterContentsSelection
       
  1589             infoText: 'Define which (other) classes are to be included.
       
  1590                        Press "<I>Scan</I>" to include all classes of the package;
       
  1591                        browse to edit the contents manually.'
  1399         )
  1592         )
  1400 
  1593 
  1401         (AssistantPageSpec
  1594         (AssistantPageSpec
  1402             pageTitle: 'Specify Build Directory'
  1595             pageTitle: 'Specify Build Directory'
  1403             windowSpecSelector: page6_specifyBuildDirectorySpec
  1596             windowSpecSelector: page6_specifyBuildDirectorySpec
       
  1597             infoText: 'Define where the build-process is to be performed.
       
  1598                        All generated files are created below that directory.
       
  1599                        After deployment, the build directory is no longer needed
       
  1600                        (but you can keep it for a faster compile the next time).'
  1404         )
  1601         )
  1405 
  1602 
  1406         (AssistantPageSpec
  1603         (AssistantPageSpec
  1407             pageTitle: 'Build'
  1604             pageTitle: 'Build'
  1408             windowSpecSelector: page7_buildSpec
  1605             windowSpecSelector: page7_buildSpec
  1409             canEnterQuerySelector: #canEnterBuild
  1606             canEnterQuerySelector: #canEnterBuild
  1410             enterCallbackSelector: #restoreMakeOutputsContents
  1607             enterCallbackSelector: #restoreMakeOutputsContents
  1411             leaveCallbackSelector: #rememberMakeOutputsContents
  1608             leaveCallbackSelector: #rememberMakeOutputsContents
       
  1609             infoText: 'Start the build-process. This will run make/bcc to compile
       
  1610                        all required classes and nsis to generate a self-installable
       
  1611                        executable. You must have the borland-cc and NullSoft NSIS
       
  1612                        packages installed for this to work.'
  1412         )
  1613         )
  1413 
  1614 
  1414         (AssistantPageSpec
  1615         (AssistantPageSpec
  1415             pageTitle: 'Deploy'
  1616             pageTitle: 'Deploy'
  1416             windowSpecSelector: page8_deploySpec
  1617             windowSpecSelector: page8_deploySpec
  1417             canEnterQuerySelector: #canEnterDeploy
  1618             canEnterQuerySelector: #canEnterDeploy
       
  1619             infoText: 'Find the installer to be deployed (or test-run the binary).
       
  1620                        You can open a WindowsExplorer there to copy the files for
       
  1621                        deployment. After that, the build directory is no longer needed
       
  1622                        (but you can keep it for a faster compile the next time).'
  1418         )
  1623         )
  1419     ) decodeAsLiteralArray.
  1624     ) decodeAsLiteralArray.
  1420 ! !
  1625 ! !
  1421 
  1626 
  1422 !ProjectBuilderAssistantApplication methodsFor:'update'!
  1627 !ProjectBuilderAssistantApplication methodsFor:'update'!
  1487                                         and:[ cls isSubclassOf:ApplicationModel ])
  1692                                         and:[ cls isSubclassOf:ApplicationModel ])
  1488                                     ].
  1693                                     ].
  1489         applicationClasses := applicationClasses asOrderedCollection.
  1694         applicationClasses := applicationClasses asOrderedCollection.
  1490         applicationClasses sort:[:a :b | a name < b name].
  1695         applicationClasses sort:[:a :b | a name < b name].
  1491 
  1696 
  1492         startUpClassName := selectedProjectDefinition startupClassName.
  1697         startUpClassName := [ selectedProjectDefinition startupClassName ] ifError:[ nil ].
  1493         startUpClassName notNil ifTrue:[
  1698         startUpClassName notNil ifTrue:[
  1494             startUpClass := Smalltalk classNamed:startUpClassName.
  1699             startUpClass := Smalltalk classNamed:startUpClassName.
  1495             startUpClass notNil ifTrue:[
  1700             startUpClass notNil ifTrue:[
  1496                 appClassIndex := applicationClasses indexOf:startUpClass.
  1701                 appClassIndex := applicationClasses indexOf:startUpClass.
  1497                 appClassIndex == 0 ifTrue:[ appClassIndex := nil ].
  1702                 appClassIndex == 0 ifTrue:[ appClassIndex := nil ].
  1508 !
  1713 !
  1509 
  1714 
  1510 updateListOfMatchingProjects
  1715 updateListOfMatchingProjects
  1511     |matching projectType idx|
  1716     |matching projectType idx|
  1512 
  1717 
  1513     projectType := self projectType value.
  1718     projectType := self projectType.
  1514     matching := ProjectDefinition allSubclasses
  1719     matching := ProjectDefinition allSubclasses
  1515                     select:[:defClass |
  1720                     select:[:defClass |
  1516                         |match|
  1721                         |match|
  1517 
  1722 
  1518                         match := false.
  1723                         match := false.
  1519                         defClass isAbstract ifFalse:[
  1724                         defClass isAbstract ifFalse:[
  1520                             (self hideSTXProjects value not
  1725                             (self hideSTXProjects value not
  1521                             or:[ defClass package asPackageId module ~= 'stx' ])
  1726                             or:[ defClass package asPackageId module ~= 'stx' ])
  1522                             ifTrue:[
  1727                             ifTrue:[
  1523                                 projectType == #libraryType ifTrue:[
  1728                                 projectType == ProjectDefinition libraryType ifTrue:[
  1524                                     match := defClass isLibraryDefinition
  1729                                     match := defClass isLibraryDefinition
  1525                                 ] ifFalse:[
  1730                                 ] ifFalse:[
  1526                                     projectType == #guiApplicationType ifTrue:[
  1731                                     projectType == ProjectDefinition guiApplicationType ifTrue:[
  1527                                         match := defClass isGUIApplication
  1732                                         match := defClass isGUIApplication
  1528                                     ] ifFalse:[
  1733                                     ] ifFalse:[
  1529                                         projectType == #nonGuiApplicationType ifTrue:[
  1734                                         projectType == ProjectDefinition nonGuiApplicationType ifTrue:[
  1530                                             match := defClass isConsoleApplication
  1735                                             match := defClass isConsoleApplication
  1531                                         ] ifFalse:[
  1736                                         ] ifFalse:[
  1532                                             self error.
  1737                                             self error.
  1533                                         ].
  1738                                         ].
  1534                                     ].
  1739                                     ].
  1543     idx == 0 ifTrue:[
  1748     idx == 0 ifTrue:[
  1544         self selectedProjectIndexHolder value:nil.
  1749         self selectedProjectIndexHolder value:nil.
  1545     ] ifFalse:[
  1750     ] ifFalse:[
  1546         self selectedProjectIndexHolder value:idx.
  1751         self selectedProjectIndexHolder value:idx.
  1547     ].
  1752     ].
       
  1753 !
       
  1754 
       
  1755 updateListOfStartupClassesInProject
       
  1756     |startupClasses package startUpClassName startUpClass startupClassIndex|
       
  1757 
       
  1758     startupClassIndex := nil.
       
  1759     self selectedStartupClassIndexHolder value:nil.
       
  1760 
       
  1761     selectedProjectDefinition isNil ifTrue:[
       
  1762         startupClasses := #()
       
  1763     ] ifFalse:[
       
  1764         package := selectedProjectDefinition package.
       
  1765 
       
  1766         startupClasses := Smalltalk allClasses
       
  1767                                     select:[:cls |
       
  1768                                         (cls package = package
       
  1769                                         and:[ cls isSubclassOf:StandaloneStartup ])
       
  1770                                     ].
       
  1771         startupClasses := startupClasses asOrderedCollection.
       
  1772         startupClasses sort:[:a :b | a name < b name].
       
  1773 
       
  1774         startUpClassName := [ selectedProjectDefinition startupClassName ] ifError:[ nil ].
       
  1775         startUpClassName notNil ifTrue:[
       
  1776             startUpClass := Smalltalk classNamed:startUpClassName.
       
  1777             startUpClass notNil ifTrue:[
       
  1778                 startupClassIndex := startupClasses indexOf:startUpClass.
       
  1779                 startupClassIndex == 0 ifTrue:[ startupClassIndex := nil ].
       
  1780             ].
       
  1781         ].
       
  1782     ].
       
  1783     self listOfStartupClassesInProject value:startupClasses.
       
  1784 
       
  1785     self selectedStartupClassIndexHolder value:startupClassIndex.
  1548 ! !
  1786 ! !
  1549 
  1787 
  1550 !ProjectBuilderAssistantApplication class methodsFor:'documentation'!
  1788 !ProjectBuilderAssistantApplication class methodsFor:'documentation'!
  1551 
  1789 
  1552 version_CVS
  1790 version_CVS