Tools__ProjectBuilderAssistantApplication.st
author Claus Gittinger <cg@exept.de>
Fri, 07 May 2010 14:27:02 +0200
changeset 2775 ba30bae7a60c
parent 2756 c3b2615d734d
child 2825 49853e842335
permissions -rw-r--r--
no max window size !

"
 COPYRIGHT (c) 2009 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libtool2' }"

"{ NameSpace: Tools }"

AssistantApplication subclass:#ProjectBuilderAssistantApplication
	instanceVariableNames:'packageToBuildHolder projectType projectTypeHolder
		selectedProjectIndexHolder selectedProjectDefinition
		listOfMatchingProjects listOfMatchingPackageIds
		selectedProjectsComment hasProjectSelectedHolder newProjectsName
		hideSTXProjects hideOtherApplicationClasses
		hideOtherStartupClasses startMakeButtonEnabled
		stopMakeButtonVisible makeOutputHolder newApplicationsName
		listOfApplicationsInProject selectedApplicationIndexHolder
		selectedApplication hasApplicationSelectedHolder
		listOfStartupClassesInProject selectedStartupClassIndexHolder
		selectedStartupClass hasStartupClassSelectedHolder
		selectedApplicationsComment buildDirectoryHolder makeProcess
		listOfClassesInProject makeOutputWindow projectBuilder
		newStartupClassName usedCompilerHolder listOfNewProjectsName
		newProjectsNameListExtendedComboBox productNameHolder
		companyNameHolder compilerWarnMessageHolder
		compilerWarnMessageVisibleHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Support-Projects'
!

!ProjectBuilderAssistantApplication class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2009 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    a user friendly interface to the build process.
    Simply wraps up existing tools like the CodeGeneratorTool, the browsers
    and the ProjetBuilder

    [see also:]
        CodeGeneratorTool
        ProjectBuilder
        ProjectDefinition

    [author:]
        Claus Gittinger
"
!

help

"/    Packager - A Standalone-Executable Builder and Packager
"/    This assistant-application allows for standalone applications to be built very easily. It will generate all required classes, files, start the compilation process, generate a self-installable executable with a few mouse clicks. A simple demo application like the famous "Hello World" can be generated in a few minutes.
"/    Prerequisites
"/    Windows Users:
"/    Please install either the "Borland Free Commandline Compiler Tools (bcc32)" or the "Microsoft Visual-C++" package (also free). In addition, the "NullSoft NSIS-Installer Package" is required.
"/
"/    Due to limitations and bugs in the Visual-C++ compiler (limit on the size of string-constants), some Smalltalk code is still not compilable (classes which contain image-resource methods for big images). Although microsoft is doing their best (a relative measure) to make things better (they increase the string-limit with every new release), they still seem to be undable to figure out how ti use malloc for string-data). We are patiently waiting for a real fix and still using bcc in the meanwhile. Therefore, we still recommend using the borland compiler suite. Please install it at its standard location ("C:\Borland") as our makefiles might still contain hard-coded pathes (yes, we are ashamed about this).
"/    Unix Users:
"/    You should already have the gcc compile suite (including all required header files) installed and ready to use. For a lack of time on our side, there is currently no self-installer support for Unix. The packager will generate a zipped tar file, which must be deployed and unpacked for use. This may change in the near future.
"/    Packages, Projects, PackageIDs and ProjectDefinitions
"/    Smalltalk basically uses two objects for packaging:
"/
"/        * PackageIDs (also called ProjectID's occasionally)
"/        * ProjectDefinitions 
"/
"/    Older ST/X versions used instances of a Project class - this is now obsolete and removed from the system (although there are still some minor uses of it, which might remain there for backward compatibility for some time, as some customers have built their own packaging scheme around it).
"/
"/    PackageIDs
"/    These are simple symbols and are attached to classes and methods. If a method has a packageID different from its class, it is called an extension method.
"/    PackageIDs must have a certain fixed format: they always contain exactly two parts, which are separated by a colon character: the module and the directory part. The module is used as main-selector on where and how the source code repository is accessed. The directory is a path below that repository. If checked out into the local filesystem, the module defines the top-level directory. Thus, if a packageID is "stx:libbasic", the corresponding sources will be found in the repository associated to the "stx" module, under the directory "libbasic". In the local file system, it will be found under "stx/libbasic". As another example, if the packageID is "exept:expecco/plugins/foo", the repository is whichever is associated with the "exept" module, and the subdirectory is "expecco/plugins/foo". The local path to the sourcefiles would be "exept/expecco/plugins/foo".
"/    Please notice that it does make sense to associate different repositories to different modules: for example, you could setup the sourceCodeManager to use CVS access to the exept repository for everything under the "stx" module, and at the same time, use a local SVN repository for everything under the "myCompany" module.
"/    ProjectDefinitions
"/    These describe the contents of a project, such as the classes to include, the set of extension methods, any additional compilation information. ProjectDefinitions come in 3 flavours:
"/
"/        * GUI Application Definition
"/        * non-GUI Application Definition
"/        * ClassLibrary Definition 
"/
"/    ProjectDefinitions are stored and managed as class-instances, located as subclasses of one of ApplicationDefinition or LibraryDefinition. As classes, they are themself managed, compiled and packaged as part of the project (and also have the same PackageID as their components). They are also treated like any other class w.r.t. source code management.
"/    Packaging
"/    All classes and extension methods belonging to a single package are supposed to be loaded (and possibly unloaded) together. They are also usually deployed inside a single dynamic link library ("dll", for short). In the Unix world, these are called "shared object" or "so". Finally, they are stored in a common directory both on the local file system and in a source code repository (CVS, SVN, etc.).
"/    Structure of a Project
"/    The artefacts as manipulated by the packager are:
"/
"/        * the ProjectDefinition class
"/          This defines the type of application (GUI / non-GUI), its contents (i.e. the set of classes to be included in the binary itself and the set of library-dll's to be included in the deployed package), and some other metadata, such as icon, title etc.
"/
"/        * the ApplicationModel class
"/          This defines the GUI, and is typically created using the UI-Painter.
"/
"/        * the Startup class
"/          This is the first class which gets control when the executable is started; it can analyze the command line arguments, read patches or updates, start background ptocesses, and will eventually open the applications GUI. 
"/
"/    Build Procedure
"/    All of the three components above can be generated by the packager to provide an initial framework for further work.
"/
"/    After the definition of those classes, all required files are stored in a temporary build directory. This means that the above classes are filed out, and make- and other support files are generated.
"/
"/    Finally, the actual build process is started. This requires an external C-compiler. Under windows, both Borland-C (free download available via the internet) and Microsoft's Visual-C++ (also available for free) can be used.
"/
"/    A self-installing executable is built using the NullSoft NSIS package. This is also required to be installed before the packager is started.
"/
"/    After the build, all required files are packaged in a single install-file. This is called "MyApplicationSetup.exe" and found in the project-specific subdirectory of the build directory. For deployment, this single file has to be delivered to a customer and executed there.
"/
"/    Summary: It has NEVER been easier to create a GUI application. 
! !

!ProjectBuilderAssistantApplication class methodsFor:'assistant pages spec'!

assistantSpec
    ^ #(Array
        ( AssistantPageSpec
            pageTitle: 'Project Type Selection'
            windowSpecSelector: page1_projectTypeSelectionSpec
            enterCallbackSelector: updateListOfMatchingProjects
            infoText: 'Choose the <B>type</B> of project you are about to build.'
        )

        (AssistantPageSpec
            pageTitle: 'ProjectDefinition Selection'
            windowSpecSelector: page2_projectSelectionSpec
            enterCallbackSelector: updateListOfMatchingProjects
            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.'
        )

        (AssistantPageSpec
            pageTitle: 'Startup Application Selection'
            windowSpecSelector: page3_applicationSelectionSpec
            isEnabledQuerySelector: #projectTypeIsGuiApplication
            canEnterQuerySelector: #canEnterApplicationSelection
            enterCallbackSelector: updateListOfApplicationsInProject
            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).'
        )

        (AssistantPageSpec
            pageTitle: 'Startup Class Selection'
            windowSpecSelector: page4_startupClassSelectionSpec
            isEnabledQuerySelector: #projectTypeIsNotLibrary
            canEnterQuerySelector: #canEnterStartupClassSelection
            enterCallbackSelector: updateListOfStartupClassesInProject
            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.'
        )

        (AssistantPageSpec
            pageTitle: 'Specify Contents'
            windowSpecSelector: page5_specifyIncludedClasses
            enterCallbackSelector: enterContentsSpecification
            canEnterQuerySelector: #canEnterContentsSelection
            infoText: 'Define which (other) classes are to be included.
                       Press "<I>Scan</I>" to include all classes of the package;
                       browse to edit the contents manually.'
        )

        (AssistantPageSpec
            pageTitle: 'Specify Project Attributes'
            windowSpecSelector: page6a_specifyProjectAttributes
            infoText: 'Define additional attributes.'
            enterCallbackSelector: updateProjectAttributes
            leaveCallbackSelector: #rememberProjectAttributes
        )

        (AssistantPageSpec
            pageTitle: 'Specify Build Directory'
            windowSpecSelector: page6b_specifyBuildDirectorySpec
            infoText: 'Define where the build-process is to be performed.
                       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).'

            enterCallbackSelector: #checkCompilerAvailability
        )

        (AssistantPageSpec
            pageTitle: 'Build'
            windowSpecSelector: page7_buildSpec
            canEnterQuerySelector: #canEnterBuild
            enterCallbackSelector: #restoreMakeOutputsContents
            leaveCallbackSelector: #rememberMakeOutputsContents
            infoText: 'Start the build-process. This will run make/bcc to compile
                       all required classes and nsis to generate a self-installable
                       executable. You must have the borland-cc and NullSoft NSIS
                       packages installed for this to work.'
        )

        (AssistantPageSpec
            pageTitle: 'Deploy'
            windowSpecSelector: page8_deploySpec
            canEnterQuerySelector: #canEnterDeploy
            infoText: 'Find the installer to be deployed (or test-run the binary).
                       You can open a WindowsExplorer there to copy the files for
                       deployment. After that, the build directory is no longer needed
                       (but you can keep it for a faster compile the next time).'
        )
    ) decodeAsLiteralArray.
! !

!ProjectBuilderAssistantApplication class methodsFor:'defaults'!

defaultIcon
    ^ ToolbarIconLibrary projectBuilderIcon
!

windowLabelTemplate
    ^ 'ST/X Packager: %1'
! !

!ProjectBuilderAssistantApplication class methodsFor:'help'!

flyByHelpSpec
    <resource: #help>

    ^ super flyByHelpSpec addPairsFrom:#(

#'projectType'
'Choose the type of Project you are about to deploy.'

#existingProjects
'Projects with an existing ProjectDefinition of the chosen type (above).'

#browseSelectedProject
'Open a SystemBrowser on the selected Project.'

#hideSTXBasePackages
'Only show packages which are not already included in the basic ST/X delivery.'

#'listOfNewProjectsName'
'PackageID (module:directory).
The pull-down list contains packageIDs for which no ProjectDefinition exists (yet).'

#'createNewProject'
'PackageID (module:directory).
Click to create a new (empty) ProjectDefinition for the given PackageID.'

)
! !

!ProjectBuilderAssistantApplication class methodsFor:'interface specs'!

page1_projectTypeSelectionSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page1_projectTypeSelectionSpec
     Tools::ProjectBuilderAssistantApplication new openInterface:#page1_projectTypeSelectionSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: #'page1_projectTypeSelectionSpec'
        window: 
       (WindowSpec
          label: 'Project Selection'
          name: 'Project Selection'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 626 394)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Project Type'
              name: 'FramedBox1'
              layout: (LayoutFrame 0 0.0 0 0 4 1.0 120 0)
              activeHelpKey: projectType
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (VerticalPanelViewSpec
                    name: 'VerticalPanel1'
                    layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
                    horizontalLayout: leftSpace
                    verticalLayout: topSpace
                    horizontalSpace: 3
                    verticalSpace: 3
                    component: 
                   (SpecCollection
                      collection: (
                       (ViewSpec
                          name: 'Box1'
                          extent: (Point 10 10)
                        )
                       (RadioButtonSpec
                          label: 'GUI Application'
                          name: 'RadioButton1'
                          translateLabel: true
                          model: projectTypeHolder
                          isTriggerOnDown: true
                          onCallBackSelector: projectTypeChanged
                          select: guiApplicationType
                          extent: (Point 136 22)
                        )
                       (RadioButtonSpec
                          label: 'Non-GUI Application'
                          name: 'RadioButton2'
                          translateLabel: true
                          model: projectTypeHolder
                          isTriggerOnDown: true
                          onCallBackSelector: projectTypeChanged
                          select: nonGuiApplicationType
                          extent: (Point 136 22)
                        )
                       (RadioButtonSpec
                          label: 'Class Library'
                          name: 'RadioButton3'
                          translateLabel: true
                          model: projectTypeHolder
                          isTriggerOnDown: true
                          onCallBackSelector: projectTypeChanged
                          select: libraryType
                          extent: (Point 136 22)
                        )
                       )
                     
                    )
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Existing Projects of this Type (PackageIDs)'
              name: 'FramedBox2'
              layout: (LayoutFrame 0 0.0 123 0 4 1.0 0 1)
              activeHelpKey: existingProjects
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (VariableHorizontalPanelSpec
                    name: 'VariableHorizontalPanel1'
                    layout: (LayoutFrame 0 0 4 0 0 1 -26 1)
                    component: 
                   (SpecCollection
                      collection: (
                       (SequenceViewSpec
                          name: 'List1'
                          model: selectedProjectIndexHolder
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
                          useIndex: true
                          sequenceList: listOfMatchingPackageIds
                        )
                       (TextEditorSpec
                          name: 'TextEditor1'
                          model: selectedProjectsComment
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
                          isReadOnly: true
                          hasKeyboardFocusInitially: false
                        )
                       )
                     
                    )
                    handles: (Any 0.34560327198364 1.0)
                  )
                 (CheckBoxSpec
                    label: 'Hide ST/X Base Packages'
                    name: 'CheckBox1'
                    layout: (LayoutFrame -1 0 -18 1 0 1 4 1)
                    activeHelpKey: hideSTXBasePackages
                    model: hideSTXProjects
                    translateLabel: true
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

page2_projectSelectionSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page2_projectSelectionSpec
     Tools::ProjectBuilderAssistantApplication new openInterface:#page2_projectSelectionSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: #'page2_projectSelectionSpec'
        window: 
       (WindowSpec
          label: 'Project Selection'
          name: 'Project Selection'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 521 453)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'New Project''s PackageID'
              name: 'FramedBox3'
              layout: (LayoutFrame 0 0.0 5 0 4 1.0 72 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (ExtendedComboBoxSpec
                    name: 'NewProjectsNameListExtendedComboBox'
                    layout: (LayoutFrame 1 0 6 0 -113 1 28 0)
                    model: newProjectsName
                    readOnly: false
                    miniScrollerHorizontal: true
                    postBuildCallback: postBuildNewProjectsNameListExtendedComboBox:
              activeHelpKey: listOfNewProjectsName
                  )
                 (ActionButtonSpec
                    label: 'Create'
                    name: 'Button1'
                    layout: (LayoutFrame -100 1 6 0 2 1 28 0)
                    translateLabel: true
                    model: createNewProject
              activeHelpKey: createNewProject

                  )

                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Existing Projects with ProjectDefinition'
              name: 'FramedBox4'
              layout: (LayoutFrame 0 0.0 70 0 4 1.0 -30 1)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (VariableHorizontalPanelSpec
                    name: 'VariableHorizontalPanel2'
                    layout: (LayoutFrame 0 0 4 0 0 1 -26 1)
                    component: 
                   (SpecCollection
                      collection: (
                       (SequenceViewSpec
                          name: 'List2'
                          model: selectedProjectIndexHolder
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
                          useIndex: true
                          sequenceList: listOfMatchingPackageIds
                        )
                       (TextEditorSpec
                          name: 'TextEditor2'
                          model: selectedProjectsComment
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
                          isReadOnly: true
                          hasKeyboardFocusInitially: false
                          viewClassName: 'TextView'
                        )
                       )
                     
                    )
                    handles: (Any 0.34560327198364 1.0)
                  )
                 (CheckBoxSpec
                    label: 'Hide ST/X Base Packages'
                    name: 'CheckBox1'
                    layout: (LayoutFrame -1 0 -17 1 0 1 5 1)
                    model: hideSTXProjects
                    translateLabel: true
                    activeHelpKey: hideSTXBasePackages
                  )
                 )
               
              )
            )
           (HorizontalPanelViewSpec
              name: 'HorizontalPanel1'
              layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
              horizontalLayout: leftSpace
              verticalLayout: center
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (ActionButtonSpec
                    label: 'Browse Selected Project'
                    name: 'Button3'
                    translateLabel: true
                    model: doBrowseProject
                    enableChannel: hasProjectSelectedHolder
                    extent: (Point 180 22)
                    activeHelpKey: browseSelectedProject
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

page3_applicationSelectionSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page3_applicationSelectionSpec
     Tools::ProjectBuilderAssistantApplication new openInterface:#page3_applicationSelectionSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: #'page3_applicationSelectionSpec'
        window: 
       (WindowSpec
          label: 'Application Selection'
          name: 'Application Selection'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 519 406)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'New Application Class'
              name: 'FramedBox3'
              layout: (LayoutFrame 0 0.0 5 0 4 1.0 70 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (InputFieldSpec
                    name: 'EntryField1'
                    layout: (LayoutFrame 1 0 6 0 -113 1 28 0)
                    model: newApplicationsName
                    acceptOnReturn: true
                    acceptOnTab: true
                    acceptOnLostFocus: true
                    acceptOnPointerLeave: true
                    emptyFieldReplacementText: 'MyApplication'
                  )
                 (ActionButtonSpec
                    label: 'Create'
                    name: 'Button1'
                    layout: (LayoutFrame -100 1 6 0 1 1 28 0)
                    translateLabel: true
                    model: createNewApplication
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Existing Applications'
              name: 'FramedBox4'
              layout: (LayoutFrame 0 0.0 72 0 4 1.0 -30 1)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (VariableHorizontalPanelSpec
                    name: 'VariableHorizontalPanel2'
                    layout: (LayoutFrame 0 0 4 0 0 1 -26 1)
                    component: 
                   (SpecCollection
                      collection: (
                       (SequenceViewSpec
                          name: 'List2'
                          model: selectedApplicationIndexHolder
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
                          useIndex: true
                          sequenceList: listOfApplicationsInProject
                          ignoreReselect: false
                        )
                       (TextEditorSpec
                          name: 'TextEditor2'
                          model: selectedApplicationsComment
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
                          isReadOnly: true
                          hasKeyboardFocusInitially: false
                          viewClassName: 'TextView'
                        )
                       )
                     
                    )
                    handles: (Any 0.34560327198364 1.0)
                  )
                 (CheckBoxSpec
                    label: 'Hide other Application Classes'
                    name: 'CheckBox1'
                    layout: (LayoutFrame -1 0 -18 1 0 1 4 1)
                    model: hideOtherApplicationClasses
                    translateLabel: true
                  )
                 )
               
              )
            )
           (HorizontalPanelViewSpec
              name: 'HorizontalPanel1'
              layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
              horizontalLayout: leftSpace
              verticalLayout: center
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (ActionButtonSpec
                    label: 'Browse Selected Application'
                    name: 'Button3'
                    translateLabel: true
                    model: doBrowseApplication
                    enableChannel: hasApplicationSelectedHolder
                    extent: (Point 180 22)
                  )
                 (ActionButtonSpec
                    label: 'Launch Selected Application'
                    name: 'Button4'
                    translateLabel: true
                    model: doLaunchApplication
                    enableChannel: hasApplicationSelectedHolder
                    extent: (Point 180 22)
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

page4_startupClassSelectionSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page4_startupClassSelectionSpec
     Tools::ProjectBuilderAssistantApplication new openInterface:#page4_startupClassSelectionSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: #'page4_startupClassSelectionSpec'
        window: 
       (WindowSpec
          label: 'Startup Class Selection'
          name: 'Startup Class Selection'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 521 408)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'New Startup Class'
              name: 'FramedBox3'
              layout: (LayoutFrame 0 0.0 5 0 4 1.0 70 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (InputFieldSpec
                    name: 'EntryField1'
                    layout: (LayoutFrame 1 0 6 0 -113 1 28 0)
                    model: newStartupClassName
                    acceptOnReturn: true
                    acceptOnTab: true
                    acceptOnLostFocus: true
                    acceptOnPointerLeave: true
                    emptyFieldReplacementText: 'MyStandAloneStartup'
                  )
                 (ActionButtonSpec
                    label: 'Create'
                    name: 'Button1'
                    layout: (LayoutFrame -100 1 6 0 1 1 28 0)
                    translateLabel: true
                    model: createNewStartupClass
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Existing Startup Classes'
              name: 'FramedBox4'
              layout: (LayoutFrame 0 0.0 72 0 4 1.0 -30 1)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (VariableHorizontalPanelSpec
                    name: 'VariableHorizontalPanel2'
                    layout: (LayoutFrame 0 0 4 0 0 1 -26 1)
                    component: 
                   (SpecCollection
                      collection: (
                       (SequenceViewSpec
                          name: 'List2'
                          model: selectedStartupClassIndexHolder
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
                          useIndex: true
                          sequenceList: listOfStartupClassesInProject
                        )
                       (TextEditorSpec
                          name: 'TextEditor2'
                          model: selectedStartupClassesComment
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
                          isReadOnly: true
                          hasKeyboardFocusInitially: false
                          viewClassName: 'TextView'
                        )
                       )
                     
                    )
                    handles: (Any 0.34560327198364 1.0)
                  )
                 (CheckBoxSpec
                    label: 'Hide other Startup Classes'
                    name: 'CheckBox1'
                    layout: (LayoutFrame -1 0 -20 1 0 1 2 1)
                    model: hideOtherStartupClasses
                    translateLabel: true
                  )
                 )
               
              )
            )
           (HorizontalPanelViewSpec
              name: 'HorizontalPanel1'
              layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
              horizontalLayout: leftSpace
              verticalLayout: center
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (ActionButtonSpec
                    label: 'Browse Selected StartupClass'
                    name: 'Button3'
                    translateLabel: true
                    model: doBrowseStartupClass
                    enableChannel: hasStartupClassSelectedHolder
                    extent: (Point 180 22)
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

page5_specifyIncludedClasses
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page5_specifyIncludedClasses
     Tools::ProjectBuilderAssistantApplication new openInterface:#page5_specifyIncludedClasses
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: #'page5_specifyIncludedClasses'
        window: 
       (WindowSpec
          label: 'Project Selection'
          name: 'Project Selection'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 521 400)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Project Contents'
              name: 'FramedBox3'
              layout: (LayoutFrame 0 0.0 5 0 4 1.0 -30 1)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (SequenceViewSpec
                    name: 'List1'
                    layout: (LayoutFrame 0 0 0 0 0 1 0 1)
                    initiallyDisabled: true
                    hasHorizontalScrollBar: true
                    hasVerticalScrollBar: true
                    useIndex: false
                    sequenceList: listOfClassesInProject
                  )
                 )
               
              )
            )
           (HorizontalPanelViewSpec
              name: 'HorizontalPanel1'
              layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
              horizontalLayout: center
              verticalLayout: center
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (ActionButtonSpec
                    label: 'Browse Project Definition'
                    name: 'Button3'
                    translateLabel: true
                    model: doBrowseProjectDefinitionClass
                    extent: (Point 180 22)
                  )
                 (ActionButtonSpec
                    label: 'Update Contents (Scan)'
                    name: 'Button4'
                    translateLabel: true
                    model: doGenerateProjectContentsDefinition
                    extent: (Point 180 22)
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

page6a_specifyProjectAttributes
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page6a_specifyProjectAttributes
     Tools::ProjectBuilderAssistantApplication new openInterface:#page6a_specifyProjectAttributes
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: #'page6a_specifyProjectAttributes'
        window: 
       (WindowSpec
          label: 'Project Selection'
          name: 'Project Selection'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 521 239)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Product Information'
              name: 'FramedBox3'
              layout: (LayoutFrame 0 0.0 5 0 4 1.0 101 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Product Name:'
                    name: 'Label1'
                    layout: (LayoutFrame 0 0 10 0 148 0 32 0)
                    translateLabel: true
                    adjust: right
                  )
                 (InputFieldSpec
                    name: 'EntryField4'
                    layout: (LayoutFrame 150 0.0 10 0 0 1.0 32 0)
                    model: productNameHolder
                    acceptOnLostFocus: true
                    acceptOnPointerLeave: true
                    viewClassName: ''
                  )
                 (LabelSpec
                    label: 'Company Name:'
                    name: 'Label2'
                    layout: (LayoutFrame 0 0 39 0 148 0 61 0)
                    translateLabel: true
                    adjust: right
                  )
                 (InputFieldSpec
                    name: 'EntryField3'
                    layout: (LayoutFrame 150 0.0 39 0 0 1.0 61 0)
                    model: companyNameHolder
                    acceptOnLostFocus: true
                    acceptOnPointerLeave: true
                    viewClassName: ''
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

page6b_specifyBuildDirectorySpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page6b_specifyBuildDirectorySpec
     Tools::ProjectBuilderAssistantApplication new openInterface:#page6b_specifyBuildDirectorySpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: #'page6b_specifyBuildDirectorySpec'
        window: 
       (WindowSpec
          label: 'Project Selection'
          name: 'Project Selection'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 521 361)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Build Directory'
              name: 'FramedBox3'
              layout: (LayoutFrame 0 0.0 5 0 4 1.0 79 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (FilenameInputFieldSpec
                    name: 'FilenameEntryField1'
                    layout: (LayoutFrame 0 0.0 10 0 0 1.0 32 0)
                    model: buildDirectoryHolder
                    acceptOnPointerLeave: true
                    viewClassName: FilenameWidgetWithHistory
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Compiler / Toolchain'
              name: 'FramedBox4'
              layout: (LayoutFrame 0 0.0 81 0 4 1.0 155 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (ComboListSpec
                    name: 'ComboList1'
                    layout: (LayoutFrame 0 0 10 0 137 0 32 0)
                    model: usedCompilerHolder
                    comboList: listOfPossibleCompilers
                    useIndex: false
                  )
                 )
               
              )
            )
           (LabelSpec
              label: 'Compiler Warn-Label'
              name: 'Label1'
              layout: (LayoutFrame 2 0.0 158 0 -2 1.0 303 0)
              level: -1
              visibilityChannel: compilerWarnMessageVisibleHolder
              backgroundColor: (Color 100.0 49.999237048905 49.999237048905)
              translateLabel: true
              labelChannel: compilerWarnMessageHolder
              adjust: left
            )
           )
         
        )
      )
!

page7_buildSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page7_buildSpec
     Tools::ProjectBuilderAssistantApplication new openInterface:#page7_buildSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: #'page7_buildSpec'
        window: 
       (WindowSpec
          label: 'Project Selection'
          name: 'Project Selection'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 521 472)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Make Output'
              name: 'FramedBox3'
              layout: (LayoutFrame 0 0.0 5 0 4 1.0 -30 1)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (TextEditorSpec
                    name: 'MakeOutputWindow'
                    layout: (LayoutFrame 0 0 0 0 0 1 0 1)
                    model: makeOutputHolder
                    hasHorizontalScrollBar: true
                    hasVerticalScrollBar: true
                    hasKeyboardFocusInitially: false
                    viewClassName: 'TextCollector'
                    postBuildCallback: postBuildMakeOutputWindow:
                  )
                 )
               
              )
            )
           (HorizontalPanelViewSpec
              name: 'HorizontalPanel1'
              layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
              horizontalLayout: leftSpace
              verticalLayout: center
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (ActionButtonSpec
                    label: 'Make All'
                    name: 'Button3'
                    translateLabel: true
                    model: doStartMakeAll
                    enableChannel: startMakeButtonEnabled
                    extent: (Point 107 22)
                  )
                 (ActionButtonSpec
                    label: 'Make EXE only'
                    name: 'Button5'
                    translateLabel: true
                    model: doStartMakeExe
                    enableChannel: startMakeButtonEnabled
                    extent: (Point 107 22)
                  )
                 (ViewSpec
                    name: 'Box1'
                    extent: (Point 20 10)
                  )
                 (ActionButtonSpec
                    label: 'Stop Make'
                    name: 'Button4'
                    visibilityChannel: stopMakeButtonVisible
                    translateLabel: true
                    model: doStopMake
                    extent: (Point 107 22)
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

page8_deploySpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page8_deploySpec
     Tools::ProjectBuilderAssistantApplication new openInterface:#page8_deploySpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: #'page8_deploySpec'
        window: 
       (WindowSpec
          label: 'Project Selection'
          name: 'Project Selection'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 521 472)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Files for Deployment'
              name: 'FramedBox3'
              layout: (LayoutFrame 0 0.0 5 0 4 1.0 0 1)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (SubCanvasSpec
                    name: 'SubCanvas1'
                    layout: (LayoutFrame 0 0 0 0 0 1 -30 1)
                    hasHorizontalScrollBar: false
                    hasVerticalScrollBar: false
                    clientHolder: fileBrowserInstance
                    createNewApplication: true
                    createNewBuilder: true
                  )
                 (HorizontalPanelViewSpec
                    name: 'HorizontalPanel1'
                    layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
                    horizontalLayout: centerMax
                    verticalLayout: center
                    horizontalSpace: 3
                    verticalSpace: 3
                    component: 
                   (SpecCollection
                      collection: (
                       (ActionButtonSpec
                          label: 'Open Windows Explorer'
                          name: 'Button1'
                          visibilityChannel: isWindowsOS
                          translateLabel: true
                          resizeForLabel: true
                          model: doOpenExplorer
                          extent: (Point 172 22)
                        )
                       (ActionButtonSpec
                          label: 'Open Console'
                          name: 'Button2'
                          visibilityChannel: isUnixOS
                          translateLabel: true
                          resizeForLabel: true
                          model: doOpenConsoleTerminal
                          extent: (Point 172 22)
                        )
                       )
                     
                    )
                  )
                 )
               
              )
            )
           )
         
        )
      )
! !

!ProjectBuilderAssistantApplication class methodsFor:'misc specs'!

newProjectsNameListSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#newProjectsNameListSpec
     Tools::ProjectBuilderAssistantApplication new openInterface:#newProjectsNameListSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: newProjectsNameListSpec
        window: 
       (WindowSpec
          label: 'NewApplication'
          name: 'NewApplication'
          min: (Point 0 0)
          bounds: (Rectangle 0 0 131 207)
        )
        component: 
       (SpecCollection
          collection: (
           (SequenceViewSpec
              name: 'ReferencePoint2'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              activeHelpKey: listOfNewProjectsName
              model: newProjectsName
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              miniScrollerHorizontal: true
              miniScrollerVertical: false
              useIndex: false
              sequenceList: listOfNewProjectsName
              doubleClickChannel: newProjectsNameListDoubleClickChannel
            )
           )
         
        )
      )
! !

!ProjectBuilderAssistantApplication methodsFor:'actions'!

buildDirectoryChanged
    self updateButtonEnableState.
!

createNewApplication
    <resource: #uiCallback>

    |newAppName newAppClass|

    newAppName := self newApplicationsName value.
    newAppName isEmptyOrNil ifTrue:[
        Dialog warn:'Please enter the name of the Application-Class first.'.
        ^ self
    ].

    self withWaitCursorDo:[
        Class packageQuerySignal answer:(selectedProjectDefinition package)
        do:[
            newAppClass := ApplicationModel
                            subclass:newAppName asSymbol
                            instanceVariableNames:''
                            classVariableNames:''
                            poolDictionaries:''
                            category:'Applications'.
            CodeGeneratorTool createApplicationCodeFor:newAppClass.
        ].
        self updateListOfApplicationsInProject.
        self selectedApplicationIndexHolder value:(listOfApplicationsInProject value indexOf:newAppClass).
    ].
!

createNewProject
    <resource: #uiCallback>

    |newProjectID projectDefinitionType projectDefinitionClass projectClasses|

    newProjectID := self newProjectsName value.
    newProjectID isEmptyOrNil ifTrue:[
        Dialog warn:(resources string:'Please enter a packageID first.').
        ^ self
    ].
    newProjectID asPackageId isModuleId ifTrue:[
        Dialog warn:(resources stringWithCRs:
'Please enter a corrent packageID.

All packages must be named like "%1:%2"
(%2 can be a path like "dir/dir/...").' with:(resources string:'module')allItalic
                                        with:(resources string:'directory')allItalic).
        ^ self
    ].

    self withWaitCursorDo:[
        projectDefinitionType := ProjectDefinition perform:(self projectTypeHolder value).

        projectDefinitionClass := ProjectDefinition
                                    definitionClassForPackage:newProjectID
                                    projectType: projectDefinitionType
                                    createIfAbsent:true.

        projectDefinitionClass compileDescriptionMethods.
        self updateListOfMatchingProjects.
        self updateListOfNewProjectsName.

        self selectedProjectIndexHolder value:( self listOfMatchingProjects value indexOf:projectDefinitionClass).

        projectClasses := projectDefinitionClass allClassNames 
                                collect:[:nm |Smalltalk classNamed:nm].

"/    projectDefinitionClass isGUIApplication ifTrue:[
"/        "/ see if it has an AppModel class
"/        (projectClasses contains:[:cls | cls isVisualStartable]) ifFalse:[
"/            (Dialog confirm:'Create an Application Class ?') ifTrue:[
"/                self halt.
"/            ].
"/        ].
"/    ].

"/    projectDefinitionClass isLibrary ifFalse:[
"/        "/ see if it has a Startup class
"/        (projectClasses contains:[:cls | cls isStartable]) ifFalse:[
"/        ].
"/    ].

    ].
!

createNewStartupClass
    <resource: #uiCallback>

    |newClassName newStartupClass startupApplication|

    newClassName := self newStartupClassName value.
    newClassName isEmptyOrNil ifTrue:[
        Dialog warn:'Please enter the name of the Startup-Class first.'.
        ^ self
    ].

    self withWaitCursorDo:[ 
        |pkg|

        pkg := selectedProjectDefinition notNil 
                    ifTrue:[selectedProjectDefinition package]
                    ifFalse:[newProjectsName value].
        Class packageQuerySignal answer:pkg
        do:[
            newStartupClass := StandaloneStartup
                            subclass:newClassName asSymbol
                            instanceVariableNames:''
                            classVariableNames:''
                            poolDictionaries:''
                            category:'Applications'.   

            self projectTypeIsGuiApplication ifTrue: [startupApplication := selectedApplication].
            CodeGeneratorTool createStartupCodeFor:newStartupClass forStartOf:startupApplication.
        ].
        self updateListOfStartupClassesInProject.
        self selectedStartupClassIndexHolder value:(listOfStartupClassesInProject value indexOf:newStartupClass).
    ].
!

doAddClassToProject
    <resource: #uiCallback>

    Transcript showCR:self class name, ': action for doAddClassToProject ...'.
    self halt.
!

doBrowseApplication
    <resource: #uiCallback>

    |appClass|

    self hasApplicationSelected ifTrue:[
        appClass := self listOfApplicationsInProject value at:(self selectedApplicationIndexHolder value).
        UserPreferences systemBrowserClass 
            openInClass:appClass class selector:#windowSpec.
    ].
!

doBrowseProject
    <resource: #uiCallback>

    UserPreferences systemBrowserClass openOnPackage:selectedProjectDefinition package.
!

doBrowseProjectDefinitionClass
    <resource: #uiCallback>

    |defClass|

    self hasProjectSelected ifTrue:[
        defClass := self selectedProjectDefinition.
        UserPreferences systemBrowserClass 
            openInClass:defClass class selector:#classNamesAndAttributes.
    ].
!

doBrowseStartupClass
    <resource: #uiCallback>

    |startupClass|

    self hasStartupClassSelected ifTrue:[
        startupClass := self listOfStartupClassesInProject value at:(self selectedStartupClassIndexHolder value).
        UserPreferences systemBrowserClass 
            openInClass:startupClass class selector:#main:.
    ].
!

doGenerateProjectContentsDefinition
    self generatePackageContentsMethods
!

doLaunchApplication
    <resource: #uiCallback>

    |appClass|

    self hasApplicationSelected ifTrue:[
        appClass := self listOfApplicationsInProject value at:(self selectedApplicationIndexHolder value).
        appClass open.
    ].
!

doOpenConsoleTerminal
"/    OperatingSystem
"/        executeCommand:'cmd.exe'        
"/        inDirectory:(projectBuilder packageBuildDirectory)
    OperatingSystem isUNIXlike ifTrue:[
        VT100TerminalView openShellIn:(projectBuilder packageBuildDirectory)
    ] ifFalse:[
        OperatingSystem
            executeCommand:'c:\windows\System32\cmd.exe'        
            inDirectory:(projectBuilder packageBuildDirectory)
    ]
!

doOpenExplorer
    OperatingSystem
        openApplicationForDocument:(projectBuilder packageBuildDirectory) 
        operation:#explore.
!

doStartMakeAll
    <resource: #uiCallback>

    self stopMakeButtonVisible value:true.
    self startMakeButtonEnabled value:false.

    self infoHolder value:'Building (make) - please wait...'.
    makeOutputWindow clear.

    makeProcess := 
            [
                [
                    self runBuildProcess:'all'
                ] ensure:[
                    self stopMakeButtonVisible value:false.
                    self startMakeButtonEnabled value:true.
                    makeProcess := nil.
                    self updateButtonEnableState.
                    self infoHolder value:''.
                ].
            ] newProcess.

    makeProcess priority:4.
    makeProcess priorityRange:(4 to:8).
    makeProcess resume.
!

doStartMakeExe
    <resource: #uiCallback>

    self stopMakeButtonVisible value:true.
    self startMakeButtonEnabled value:false.

    self infoHolder value:'Building (make) - please wait...'.
    makeOutputWindow clear.

    makeProcess := 
            [
                [
                    self runBuildProcess:'exe'
                ] ensure:[
                    self stopMakeButtonVisible value:false.
                    self startMakeButtonEnabled value:true.
                    makeProcess := nil.
                    self updateButtonEnableState.
                    self infoHolder value:''.
                ].
            ] newProcess.

    makeProcess priority:4.
    makeProcess priorityRange:(4 to:8).
    makeProcess resume.
!

doStopMake
    <resource: #uiCallback>

    |p|

    (p := makeProcess) notNil ifTrue:[
        makeProcess := nil.
        p terminate.
        p waitUntilTerminated.

        makeOutputWindow endEntry.
        makeOutputWindow cr.
        makeOutputWindow nextPutLine:('Make Cancelled' colorizeAllWith:Color white on:Color red).
        makeOutputWindow endEntry.
    ].
!

projectTypeChanged
    <resource: #uiCallback>

    self updateListOfMatchingProjects
!

runBuildProcess:what
    <resource: #uiCallback>

    self assert:makeOutputWindow notNil.
    self assert:makeOutputWindow model == self makeOutputHolder.

    ActivityNotification handle:[:ex |
        ex messageText notNil ifTrue:[
            makeOutputWindow endEntry.
            makeOutputWindow cr.
            makeOutputWindow nextPutLine:(ex messageText colorizeAllWith:Color white on:Color blue).
            makeOutputWindow endEntry.
        ].
        ex proceed.
    ] do:[
        projectBuilder := ProjectBuilder new.
        projectBuilder package:(selectedProjectDefinition package).
        projectBuilder usedCompiler:(usedCompilerHolder value).
        what = 'exe' ifTrue:[
            projectBuilder makeExeOnly:true
        ] ifFalse:[
            projectBuilder makeExeOnly:false
        ].

        Error handle:[:ex |
            makeOutputWindow endEntry.
            makeOutputWindow cr.
            makeOutputWindow nextPutLine:(ex description colorizeAllWith:Color white on:Color red).
            makeOutputWindow endEntry.
            ex proceed.
        ] do:[
            projectBuilder buildWithColorizedOutputTo:makeOutputWindow.
        ].
    ].
!

selectedApplicationChanged
    |idx|

    ((idx := self selectedApplicationIndexHolder value) isNil
    or:[idx == 0]) ifTrue:[
        selectedApplication := nil.
    ] ifFalse:[
        selectedApplication := self listOfApplicationsInProject value at:idx.
    ].
    self hasApplicationSelectedHolder value:(selectedApplication notNil).

"/    selectedApplication notNil ifTrue:[
"/        "/ generate startupClass code
"/        CodeGeneratorTool
"/            compile:(selectedProjectDefinition startupClassName_codeFor:(selectedApplication name))
"/            forClass:selectedProjectDefinition theMetaclass
"/            inCategory:'description - startup'.
"/    ].
    self updateApplicationComment.
    self updateButtonEnableState.
!

selectedProjectChanged

    |selectedProjectIndex|

    selectedProjectIndex := self selectedProjectIndexHolder value.
    (selectedProjectIndex ? 0) == 0 ifTrue:[
        selectedProjectDefinition := nil.
    ] ifFalse:[
        selectedProjectDefinition := self listOfMatchingProjects value at:(selectedProjectIndex).
    ].
    self hasProjectSelectedHolder value:(selectedProjectDefinition notNil).

    self updateComment.
    self updateListOfApplicationsInProject.
    self updateButtonEnableState.
!

selectedStartupClassChanged
    self selectedStartupClassIndexHolder value isNil ifTrue:[
        selectedStartupClass := nil.
    ] ifFalse:[
        selectedStartupClass := self listOfStartupClassesInProject value at:(self selectedStartupClassIndexHolder value).
    ].
    self hasStartupClassSelectedHolder value:(selectedStartupClass notNil).

    selectedStartupClass notNil ifTrue:[
        "/ generate startupClass code
        CodeGeneratorTool
            compile:(selectedProjectDefinition startupClassName_codeFor:(selectedStartupClass name))
            forClass:selectedProjectDefinition theMetaclass
            inCategory:'description - startup'.
    ].
    self updateButtonEnableState.
! !

!ProjectBuilderAssistantApplication methodsFor:'aspects'!

buildDirectoryHolder
    <resource: #uiAspect>

    |buildDirectory|

    buildDirectoryHolder isNil ifTrue:[
        buildDirectoryHolder := nil asValue.
        buildDirectoryHolder onChangeSend:#buildDirectoryChanged to:self.
    ].
    buildDirectoryHolder value isEmptyOrNil ifTrue:[
        buildDirectory := ProjectBuilder previousBuildDirectory.
        buildDirectory isNil ifTrue:[
            buildDirectory := UserPreferences current buildDirectory.
            buildDirectory isNil ifTrue:[
                buildDirectory := Filename tempDirectory construct:'stx_build'.
            ].
        ].
        buildDirectoryHolder value: buildDirectory.
    ].
    ^ buildDirectoryHolder.
!

companyNameHolder
    <resource: #uiAspect>

    companyNameHolder isNil ifTrue:[
        companyNameHolder := 'MyCompany' asValue.
    ].
    ^ companyNameHolder.
!

compilerWarnMessageHolder
    <resource: #uiAspect>

    compilerWarnMessageHolder isNil ifTrue:[
        compilerWarnMessageHolder := '' asValue.
    ].
    ^ compilerWarnMessageHolder.
!

compilerWarnMessageVisibleHolder
    <resource: #uiAspect>

    compilerWarnMessageVisibleHolder isNil ifTrue:[
        compilerWarnMessageVisibleHolder := false asValue.
    ].
    ^ compilerWarnMessageVisibleHolder.
!

hasApplicationSelectedHolder
    <resource: #uiAspect>

    hasApplicationSelectedHolder isNil ifTrue:[
        hasApplicationSelectedHolder := nil asValue.
    ].
    ^ hasApplicationSelectedHolder.
!

hasProjectSelectedHolder
    <resource: #uiAspect>

    hasProjectSelectedHolder isNil ifTrue:[
        hasProjectSelectedHolder := nil asValue.
    ].
    ^ hasProjectSelectedHolder.
!

hasStartupClassSelectedHolder
    <resource: #uiAspect>

    hasStartupClassSelectedHolder isNil ifTrue:[
        hasStartupClassSelectedHolder := nil asValue.
    ].
    ^ hasStartupClassSelectedHolder.
!

hideOtherApplicationClasses
    <resource: #uiAspect>

    hideOtherApplicationClasses isNil ifTrue:[
        hideOtherApplicationClasses := true asValue.
        hideOtherApplicationClasses onChangeSend:#updateListOfApplicationsInProject to:self.
    ].
    ^ hideOtherApplicationClasses.
!

hideOtherStartupClasses
    <resource: #uiAspect>

    hideOtherStartupClasses isNil ifTrue:[
        hideOtherStartupClasses := true asValue.
        hideOtherStartupClasses onChangeSend:#updateListOfStartupClassesInProject to:self.
    ].
    ^ hideOtherStartupClasses.
!

hideSTXProjects
    <resource: #uiAspect>

    hideSTXProjects isNil ifTrue:[
        hideSTXProjects := true asValue.
        hideSTXProjects onChangeSend:#updateListOfMatchingProjects to:self.
    ].
    ^ hideSTXProjects.
!

listOfApplicationsInProject
    <resource: #uiAspect>

    listOfApplicationsInProject isNil ifTrue:[
        listOfApplicationsInProject := ValueHolder new.
    ].
    ^ listOfApplicationsInProject.
!

listOfClassesInProject
    <resource: #uiAspect>

    listOfClassesInProject isNil ifTrue:[
        listOfClassesInProject := ValueHolder new.
    ].
    ^ listOfClassesInProject.
!

listOfMatchingPackageIds
    <resource: #uiAspect>

    listOfMatchingPackageIds isNil ifTrue:[
        listOfMatchingPackageIds := ValueHolder new.
    ].
    ^ listOfMatchingPackageIds.
!

listOfMatchingProjects
    <resource: #uiAspect>

    listOfMatchingProjects isNil ifTrue:[
        listOfMatchingProjects := ValueHolder new.
    ].
    ^ listOfMatchingProjects.
!

listOfNewProjectsName

    <resource: #uiAspect>

    listOfNewProjectsName isNil ifTrue:[
        listOfNewProjectsName := ValueHolder new.
    ].
    ^ listOfNewProjectsName.
!

listOfPossibleCompilers
    OperatingSystem isMSWINDOWSlike ifTrue:[
        ^ #('bcc' 'vc' 'lcc' 'gcc' )
    ].
    ^ #('gcc')
!

listOfStartupClassesInProject
    <resource: #uiAspect>

    listOfStartupClassesInProject isNil ifTrue:[
        listOfStartupClassesInProject := ValueHolder new.
    ].
    ^ listOfStartupClassesInProject.
!

makeOutputHolder
    <resource: #uiAspect>

    makeOutputHolder isNil ifTrue:[
        makeOutputHolder := ValueHolder new.
    ].
    ^ makeOutputHolder.
!

newApplicationsName
    <resource: #uiAspect>

    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    newApplicationsName isNil ifTrue:[
        newApplicationsName := ValueHolder new.
"/ if your app needs to be notified of changes, uncomment one of the lines below:
"/       newApplicationsName addDependent:self.
"/       newApplicationsName onChangeSend:#newApplicationsNameChanged to:self.
    ].
    ^ newApplicationsName.
!

newProjectsName
    <resource: #uiAspect>

    newProjectsName isNil ifTrue:[
        newProjectsName := nil asValue.
    ].
    ^ newProjectsName.
!

newProjectsNameListDoubleClickChannel
    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."

    |holder|

    (holder := builder bindingAt:#newProjectsNameListDoubleClickChannel) isNil ifTrue:[
        holder := TriggerValue new.
        builder aspectAt:#newProjectsNameListDoubleClickChannel put:holder.
        holder onChangeEvaluate:[       
            newProjectsNameListExtendedComboBox notNil ifTrue: [
                newProjectsNameListExtendedComboBox closeMenu.
            ]
        ]
    ].
    ^ holder.
!

newStartupClassName
    <resource: #uiAspect>

    newStartupClassName isNil ifTrue:[
        newStartupClassName := ValueHolder new.
    ].
    ^ newStartupClassName.
!

productNameHolder
    <resource: #uiAspect>

    productNameHolder isNil ifTrue:[
        productNameHolder := 'MyProduct' asValue.
    ].
    ^ productNameHolder.
!

projectType
    self projectTypeHolder value == #libraryType ifTrue:[
        ^ ProjectDefinition libraryType
    ].
    self projectTypeHolder value == #guiApplicationType ifTrue:[
        ^ ProjectDefinition guiApplicationType
    ].
    self projectTypeHolder value == #nonGuiApplicationType ifTrue:[
        ^ ProjectDefinition nonGuiApplicationType
    ].
    self error.
!

projectType:aProjectTypeSymbol
    |pType|

    self assert:(ProjectDefinition projectTypes includes:aProjectTypeSymbol).
    aProjectTypeSymbol == ProjectDefinition libraryType ifTrue:[
        pType := #libraryType
    ] ifFalse:[
        aProjectTypeSymbol == ProjectDefinition guiApplicationType ifTrue:[
            pType := #guiApplicationType
        ] ifFalse:[
            aProjectTypeSymbol == ProjectDefinition nonGuiApplicationType ifTrue:[
                pType := #nonGuiApplicationType
            ] ifFalse:[
                self error.
            ].
        ]
    ].
    self projectTypeHolder value:aProjectTypeSymbol
!

projectTypeHolder
    <resource: #uiAspect>

    projectTypeHolder isNil ifTrue:[
        projectTypeHolder := RadioButtonGroup new.
        projectTypeHolder value:#guiApplicationType.
    ].
    ^ projectTypeHolder.
!

selectedApplicationIndexHolder
    <resource: #uiAspect>

    selectedApplicationIndexHolder isNil ifTrue:[
        selectedApplicationIndexHolder := ValueHolder new.
        selectedApplicationIndexHolder onChangeSend:#selectedApplicationChanged to:self.
    ].
    ^ selectedApplicationIndexHolder.
!

selectedApplicationsComment
    <resource: #uiAspect>

    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    selectedApplicationsComment isNil ifTrue:[
        selectedApplicationsComment := '' asValue.
"/ if your app needs to be notified of changes, uncomment one of the lines below:
"/       selectedApplicationsComment addDependent:self.
"/       selectedApplicationsComment onChangeSend:#selectedApplicationsCommentChanged to:self.
    ].
    ^ selectedApplicationsComment.
!

selectedProjectDefinition
    <resource: #uiAspect>

    ^ selectedProjectDefinition.
!

selectedProjectIndexHolder
    <resource: #uiAspect>

    selectedProjectIndexHolder isNil ifTrue:[
        selectedProjectIndexHolder := ValueHolder new.
        selectedProjectIndexHolder onChangeSend:#selectedProjectChanged to:self.
    ].
    ^ selectedProjectIndexHolder.
!

selectedProjectsComment
    <resource: #uiAspect>

    selectedProjectsComment isNil ifTrue:[
        selectedProjectsComment := '' asValue.
    ].
    ^ selectedProjectsComment.
!

selectedStartupClassIndexHolder
    <resource: #uiAspect>

    selectedStartupClassIndexHolder isNil ifTrue:[
        selectedStartupClassIndexHolder := ValueHolder new.
        selectedStartupClassIndexHolder onChangeSend:#selectedStartupClassChanged to:self.
    ].
    ^ selectedStartupClassIndexHolder.
!

startMakeButtonEnabled
    <resource: #uiAspect>

    startMakeButtonEnabled isNil ifTrue:[
        startMakeButtonEnabled := true asValue.
    ].
    ^ startMakeButtonEnabled.
!

stopMakeButtonVisible
    <resource: #uiAspect>

    stopMakeButtonVisible isNil ifTrue:[
        stopMakeButtonVisible := false asValue.
    ].
    ^ stopMakeButtonVisible.
!

usedCompilerHolder
    <resource: #uiAspect>

    usedCompilerHolder isNil ifTrue:[
        usedCompilerHolder := ValueHolder new.
        usedCompilerHolder value:(OperatingSystem isMSWINDOWSlike ifTrue:['bcc'] ifFalse:['gcc']).
        usedCompilerHolder onChangeSend:#checkCompilerAvailability to:self.
    ].
    ^ usedCompilerHolder.
! !

!ProjectBuilderAssistantApplication methodsFor:'initialization & release'!

fileBrowserInstance
    "setup the embedded fileBrowser (in the last page)"

    |targetDirectory browser|

    targetDirectory := projectBuilder packageBuildDirectory.

    browser := FileBrowserV2 new.
    browser onDirectory:targetDirectory.
    OperatingSystem isMSWINDOWSlike ifTrue:[
        browser filter:'*.exe;*.com'.
    ] ifFalse:[
        browser filter:'*'.
    ].
    ^ browser.
!

postBuildMakeOutputWindow:aView
    makeOutputWindow := aView
!

postBuildNewProjectsNameListExtendedComboBox:anExtendedComboBox

    |menu|

    menu := SubCanvas new.
    menu client:self spec:#newProjectsNameListSpec builder:nil.
    anExtendedComboBox closeOnSelect: false.
    anExtendedComboBox menuWidget:menu.

    anExtendedComboBox editor 
            immediateAccept:true;
            acceptOnLeave:true;
            acceptOnLostFocus:true;
            acceptOnPointerLeave:true;
            acceptOnReturn:true;
            acceptOnTab:true.

    newProjectsNameListExtendedComboBox := anExtendedComboBox.
!

postBuildWith:aBuilder
    super postBuildWith:aBuilder.
    self updateListOfMatchingProjects.
    self updateListOfNewProjectsName.

    Smalltalk addDependent:self.
!

release
    Smalltalk removeDependent:self.
    super release
! !

!ProjectBuilderAssistantApplication methodsFor:'menu actions'!

openDocumentation
   self openHTMLDocument:'tools/misc/TOP.html#PACKAGER'.
! !

!ProjectBuilderAssistantApplication methodsFor:'private'!

commentFromClass:aClass
    |docMethod comment indents minIndent maxLineLength|

    docMethod := aClass class compiledMethodAt:#documentation.
    docMethod notNil ifTrue:[
        comment := docMethod comment.
        comment := comment asStringCollection 
                        collect:[:line | line withoutTrailingSeparators].
        [comment notEmpty and:[comment first isBlank]] whileTrue:[ comment removeFirst ].
        maxLineLength := (comment collect:[:line | line size]) max.
        indents := comment collect:[:line | 
                                        line isEmptyOrNil
                                            ifTrue:[maxLineLength]
                                            ifFalse:[ line findFirst:[:ch | ch isSeparator not]]].
        (minIndent := indents min) > 1 ifTrue:[
            comment := comment collect:[:line | line copyFrom:minIndent].
        ].
        comment := comment asString.
    ].
    ^ comment
!

generatePackageContentsMethods
    <resource: #uiCallback>

    Class packageQuerySignal answer:(selectedProjectDefinition package)
    do:[
        selectedProjectDefinition 
            forEachContentsMethodsCodeToCompileDo:[:code :category |
                    CodeGeneratorTool
                        compile:code
                        forClass:selectedProjectDefinition theMetaclass
                        inCategory:category.
                ]
            ignoreOldDefinition:true
    ].
    self updateListOfClassesInProject
!

hasApplicationSelected
    ^ self selectedApplicationIndexHolder value notNil
!

hasBuildDirectorySpecified
    ^ self buildDirectoryHolder value notEmptyOrNil
!

hasProjectBuilder
    ^ projectBuilder notNil
!

hasProjectSelected
    ^ self selectedProjectIndexHolder value notNil
!

hasStartupClassSelected
    ^ self selectedStartupClassIndexHolder value notNil
! !

!ProjectBuilderAssistantApplication methodsFor:'queries'!

canEnterApplicationSelection
    ^ self hasProjectSelected
!

canEnterBuild
    ^ self hasBuildDirectorySpecified
!

canEnterContentsSelection
    ^ self hasProjectSelected 
    and:[ true "self hasApplicationSelected" 
    and:[ (self projectTypeIsLibrary or:[self hasStartupClassSelected]) ]]
!

canEnterDeploy
    ^ self hasProjectBuilder
!

canEnterStartupClassSelection
    ^ self hasProjectSelected "and:[ self hasApplicationSelected ]"
!

isUnixOS
    ^ OperatingSystem isUNIXlike
!

isWindowsOS
    ^ OperatingSystem isMSWINDOWSlike
!

projectTypeIsGuiApplication
    ^ self projectTypeHolder value == #guiApplicationType
!

projectTypeIsLibrary
    ^ self projectTypeHolder value == #libraryType
!

projectTypeIsNotLibrary
    ^ self projectTypeIsLibrary not
! !

!ProjectBuilderAssistantApplication methodsFor:'specs'!

assistantSpec
    ^ self class assistantSpec
! !

!ProjectBuilderAssistantApplication methodsFor:'update'!

checkCompilerAvailability
    |cmd suite warnMsg1 warnMsg2 sep|

    cmd := 'cc'.
    suite := 'C-Compiler'.
    warnMsg1 := warnMsg2 := ''.

    self usedCompilerHolder value = 'bcc' ifTrue:[
        cmd := 'bcc32'.
        suite := 'Borland C-Compiler'.
    ].
    self usedCompilerHolder value = 'vc' ifTrue:[
        cmd := 'cl'.
        suite := 'Microsoft Visual C C-Compiler'.
        warnMsg2 := 'Due to bugs in this C-compiler, some classes may not be compilable.'.
    ].
    self usedCompilerHolder value = 'lcc' ifTrue:[
        cmd := 'lcc'.
        suite := 'LCC C-Compiler'.
        warnMsg2 := 'The LCC C-compiler suite is not yet supported (linkage).'.
    ].
    self usedCompilerHolder value = 'gcc' ifTrue:[
        cmd := 'gcc'.
        suite := 'GNU C-Compiler'.
        OperatingSystem isMSWINDOWSlike ifTrue:[
            warnMsg2 := 'The GNU C-compiler suite is not yet supported on MSDOS systems.'.
        ].
    ].

    (OperatingSystem canExecuteCommand:cmd) ifFalse:[
        warnMsg1 :=
'The "%1"-command seems to be not in your path.
Please ensure that you installed the 
"%2" compiler suite correctly.' bindWith:cmd with:suite.
    ].

    (warnMsg1 notEmpty or:[warnMsg2 notEmpty]) ifTrue:[
        sep := ''.
        (warnMsg2 notEmpty) ifTrue:[ sep := '\\' withCRs ].

        self compilerWarnMessageHolder value:('Warning:

',warnMsg1,sep,warnMsg2).
        self compilerWarnMessageVisibleHolder value:true.
    ] ifFalse:[
        self compilerWarnMessageVisibleHolder value:false
    ].
!

enterContentsSpecification
    |toAdd|

    self updateListOfClassesInProject.

    toAdd := OrderedCollection new.

    "/ ensure that startup & app-class are in the list
    selectedApplication notNil ifTrue:[
        (selectedProjectDefinition classNames includes:selectedApplication name) ifFalse:[
            toAdd add:selectedApplication.
        ].
    ].
    selectedStartupClass notNil ifTrue:[
        (selectedProjectDefinition classNames includes:selectedStartupClass name) ifFalse:[
            toAdd add:selectedStartupClass.
        ].
    ].

    selectedProjectDefinition includeClasses:toAdd usingCompiler:nil.

    self updateListOfClassesInProject.
!

rememberMakeOutputsContents
    makeOutputHolder value:(makeOutputWindow contents)
!

rememberProjectAttributes
    self assert:selectedProjectDefinition notNil.
    Class withoutUpdatingChangesDo:[
        self productNameHolder value ~= selectedProjectDefinition productName ifTrue:[
            selectedProjectDefinition class compile:(selectedProjectDefinition 
                        productName_codeFor:(self productNameHolder value)).
        ].
        self companyNameHolder value ~= selectedProjectDefinition companyName ifTrue:[
            selectedProjectDefinition class compile:(selectedProjectDefinition 
                        companyName_codeFor:(self companyNameHolder value)).
        ]
    ].
!

restoreMakeOutputsContents
    makeOutputWindow contents:makeOutputHolder value
!

update:something with:anArgument from:changedObject
    changedObject == Smalltalk ifTrue:[
        (something == #newClass
        or:[something == #classRemove
        or:[something == #projectOrganization]]) ifTrue:[
            self updateListOfMatchingProjects.
            self updateListOfNewProjectsName.
            ^ self.
        ].
        ^ self.
    ].
    super update:something with:anArgument from:changedObject
!

updateApplicationComment
    |comment|

    self selectedApplicationIndexHolder value notNil ifTrue:[
        comment := self commentFromClass:selectedApplication.
        comment isNil ifTrue:[
            comment := 'Application has no comment' allItalic colorizeAllWith:Color lightGrey.
        ].
    ] ifFalse:[
        comment := 'Please select an Application' allItalic colorizeAllWith:Color lightGrey.
    ].
    self selectedApplicationsComment value:comment.
!

updateComment
    |comment|

    self selectedProjectIndexHolder value notNil ifTrue:[
        comment := self commentFromClass:selectedProjectDefinition.
        comment isNil ifTrue:[
            comment := 'Project has no comment' allItalic colorizeAllWith:Color lightGrey.
        ].
    ] ifFalse:[
        comment := 'Please select a Project' allItalic colorizeAllWith:Color lightGrey.
    ].
    self selectedProjectsComment value:comment.
!

updateListOfApplicationsInProject
    |oldList applicationClasses package appClass appClassIndex|

    appClassIndex := nil.

    selectedProjectDefinition isNil ifTrue:[
        applicationClasses := #()
    ] ifFalse:[
        package := selectedProjectDefinition package.

        applicationClasses := Smalltalk allClasses
                                    select:[:cls |
                                        ((cls isSubclassOf:ApplicationModel)
                                        and:[ self hideOtherApplicationClasses value not
                                              or:[ cls package = package ]])
                                    ].
        applicationClasses := applicationClasses asOrderedCollection.
        applicationClasses sort:[:a :b | a name < b name].

"/        startUpClassName := [ selectedProjectDefinition startupClassName ] ifError:[ nil ].
"/        startUpClassName notNil ifTrue:[
"/            startUpClass := Smalltalk classNamed:startUpClassName.
"/            startUpClass notNil ifTrue:[
"/                appClassIndex := applicationClasses indexOf:startUpClass.
"/                appClassIndex == 0 ifTrue:[ appClassIndex := nil ].
"/            ].
"/        ].
    ].

    oldList := self listOfApplicationsInProject value.
    oldList = applicationClasses ifFalse:[
        appClass := selectedApplication.
        appClassIndex := applicationClasses indexOf:appClass.
        appClassIndex == 0 ifTrue:[ appClassIndex := nil ].

        self listOfApplicationsInProject value:applicationClasses.
        self selectedApplicationIndexHolder value:appClassIndex.
    ].
!

updateListOfClassesInProject
    self listOfClassesInProject value:(selectedProjectDefinition classNames).
!

updateListOfMatchingProjects
    |query matching projectType idx|

    projectType := self projectType.
    projectType == ProjectDefinition libraryType ifTrue:[
        query := #isLibraryDefinition
    ] ifFalse:[
        projectType == ProjectDefinition guiApplicationType ifTrue:[
            query := #isGUIApplication
        ] ifFalse:[
            projectType == ProjectDefinition nonGuiApplicationType ifTrue:[
                query := #isConsoleApplication
            ] ifFalse:[
                self error.
            ].
        ].
    ].

    Class flushSubclassInfo.

    matching := ProjectDefinition allSubclasses
                    select:[:defClass |
                        |match|

                        match := false.
                        defClass isAbstract ifFalse:[
                            (self hideSTXProjects value not
                            or:[ defClass package asPackageId module ~= 'stx' ])
                            ifTrue:[
                                match := defClass perform:query
                            ].
                        ].
                   ].

    matching sort:[:a :b | a name < b name].
    self listOfMatchingProjects value:matching.
    self listOfMatchingPackageIds value:(matching collect:[:def | def package]).

    idx := matching indexOf:selectedProjectDefinition.
    idx == 0 ifTrue:[
        self selectedProjectIndexHolder value:nil.
    ] ifFalse:[
        self selectedProjectIndexHolder value:idx.
    ].
!

updateListOfNewProjectsName

    |loadedProjectIDsWithoutProjectDefinition|

    loadedProjectIDsWithoutProjectDefinition := Smalltalk allLoadedProjectIDs 
                                                            select:[:eachProjectID | 
                                                                eachProjectID ~= PackageId noProjectID 
                                                                and:[ (ProjectDefinition definitionClassForPackage: eachProjectID) isNil ].
                                                            ].
    self listOfNewProjectsName value:loadedProjectIDsWithoutProjectDefinition.
!

updateListOfStartupClassesInProject
    |startupClasses package startUpClassName startUpClass startupClassIndex|

    startupClassIndex := nil.
    self selectedStartupClassIndexHolder value:nil.

    selectedProjectDefinition isNil ifTrue:[
        startupClasses := #()
    ] ifFalse:[
        package := selectedProjectDefinition package.

        startupClasses := Smalltalk allClasses
                                    select:[:cls |
                                        ((cls includesBehavior:StandaloneStartup)
                                        and:[ self hideOtherStartupClasses value not
                                              or:[ cls package = package ]])
                                        or:[ cls == Smalltalk
                                             and:[ self hideOtherStartupClasses value not ] ]
                                    ].
        startupClasses := startupClasses asOrderedCollection.
        startupClasses sort:[:a :b | a name < b name].

        startUpClassName := [ selectedProjectDefinition startupClassName ] ifError:[ nil ].
        startUpClassName notNil ifTrue:[
            startUpClass := Smalltalk classNamed:startUpClassName.
            startUpClass notNil ifTrue:[
                startupClassIndex := startupClasses indexOf:startUpClass.
                startupClassIndex == 0 ifTrue:[ startupClassIndex := nil ].
            ].
        ].
    ].

    self listOfStartupClassesInProject value:startupClasses.
    self selectedStartupClassIndexHolder value:startupClassIndex.
!

updateProjectAttributes
    self assert:selectedProjectDefinition notNil.
    self productNameHolder value:(selectedProjectDefinition productName).
    self companyNameHolder value:(selectedProjectDefinition companyName).
! !

!ProjectBuilderAssistantApplication class methodsFor:'documentation'!

version_CVS
    ^ '$Header$'
! !