Tools__ProjectBuilderAssistantApplication.st
changeset 3335 217dad1c84d0
parent 3320 3a3e4ca40b7c
child 3336 108c139b4bbd
equal deleted inserted replaced
3334:d01f4574870a 3335:217dad1c84d0
   202     of the build directory. For deployment, this single file has to be delivered to a customer
   202     of the build directory. For deployment, this single file has to be delivered to a customer
   203     and executed there.
   203     and executed there.
   204 
   204 
   205     Summary: It has NEVER been easier to create a GUI application with Smalltalk.
   205     Summary: It has NEVER been easier to create a GUI application with Smalltalk.
   206 "
   206 "
   207 ! !
       
   208 
       
   209 !ProjectBuilderAssistantApplication class methodsFor:'assistant pages spec'!
       
   210 
       
   211 assistantSpec
       
   212     ^ #(Array
       
   213         ( AssistantPageSpec
       
   214             pageTitle: 'Project Type Selection'
       
   215             windowSpecSelector: page1_projectTypeSelectionSpec
       
   216             enterCallbackSelector: updateListOfMatchingProjects
       
   217             infoText: 'Choose the <B>type</B> of project you are about to build.'
       
   218         )
       
   219 
       
   220         (AssistantPageSpec
       
   221             pageTitle: 'ProjectDefinition Selection'
       
   222             windowSpecSelector: page2_projectSelectionSpec
       
   223             enterCallbackSelector: updateListOfMatchingProjectsAndProjectIDs
       
   224             leaveCallbackSelector: fetchAttributesFromProjectDefinition
       
   225             infoText: 'Choose an existing project definition or create a new one. These are subclasses of <I>ProjectDefinition</I> and define the type and contents of a project. Notice that the ID directly reflects the project''s location within the source code repository (module:directory/subdirectory...). If in doubt, use "&lt;yourname&gt;:demos/xxx_n".'
       
   226         )
       
   227 
       
   228         (AssistantPageSpec
       
   229             pageTitle: 'Startup Application Selection'
       
   230             windowSpecSelector: page3_applicationSelectionSpec
       
   231             isEnabledQuerySelector: #projectTypeIsGuiApplication
       
   232             canEnterQuerySelector: #canEnterApplicationSelection
       
   233             enterCallbackSelector: updateListOfApplicationsInProject
       
   234             infoText: 'Choose an existing application or create a new one. These are subclasses of <I>ApplicationModel</I> and define the GUI and control flow inside the application. Can also be left blank if the startup class does it all (stx build).'
       
   235         )
       
   236 
       
   237         (AssistantPageSpec
       
   238             pageTitle: 'Startup Class Selection'
       
   239             windowSpecSelector: page4_startupClassSelectionSpec
       
   240             isEnabledQuerySelector: #projectTypeIsNotLibrary
       
   241             canEnterQuerySelector: #canEnterStartupClassSelection
       
   242             enterCallbackSelector: updateListOfStartupClassesInProject
       
   243             infoText: 'Choose an existing startup-class or create a new one. These are subclasses of <I>StandaloneStartup</I> and start the application. Command line arguments can be interpreted there.'
       
   244         )
       
   245 
       
   246         (AssistantPageSpec
       
   247             pageTitle: 'Specify Contents'
       
   248             windowSpecSelector: page5_specifyIncludedClasses
       
   249             enterCallbackSelector: enterContentsSpecification
       
   250             canEnterQuerySelector: #canEnterContentsSelection
       
   251             infoText: 'Define which (other) classes are to be included. Do not include classes from other packages here. Press "<I>Scan</I>" to include all classes of the package; "<I>Browse</I>" to edit the contents manually.'
       
   252         )
       
   253 
       
   254         (AssistantPageSpec
       
   255             pageTitle: 'Specify Prerequisites'
       
   256             windowSpecSelector: page5b_specifyPrerequisitePackages
       
   257             enterCallbackSelector: enterPrerequisitesSpecification
       
   258             canEnterQuerySelector: #canEnterPrerequisitesSelection
       
   259             infoText: 'Define which packages are needed as prerequisites. These are required class libraries which should be packaged together with the application. Press "<I>Scan</I>" to search for prerequisites; "<I>Browse</I>" to edit the list manually.'
       
   260         )
       
   261 
       
   262         (AssistantPageSpec
       
   263             pageTitle: 'Specify Project Attributes'
       
   264             windowSpecSelector: page6a_specifyProjectAttributes
       
   265             infoText: 'Define additional attributes. These will be shown during the installation of the deployed package and affect the name of the deployed self installable file.'
       
   266             enterCallbackSelector: updateProjectAttributes
       
   267             leaveCallbackSelector: #rememberProjectAttributes
       
   268         )
       
   269 
       
   270         (AssistantPageSpec
       
   271             pageTitle: 'Specify Build Directory'
       
   272             windowSpecSelector: page6b_specifyBuildDirectorySpec
       
   273             infoText: 'Define where the build-process is to be performed and which compiler to use. All generated files are created below that directory. After deployment, the build directory is no longer needed (but you can keep it for a faster compile the next time).'
       
   274             enterCallbackSelector: #checkCompilerAvailability
       
   275             leaveCallbackSelector: #rememberUsedCompiler
       
   276         )
       
   277 
       
   278         (AssistantPageSpec
       
   279             pageTitle: 'Check Into Source Repository'
       
   280             windowSpecSelector: page7a_checkinSpec
       
   281             enterCallbackSelector: #checkSourceCodeManagerType
       
   282             infoText: 'Check the package''s source and build-support files into the source code repository.'
       
   283         )
       
   284 
       
   285         (AssistantPageSpec
       
   286             pageTitle: 'Build'
       
   287             windowSpecSelector: page7b_buildSpec
       
   288             canEnterQuerySelector: #canEnterBuild
       
   289             enterCallbackSelector: #restoreMakeOutputsContents
       
   290             leaveCallbackSelector: #rememberMakeOutputsContents
       
   291             infoText: 'Start the build-process. This will run "make"+"bcc/vc/gcc" to compile all required classes and "nsis" to generate a self-installable executable (on windows). 
       
   292 You must have the compiler (borland-bcc or visual-c) and NullSoft NSIS packages installed for this to work.
       
   293 Without NSIS, zip the folder where the exe is generated and unzip on a target machine.
       
   294 <P>
       
   295 To try the application, open an explorer/finder on the directory and double click on the executable.
       
   296 Alternatively, open a command window and type the name of the executable there. Sorry, but double-click in the ST/X file browser does not work.'
       
   297         )
       
   298 
       
   299         (AssistantPageSpec
       
   300             pageTitle: 'Deploy'
       
   301             windowSpecSelector: page8_deploySpec
       
   302             canEnterQuerySelector: #canEnterDeploy
       
   303             infoText: 'Find the installer-file to be deployed (or test-run the executable). 
       
   304 You can open a Windows-explorer/finder there to copy the files for deployment. After that, the build directory is no longer needed. However, you can keep it for a faster compile the next time.'
       
   305         )
       
   306     ) decodeAsLiteralArray.
       
   307 
       
   308     "Modified: / 04-09-2012 / 09:49:50 / cg"
       
   309 ! !
   207 ! !
   310 
   208 
   311 !ProjectBuilderAssistantApplication class methodsFor:'defaults'!
   209 !ProjectBuilderAssistantApplication class methodsFor:'defaults'!
   312 
   210 
   313 defaultIcon
   211 defaultIcon
  1813              translateLabel: true
  1711              translateLabel: true
  1814              component: 
  1712              component: 
  1815             (SpecCollection
  1713             (SpecCollection
  1816                collection: (
  1714                collection: (
  1817                 (SubCanvasSpec
  1715                 (SubCanvasSpec
  1818                    name: 'SubCanvas1'
  1716                    name: 'FileBrowserSubCanvas'
  1819                    layout: (LayoutFrame 0 0 0 0 0 1 -30 1)
  1717                    layout: (LayoutFrame 0 0 0 0 0 1 -30 1)
  1820                    hasHorizontalScrollBar: false
  1718                    hasHorizontalScrollBar: false
  1821                    hasVerticalScrollBar: false
  1719                    hasVerticalScrollBar: false
  1822                    clientHolder: fileBrowserInstance
  1720                    clientHolder: fileBrowserInstance
  1823                    createNewApplication: true
  1721                    createNewApplication: true
  2841     ].
  2739     ].
  2842     ^ browser.
  2740     ^ browser.
  2843 !
  2741 !
  2844 
  2742 
  2845 openOn:aProjectDefinitionClass
  2743 openOn:aProjectDefinitionClass
  2846     |type apps startupClass pageToGo|
  2744     |type "apps" startupClass pageToGo|
  2847 
  2745 
  2848     self allButOpen.
  2746     self allButOpen.
  2849     aProjectDefinitionClass isLibraryDefinition ifTrue:[
  2747     aProjectDefinitionClass isLibraryDefinition ifTrue:[
  2850         type := ProjectDefinition libraryType
  2748         type := ProjectDefinition libraryType
  2851     ] ifFalse:[
  2749     ] ifFalse:[
  2860     selectedProjectDefinition := aProjectDefinitionClass.
  2758     selectedProjectDefinition := aProjectDefinitionClass.
  2861     self selectedProjectIndexHolder value:(self listOfMatchingPackageIds value indexOf:aProjectDefinitionClass package).
  2759     self selectedProjectIndexHolder value:(self listOfMatchingPackageIds value indexOf:aProjectDefinitionClass package).
  2862     self hasProjectSelectedHolder value:true.
  2760     self hasProjectSelectedHolder value:true.
  2863 
  2761 
  2864     pageToGo := 2.
  2762     pageToGo := 2.
  2865     type == ProjectDefinition guiApplicationType ifTrue:[
  2763     (type == ProjectDefinition guiApplicationType) ifTrue:[
  2866         pageToGo := 3.
  2764         pageToGo := 3.
  2867         (startupClass := aProjectDefinitionClass startupClass) notNil ifTrue:[
  2765         (startupClass := aProjectDefinitionClass startupClass) notNil ifTrue:[
  2868             self updateListOfStartupClassesInProject.
  2766             self updateListOfStartupClassesInProject.
  2869             selectedStartupClass := startupClass.
  2767             selectedStartupClass := startupClass.
  2870             self selectedStartupClassIndexHolder value:(self listOfStartupClassesInProject value indexOf:startupClass).
  2768             self selectedStartupClassIndexHolder value:(self listOfStartupClassesInProject value indexOf:startupClass).
  2871             pageToGo := 5.
  2769             pageToGo := 5.
  2872         ]. 
  2770         ]. 
  2873 "/    apps := (aProjectDefinitionClass classes select:[:cls | cls isKindOf:ApplicationModel])
  2771         "/ apps := (aProjectDefinitionClass classes select:[:cls | cls isKindOf:ApplicationModel])
  2874     ].
  2772     ].
  2875     type == ProjectDefinition nonGuiApplicationType ifTrue:[
  2773     (type == ProjectDefinition nonGuiApplicationType) ifTrue:[
  2876         pageToGo := 4.
  2774         pageToGo := 4.
  2877         (startupClass := aProjectDefinitionClass startupClass) notNil ifTrue:[
  2775         (startupClass := aProjectDefinitionClass startupClass) notNil ifTrue:[
  2878             self updateListOfStartupClassesInProject.
  2776             self updateListOfStartupClassesInProject.
  2879             selectedStartupClass := startupClass.
  2777             selectedStartupClass := startupClass.
  2880             self selectedStartupClassIndexHolder value:(self listOfStartupClassesInProject value indexOf:startupClass).
  2778             self selectedStartupClassIndexHolder value:(self listOfStartupClassesInProject value indexOf:startupClass).
  3162 ! !
  3060 ! !
  3163 
  3061 
  3164 !ProjectBuilderAssistantApplication methodsFor:'specs'!
  3062 !ProjectBuilderAssistantApplication methodsFor:'specs'!
  3165 
  3063 
  3166 assistantSpec
  3064 assistantSpec
  3167     ^ self class assistantSpec
  3065     |specs|
       
  3066 
       
  3067     specs := OrderedCollection new.
       
  3068     specs add:
       
  3069         #( AssistantPageSpec
       
  3070             pageTitle: 'Project Type Selection'
       
  3071             windowSpecSelector: page1_projectTypeSelectionSpec
       
  3072             enterCallbackSelector: updateListOfMatchingProjects
       
  3073             infoText: 'Choose the <B>type</B> of project you are about to build.'
       
  3074         ) decodeAsLiteralArray.
       
  3075 
       
  3076     specs add:
       
  3077         #(AssistantPageSpec
       
  3078             pageTitle: 'ProjectDefinition Selection'
       
  3079             windowSpecSelector: page2_projectSelectionSpec
       
  3080             enterCallbackSelector: updateListOfMatchingProjectsAndProjectIDs
       
  3081             leaveCallbackSelector: fetchAttributesFromProjectDefinition
       
  3082             infoText: 'Choose an existing project definition or create a new one. These are subclasses of <I>ProjectDefinition</I> and define the type and contents of a project. Notice that the ID directly reflects the project''s location within the source code repository (module:directory/subdirectory...). If in doubt, use "&lt;yourname&gt;:demos/xxx_n".'
       
  3083         ) decodeAsLiteralArray.
       
  3084 
       
  3085     specs add:
       
  3086         #(AssistantPageSpec
       
  3087             pageTitle: 'Startup Application Selection'
       
  3088             windowSpecSelector: page3_applicationSelectionSpec
       
  3089             isEnabledQuerySelector: #projectTypeIsGuiApplication
       
  3090             canEnterQuerySelector: #canEnterApplicationSelection
       
  3091             enterCallbackSelector: updateListOfApplicationsInProject
       
  3092             infoText: 'Choose an existing application or create a new one. These are subclasses of <I>ApplicationModel</I> and define the GUI and control flow inside the application. Can also be left blank if the startup class does it all (stx build).'
       
  3093         ) decodeAsLiteralArray.
       
  3094 
       
  3095     specs add:
       
  3096         #(AssistantPageSpec
       
  3097             pageTitle: 'Startup Class Selection'
       
  3098             windowSpecSelector: page4_startupClassSelectionSpec
       
  3099             isEnabledQuerySelector: #projectTypeIsNotLibrary
       
  3100             canEnterQuerySelector: #canEnterStartupClassSelection
       
  3101             enterCallbackSelector: updateListOfStartupClassesInProject
       
  3102             infoText: 'Choose an existing startup-class or create a new one. These are subclasses of <I>StandaloneStartup</I> and start the application. Command line arguments can be interpreted there.'
       
  3103         ) decodeAsLiteralArray.
       
  3104 
       
  3105     specs add:
       
  3106         #(AssistantPageSpec
       
  3107             pageTitle: 'Specify Contents'
       
  3108             windowSpecSelector: page5_specifyIncludedClasses
       
  3109             enterCallbackSelector: enterContentsSpecification
       
  3110             canEnterQuerySelector: #canEnterContentsSelection
       
  3111             infoText: 'Define which (other) classes are to be included. Do not include classes from other packages here. Press "<I>Scan</I>" to include all classes of the package; "<I>Browse</I>" to edit the contents manually.'
       
  3112         ) decodeAsLiteralArray.
       
  3113 
       
  3114     specs add:
       
  3115         #(AssistantPageSpec
       
  3116             pageTitle: 'Specify Prerequisites'
       
  3117             windowSpecSelector: page5b_specifyPrerequisitePackages
       
  3118             enterCallbackSelector: enterPrerequisitesSpecification
       
  3119             canEnterQuerySelector: #canEnterPrerequisitesSelection
       
  3120             infoText: 'Define which packages are needed as prerequisites. These are required class libraries which should be packaged together with the application. Press "<I>Scan</I>" to search for prerequisites; "<I>Browse</I>" to edit the list manually.'
       
  3121         ) decodeAsLiteralArray.
       
  3122 
       
  3123     specs add:
       
  3124         #(AssistantPageSpec
       
  3125             pageTitle: 'Specify Project Attributes'
       
  3126             windowSpecSelector: page6a_specifyProjectAttributes
       
  3127             infoText: 'Define additional attributes. These will be shown during the installation of the deployed package and affect the name of the deployed self installable file.'
       
  3128             enterCallbackSelector: updateProjectAttributes
       
  3129             leaveCallbackSelector: #rememberProjectAttributes
       
  3130         ) decodeAsLiteralArray.
       
  3131 
       
  3132     specs add:
       
  3133         #(AssistantPageSpec
       
  3134             pageTitle: 'Specify Build Directory'
       
  3135             windowSpecSelector: page6b_specifyBuildDirectorySpec
       
  3136             infoText: 'Define where the build-process is to be performed and which compiler to use. All generated files are created below that directory. After deployment, the build directory is no longer needed (but you can keep it for a faster compile the next time).'
       
  3137             enterCallbackSelector: #checkCompilerAvailability
       
  3138             leaveCallbackSelector: #rememberUsedCompiler
       
  3139         ) decodeAsLiteralArray.
       
  3140 
       
  3141     specs add:
       
  3142         #(AssistantPageSpec
       
  3143             pageTitle: 'Check Into Source Repository'
       
  3144             windowSpecSelector: page7a_checkinSpec
       
  3145             enterCallbackSelector: #checkSourceCodeManagerType
       
  3146             infoText: 'Check the package''s source and build-support files into the source code repository.'
       
  3147         ) decodeAsLiteralArray.
       
  3148 
       
  3149     specs add:
       
  3150         #(AssistantPageSpec
       
  3151             pageTitle: 'Build'
       
  3152             windowSpecSelector: page7b_buildSpec
       
  3153             canEnterQuerySelector: #canEnterBuild
       
  3154             enterCallbackSelector: #restoreMakeOutputsContents
       
  3155             leaveCallbackSelector: #rememberMakeOutputsContents
       
  3156             infoText: 'Start the build-process. This will create an isolated build directory,
       
  3157 and run "make" there to compile all required classes.
       
  3158 <P>            
       
  3159 On Windows, it will use "nsis" to generate a self-installable executable, 
       
  3160 and you must have the compiler (borland-bcc, visual-c or mingw) and NullSoft NSIS packages installed for this to work.
       
  3161 Without NSIS, zip the folder where the exe is generated and unzip on a target machine.
       
  3162 <P>
       
  3163 On OS X, it will generate a "dmg" for deployment. You should have XCode or the "gcc" tool chain installed.
       
  3164 <P>
       
  3165 On Linux, an installable package will be generated. You should have the development support packages installed (gcc, Xlib etc.).
       
  3166 <P>
       
  3167 To try the application, open an Explorer/Finder on the directory and double click on the executable.
       
  3168 Alternatively, open a command window and type the name of the executable there. 
       
  3169 Sorry, but double-click in the ST/X file browser does not work.'
       
  3170         ) decodeAsLiteralArray.
       
  3171 
       
  3172     self projectTypeIsLibrary ifTrue:[
       
  3173         specs add:
       
  3174             #(AssistantPageSpec
       
  3175                 pageTitle: 'Deploy'
       
  3176                 windowSpecSelector: page8_deploySpec
       
  3177                 canEnterQuerySelector: #canEnterDeploy
       
  3178                 enterCallbackSelector: enterDeploySpecification
       
  3179                 infoText: 'Find the generated binary class library file here.
       
  3180 Because this is a library package (i.e. no application package), 
       
  3181 there is no deployable installer generated, just the binary (.so / .dll).'
       
  3182             ) decodeAsLiteralArray.
       
  3183     ] ifFalse:[   
       
  3184         specs add:
       
  3185             #(AssistantPageSpec
       
  3186                 pageTitle: 'Deploy'
       
  3187                 windowSpecSelector: page8_deploySpec
       
  3188                 canEnterQuerySelector: #canEnterDeploy
       
  3189                 enterCallbackSelector: enterDeploySpecification
       
  3190                 infoText: 'Find the installer-file to be deployed (or test-run the executable). 
       
  3191 You can open an Explorer/Finder there to copy the files for deployment. 
       
  3192 After that, the build directory is no longer needed. 
       
  3193 However, you can keep it for a faster compile the next time.'
       
  3194             ) decodeAsLiteralArray.
       
  3195     ].
       
  3196     ^ specs.
       
  3197 
       
  3198     "Modified: / 04-09-2012 / 09:49:50 / cg"
  3168 ! !
  3199 ! !
  3169 
  3200 
  3170 !ProjectBuilderAssistantApplication methodsFor:'update'!
  3201 !ProjectBuilderAssistantApplication methodsFor:'update'!
  3171 
  3202 
  3172 checkCompilerAvailability
  3203 checkCompilerAvailability
  3287     selectedProjectDefinition includeClasses:toAdd usingCompiler:nil.
  3318     selectedProjectDefinition includeClasses:toAdd usingCompiler:nil.
  3288 
  3319 
  3289     self updateListOfClassesInProject.
  3320     self updateListOfClassesInProject.
  3290 !
  3321 !
  3291 
  3322 
       
  3323 enterDeploySpecification
       
  3324     |fileBrowserCanvas fileBrowser|
       
  3325 
       
  3326     fileBrowserCanvas := self builder componentAt:'FileBrowserSubCanvas'.
       
  3327     fileBrowser := fileBrowserCanvas application. 
       
  3328     fileBrowser filterModel value:('*' , ObjectFileLoader sharedLibraryExtension).
       
  3329 !
       
  3330 
  3292 enterPrerequisitesSpecification
  3331 enterPrerequisitesSpecification
  3293     |toAdd|
  3332     |toAdd|
  3294 
  3333 
  3295     self updateListOfPrerequisitesInProject.
  3334     self updateListOfPrerequisitesInProject.
  3296 
  3335