ensure starup and application are in the classList of the projectDef
authorClaus Gittinger <cg@exept.de>
Fri, 23 Oct 2009 16:44:38 +0200
changeset 2686 5a19c21dada0
parent 2685 9e5b81943c7f
child 2687 66343568f2b2
ensure starup and application are in the classList of the projectDef
Tools__ProjectBuilderAssistantApplication.st
--- a/Tools__ProjectBuilderAssistantApplication.st	Fri Oct 23 16:12:26 2009 +0200
+++ b/Tools__ProjectBuilderAssistantApplication.st	Fri Oct 23 16:44:38 2009 +0200
@@ -5,18 +5,18 @@
 AssistantApplication subclass:#ProjectBuilderAssistantApplication
         instanceVariableNames:'packageToBuildHolder projectType projectTypeHolder
                 selectedProjectIndexHolder selectedProjectDefinition
-                listOfMatchingProjects 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'
+                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'
         classVariableNames:''
         poolDictionaries:''
         category:'System-Support-Projects'
@@ -161,7 +161,7 @@
                           hasHorizontalScrollBar: true
                           hasVerticalScrollBar: true
                           useIndex: true
-                          sequenceList: listOfMatchingProjects
+                          sequenceList: listOfMatchingPackageIds
                         )
                        (TextEditorSpec
                           name: 'TextEditor1'
@@ -270,7 +270,7 @@
                           hasHorizontalScrollBar: true
                           hasVerticalScrollBar: true
                           useIndex: true
-                          sequenceList: listOfMatchingProjects
+                          sequenceList: listOfMatchingPackageIds
                         )
                        (TextEditorSpec
                           name: 'TextEditor2'
@@ -976,11 +976,16 @@
 
     newProjectID := self newProjectsName value.
     newProjectID isEmptyOrNil ifTrue:[
-        Dialog warn:'Please enter a packageID first.'.
+        Dialog warn:(resources string:'Please enter a packageID first.').
         ^ self
     ].
     newProjectID asPackageId isModuleId ifTrue:[
-        Dialog warn:'Please enter a corrent packageID (module:directory).'.
+        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
     ].
 
@@ -1294,7 +1299,7 @@
         buildDirectoryHolder onChangeSend:#buildDirectoryChanged to:self.
     ].
     buildDirectoryHolder value isEmptyOrNil ifTrue:[
-        buildDirectory := Tools::ProjectBuilder previousBuildDirectory.
+        buildDirectory := ProjectBuilder previousBuildDirectory.
         buildDirectory isNil ifTrue:[
             buildDirectory := UserPreferences current buildDirectory.
             buildDirectory isNil ifTrue:[
@@ -1392,6 +1397,15 @@
     ^ listOfClassesInProject.
 !
 
+listOfMatchingPackageIds
+    <resource: #uiAspect>
+
+    listOfMatchingPackageIds isNil ifTrue:[
+        listOfMatchingPackageIds := ValueHolder new.
+    ].
+    ^ listOfMatchingPackageIds.
+!
+
 listOfMatchingProjects
     <resource: #uiAspect>
 
@@ -1758,7 +1772,7 @@
         (AssistantPageSpec
             pageTitle: 'Specify Contents'
             windowSpecSelector: page5_specifyIncludedClasses
-            enterCallbackSelector: updateListOfClassesInProject
+            enterCallbackSelector: enterContentsSpecification
             canEnterQuerySelector: #canEnterContentsSelection
             infoText: 'Define which (other) classes are to be included.
                        Press "<I>Scan</I>" to include all classes of the package;
@@ -1800,6 +1814,30 @@
 
 !ProjectBuilderAssistantApplication methodsFor:'update'!
 
+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)
 !
@@ -1924,6 +1962,7 @@
                    ].
     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:[