"{ Package: 'stx:libtool2' }"
"{ NameSpace: Tools }"
AssistantApplication subclass:#ProjectBuilderAssistantApplication
instanceVariableNames:'packageToBuildHolder projectType selectedProjectIndexHolder
selectedProjectDefinition listOfMatchingProjects
selectedProjectsComment newProjectsName hideSTXProjects
startMakeButtonEnabled stopMakeButtonVisible makeOutputHolder
newApplicationsName selectedApplicationIndexHolder
selectedApplication listOfApplicationsInProject
selectedApplicationsComment buildDirectoryHolder makeProcess
listOfClassesInProject makeOutputWindow projectBuilder'
classVariableNames:''
poolDictionaries:''
category:'System-Support-Projects'
!
!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 Filter'
name: 'FramedBox1'
layout: (LayoutFrame 0 0.0 0 0 4 1.0 105 0)
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: projectType
isTriggerOnDown: true
onCallBackSelector: projectTypeChanged
select: guiApplicationType
extent: (Point 136 22)
)
(RadioButtonSpec
label: 'Non-GUI Application'
name: 'RadioButton2'
translateLabel: true
model: projectType
isTriggerOnDown: true
onCallBackSelector: projectTypeChanged
select: nonGuiApplicationType
extent: (Point 136 22)
)
(RadioButtonSpec
label: 'Class Library'
name: 'RadioButton3'
translateLabel: true
model: projectType
isTriggerOnDown: true
onCallBackSelector: projectTypeChanged
select: libraryType
extent: (Point 136 22)
)
)
)
)
)
)
)
(FramedBoxSpec
label: 'Existing Projects'
name: 'FramedBox2'
layout: (LayoutFrame 0 0.0 105 0 4 1.0 0 1)
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: listOfMatchingProjects
)
(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 275 0 4 1)
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'
name: 'FramedBox3'
layout: (LayoutFrame 0 0.0 5 0 4 1.0 72 0)
labelPosition: topLeft
translateLabel: true
component:
(SpecCollection
collection: (
(InputFieldSpec
name: 'EntryField1'
layout: (LayoutFrame 1 0 6 0 210 0 28 0)
model: newProjectsName
acceptOnReturn: true
acceptOnTab: true
acceptOnPointerLeave: true
emptyFieldReplacementText: 'module:directory'
)
(ActionButtonSpec
label: 'Create'
name: 'Button1'
layout: (LayoutFrame 216 0 6 0 341 0 28 0)
translateLabel: true
model: createNewProject
)
)
)
)
(FramedBoxSpec
label: 'Existing Projects'
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: listOfMatchingProjects
)
(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 275 0 5 1)
model: hideSTXProjects
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 Project'
name: 'Button3'
translateLabel: true
model: doBrowseProject
extent: (Point 180 22)
)
)
)
)
)
)
)
!
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 521 408)
)
component:
(SpecCollection
collection: (
(FramedBoxSpec
label: 'New Application'
name: 'FramedBox3'
layout: (LayoutFrame 0 0.0 5 0 4 1.0 105 0)
labelPosition: topLeft
translateLabel: true
component:
(SpecCollection
collection: (
(InputFieldSpec
name: 'EntryField1'
layout: (LayoutFrame 1 0 6 0 210 0 28 0)
model: newApplicationsName
acceptOnReturn: true
acceptOnTab: true
acceptOnPointerLeave: true
emptyFieldReplacementText: 'MyApplication'
)
(ActionButtonSpec
label: 'Create'
name: 'Button1'
layout: (LayoutFrame 216 0 6 0 341 0 28 0)
translateLabel: true
model: createNewApplication
)
)
)
)
(FramedBoxSpec
label: 'Existing Applications'
name: 'FramedBox4'
layout: (LayoutFrame 0 0.0 105 0 4 1.0 -30 1)
labelPosition: topLeft
translateLabel: true
component:
(SpecCollection
collection: (
(VariableHorizontalPanelSpec
name: 'VariableHorizontalPanel2'
layout: (LayoutFrame 0 0 4 0 0 1 0 1)
component:
(SpecCollection
collection: (
(SequenceViewSpec
name: 'List2'
model: selectedApplicationIndexHolder
hasHorizontalScrollBar: true
hasVerticalScrollBar: true
useIndex: true
sequenceList: listOfApplicationsInProject
)
(TextEditorSpec
name: 'TextEditor2'
model: selectedApplicationsComment
hasHorizontalScrollBar: true
hasVerticalScrollBar: true
isReadOnly: true
hasKeyboardFocusInitially: false
viewClassName: 'TextView'
)
)
)
handles: (Any 0.34560327198364 1.0)
)
)
)
)
(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
extent: (Point 180 22)
)
)
)
)
)
)
)
!
page4_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:#page4_specifyIncludedClasses
Tools::ProjectBuilderAssistantApplication new openInterface:#page4_specifyIncludedClasses
"
<resource: #canvas>
^
#(FullSpec
name: #'page4_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: doBrowseProject
extent: (Point 180 22)
)
(ActionButtonSpec
label: 'Update Contents (Scan)'
name: 'Button4'
translateLabel: true
model: doGenerateProjectContentsDefinition
extent: (Point 180 22)
)
)
)
)
)
)
)
!
page5_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:ProjectBuilderAssistantApplication andSelector:#page5_specifyBuildDirectorySpec
ProjectBuilderAssistantApplication new openInterface:#page5_specifyBuildDirectorySpec
"
<resource: #canvas>
^
#(FullSpec
name: #'page5_specifyBuildDirectorySpec'
window:
(WindowSpec
label: 'Project Selection'
name: 'Project Selection'
min: (Point 0 0)
bounds: (Rectangle 0 0 521 104)
)
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
)
)
)
)
)
)
)
!
page6_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:#page6_buildSpec
Tools::ProjectBuilderAssistantApplication new openInterface:#page6_buildSpec
"
<resource: #canvas>
^
#(FullSpec
name: #'page6_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: 'Start Make'
name: 'Button3'
translateLabel: true
model: doStartMake
enableChannel: startMakeButtonEnabled
extent: (Point 107 22)
)
(ActionButtonSpec
label: 'Stop Make'
name: 'Button4'
visibilityChannel: stopMakeButtonVisible
translateLabel: true
model: doStopMake
extent: (Point 107 22)
)
)
)
)
)
)
)
!
page7_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:#page7_deploySpec
Tools::ProjectBuilderAssistantApplication new openInterface:#page7_deploySpec
"
<resource: #canvas>
^
#(FullSpec
name: #'page7_deploySpec'
window:
(WindowSpec
label: 'Project Selection'
name: 'Project Selection'
min: (Point 0 0)
bounds: (Rectangle 0 0 521 472)
)
component:
(SpecCollection
collection: (
(FramedBoxSpec
label: 'Deploy Installation File'
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 0 1)
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
clientHolder: fileBrowserInstance
createNewApplication: true
createNewBuilder: true
)
)
)
)
)
)
)
! !
!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
].
Class packageQuerySignal answer:(selectedProjectDefinition package)
do:[
newAppClass := ApplicationModel
subclass:newAppName asSymbol
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Applications'.
CodeGeneratorTool createApplicationCodeFor:newAppClass.
].
self updateListOfApplicationsInProject
!
createNewProject
<resource: #uiCallback>
|newProjectID projectDefinitionType projectDefinitionClass projectClasses|
newProjectID := self newProjectsName value.
newProjectID isEmptyOrNil ifTrue:[
Dialog warn:'Please enter a packageID first.'.
^ self
].
projectDefinitionType := ProjectDefinition perform:(self projectType value).
projectDefinitionClass := ProjectDefinition
definitionClassForPackage:newProjectID
projectType: projectDefinitionType
createIfAbsent:true.
projectDefinitionClass compileDescriptionMethods.
self updateListOfMatchingProjects.
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:[
"/ ].
"/ ].
!
doAddClassToProject
<resource: #uiCallback>
Transcript showCR:self class name, ': action for doAddClassToProject ...'.
self halt.
!
doBrowseApplication
<resource: #uiCallback>
|appClass|
appClass := self listOfApplicationsInProject value at:(self selectedApplicationIndexHolder value).
UserPreferences systemBrowserClass openInClass:appClass.
!
doBrowseProject
<resource: #uiCallback>
UserPreferences systemBrowserClass openOnPackage:selectedProjectDefinition package.
!
doGenerateProjectContentsDefinition
self generatePackageContentsMethods
!
doStartMake
<resource: #uiCallback>
self stopMakeButtonVisible value:true.
self startMakeButtonEnabled value:false.
makeOutputWindow clear.
makeProcess :=
[
[
self runBuildProcess
] ensure:[
self stopMakeButtonVisible value:false.
self startMakeButtonEnabled value:true.
makeProcess := nil.
self updateButtonEnableState.
].
] 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' emphasizeAllWith:{#backgroundColor->Color red. #color->Color white.}).
makeOutputWindow endEntry.
].
!
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
!
projectTypeChanged
<resource: #uiCallback>
self updateListOfMatchingProjects
!
runBuildProcess
<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 emphasizeAllWith:{#backgroundColor->Color blue. #color->Color white.}).
makeOutputWindow endEntry.
].
ex proceed.
] do:[
projectBuilder := ProjectBuilder new.
projectBuilder package:(selectedProjectDefinition package).
projectBuilder buildWithColorizedOutputTo:makeOutputWindow.
].
!
selectedApplicationChanged
self selectedApplicationIndexHolder value isNil ifTrue:[
selectedApplication := nil.
] ifFalse:[
selectedApplication := self listOfApplicationsInProject value at:(self selectedApplicationIndexHolder value).
].
self updateApplicationComment.
self updateButtonEnableState.
!
selectedProjectChanged
self selectedProjectIndexHolder value isNil ifTrue:[
selectedProjectDefinition := nil.
] ifFalse:[
selectedProjectDefinition := self listOfMatchingProjects value at:(self selectedProjectIndexHolder value).
].
self updateComment.
self updateListOfApplicationsInProject.
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 := Tools::ProjectBuilder previousBuildDirectory.
buildDirectory isNil ifTrue:[
buildDirectory := UserPreferences current buildDirectory.
buildDirectory isNil ifTrue:[
buildDirectory := Filename tempDirectory construct:'stx_build'.
].
].
buildDirectoryHolder value: buildDirectory.
].
^ buildDirectoryHolder.
!
fileBrowserInstance
|targetDirectory browser|
targetDirectory := projectBuilder packageBuildDirectory.
browser := FileBrowserV2 new.
browser onDirectory:targetDirectory.
browser filter:'*setup*'.
^ browser.
!
hasBuildDirectorySpecified
^ self buildDirectoryHolder value notEmptyOrNil
!
hasProjectBuilder
^ projectBuilder notNil
!
hasProjectSelected
^ self selectedProjectIndexHolder value notNil
!
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.
!
listOfMatchingProjects
<resource: #uiAspect>
listOfMatchingProjects isNil ifTrue:[
listOfMatchingProjects := ValueHolder new.
].
^ listOfMatchingProjects.
!
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.
!
projectType
<resource: #uiAspect>
projectType isNil ifTrue:[
projectType := RadioButtonGroup new.
projectType value:#guiApplicationType.
].
^ projectType.
!
projectTypeIsNotLibrary
^ self projectType value ~~ #libraryType
!
selectedApplication
<resource: #uiAspect>
selectedApplication isNil ifTrue:[
selectedApplication := ValueHolder new.
selectedApplication onChangeSend:#selectedApplicationChanged to:self.
].
^ selectedApplication.
!
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.
!
startMakeButtonEnabled
<resource: #uiAspect>
startMakeButtonEnabled isNil ifTrue:[
startMakeButtonEnabled := true asValue.
].
^ startMakeButtonEnabled.
!
stopMakeButtonVisible
<resource: #uiAspect>
stopMakeButtonVisible isNil ifTrue:[
stopMakeButtonVisible := false asValue.
].
^ stopMakeButtonVisible.
! !
!ProjectBuilderAssistantApplication methodsFor:'initialization & release'!
postBuildMakeOutputWindow:aView
makeOutputWindow := aView
!
postBuildWith:aBuilder
super postBuildWith:aBuilder.
self updateListOfMatchingProjects.
Smalltalk addDependent:self.
!
release
Smalltalk removeDependent:self.
super release
! !
!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
! !
!ProjectBuilderAssistantApplication methodsFor:'specs'!
assistantSpec
^ #(Array
( AssistantPageSpec
pageTitle: 'Project Type Selection'
windowSpecSelector: page1_projectTypeSelectionSpec
enterCallbackSelector: updateListOfMatchingProjects
)
(AssistantPageSpec
pageTitle: 'Project Selection'
windowSpecSelector: page2_projectSelectionSpec
enterCallbackSelector: updateListOfMatchingProjects
)
(AssistantPageSpec
pageTitle: 'Application Selection'
windowSpecSelector: page3_applicationSelectionSpec
isEnabledQuerySelector: #projectTypeIsNotLibrary
canEnterQuerySelector: #hasProjectSelected
enterCallbackSelector: updateListOfApplicationsInProject
)
(AssistantPageSpec
pageTitle: 'Specify Contents'
windowSpecSelector: page4_specifyIncludedClasses
enterCallbackSelector: updateListOfClassesInProject
)
(AssistantPageSpec
pageTitle: 'Specify Build Directory'
windowSpecSelector: page5_specifyBuildDirectorySpec
)
(AssistantPageSpec
pageTitle: 'Build'
windowSpecSelector: page6_buildSpec
canEnterQuerySelector: #hasBuildDirectorySpecified
enterCallbackSelector: #restoreMakeOutputsContents
leaveCallbackSelector: #rememberMakeOutputsContents
)
(AssistantPageSpec
pageTitle: 'Deploy'
windowSpecSelector: page7_deploySpec
canEnterQuerySelector: #hasProjectBuilder
)
) decodeAsLiteralArray.
! !
!ProjectBuilderAssistantApplication methodsFor:'update'!
rememberMakeOutputsContents
makeOutputHolder value:(makeOutputWindow contents)
!
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.
].
^ 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
|applicationClasses package|
self selectedApplicationIndexHolder value:nil.
selectedProjectDefinition isNil ifTrue:[
applicationClasses := #()
] ifFalse:[
package := selectedProjectDefinition package.
applicationClasses := Smalltalk allClasses
select:[:cls |
(cls package = package
and:[ cls isSubclassOf:ApplicationModel ])
].
applicationClasses := applicationClasses asOrderedCollection.
applicationClasses sort:[:a :b | a name < b name].
].
self listOfApplicationsInProject value:applicationClasses
!
updateListOfClassesInProject
self listOfClassesInProject value:(selectedProjectDefinition classNames).
!
updateListOfMatchingProjects
|matching projectType idx|
projectType := self projectType value.
matching := ProjectDefinition allSubclasses
select:[:defClass |
|match|
match := false.
defClass isAbstract ifFalse:[
(self hideSTXProjects value not
or:[ defClass package asPackageId module ~= 'stx' ])
ifTrue:[
projectType == #libraryType ifTrue:[
match := defClass isLibraryDefinition
] ifFalse:[
projectType == #guiApplicationType ifTrue:[
match := defClass isGUIApplication
] ifFalse:[
projectType == #nonGuiApplicationType ifTrue:[
match := defClass isConsoleApplication
] ifFalse:[
self error.
].
].
].
].
].
].
matching sort:[:a :b | a name < b name].
self listOfMatchingProjects value:matching.
idx := matching indexOf:selectedProjectDefinition.
idx == 0 ifTrue:[
self selectedProjectIndexHolder value:nil.
] ifFalse:[
self selectedProjectIndexHolder value:idx.
].
! !
!ProjectBuilderAssistantApplication class methodsFor:'documentation'!
version_CVS
^ '$Header$'
! !