"
COPYRIGHT (c) 1993 by Claus Gittinger
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.
"
StandardSystemView subclass:#ProjectView
instanceVariableNames:'myProject toggle'
classVariableNames:'ActiveProjectView'
poolDictionaries:''
category:'Interface-Smalltalk'
!
!ProjectView class methodsFor:'instance creation'!
for:aProject
|newView|
newView := super new.
newView setProject:aProject.
^ newView
"ProjectView for:(Project new)"
! !
!ProjectView methodsFor:'private accessing'!
setProject:aProject
|name e|
name := aProject name.
self label:name.
self iconLabel:name.
toggle label:'Project: ' , name.
toggle resize.
myProject := aProject.
e := (toggle width @ toggle height).
drawableId isNil ifTrue:[
self minExtent:e.
self maxExtent:e.
self open
] ifFalse:[
self unrealize.
self minExtent:e.
self maxExtent:e.
self extent:e.
self rerealize
]
! !
!ProjectView methodsFor:'initialization'!
initialize
super initialize.
toggle := Toggle in:self.
toggle borderWidth:0.
toggle pressAction:[self showProject].
toggle releaseAction:[self hideProject].
toggle middleButtonMenu:(
PopUpMenu
labels:(resources array:
#('rename'
'changes'
'directory'
'properties'
'-'
"
'build'
'-'
"
'show'
'hide'
'-'
'destroy'
)
)
selectors:#(renameProject
browseChanges
projectDirectory
browseProps
nil
"
buildProject
nil
"
showProject
hideProject
nil
destroy
)
receiver:self
)
!
addToCurrentProject
"ignored here"
^ self
! !
!ProjectView methodsFor:'menu actions'!
projectDirectory
|box|
box := FilenameEnterBox new.
box title:'Directory of project:'.
myProject directory notNil ifTrue:[
box initialText:myProject directory
].
box action:[:dirName |
(OperatingSystem isDirectory:dirName) ifFalse:[
(OperatingSystem isValidPath:dirName) ifTrue:[
self warn:(resources string:'%1 is not a valid directory' with:dirName).
^ self
].
(self confirm:(resources string:'%1 does not exist\\create ?' with:dirName) withCRs) ifTrue:[
(OperatingSystem recursiveCreateDirectory:dirName) ifFalse:[
self warn:(resources string:'cannot create %1' with:dirName)
]
].
].
"did it work ?"
(OperatingSystem isDirectory:dirName) ifTrue:[
myProject directory:dirName
].
].
box showAtPointer
!
buildProject
(self confirm:'create files in: ' , myProject directory) ifTrue:[
myProject createProjectFiles.
(self confirm:'starting make in: ' , myProject directory) ifTrue:[
myProject buildProject.
].
].
!
browseChanges
ChangeSetBrowser openOn:(myProject changeSet)
!
browseProps
"will look better, once property inspector runs ..."
myProject properties inspect
!
destroyProject
|box|
box := YesNoBox new.
box title:'Destroying a project will discard all changes made
for that project and destroy all views opened for it.
Do you really want to do this ?'.
box okText:'yes'.
box yesAction:[
self doDestroyProject
].
box showAtPointer
!
showProject
ActiveProjectView notNil ifTrue:[
ActiveProjectView hideProject
].
ActiveProjectView := self.
myProject showViews.
Project current:myProject.
toggle turnOn
!
hideProject
myProject hideViews.
ActiveProjectView := nil.
toggle turnOff
!
renameProject
|box|
box := EnterBox new.
box title:'new name of project:'.
box okText:'rename'.
box initialText:(myProject name).
box action:[:newName |
myProject name:newName.
self setProject:myProject
].
box showAtPointer
!
doDestroy
self hideProject.
myProject := nil.
super destroy
!
destroy
(myProject views notNil
and:[myProject views notEmpty]) ifTrue:[
|box|
box := YesNoBox new.
box title:'Destroying a project will discard all changes made
for that project and destroy all views opened for it.
Do you really want to do this ?'.
box okText:'yes'.
(box confirm) ifFalse:[^ self]
].
self doDestroy
! !