29
|
1 |
"{ Package: 'Programming Tools' }"
|
|
2 |
|
3
|
3 |
"
|
|
4 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
5 |
All Rights Reserved
|
|
6 |
|
|
7 |
This software is furnished under a license and may be used
|
|
8 |
only in accordance with the terms of that license and with the
|
|
9 |
inclusion of the above copyright notice. This software may not
|
|
10 |
be provided or otherwise made available to, or used by, any
|
|
11 |
other person. No title to or ownership of the software is
|
|
12 |
hereby transferred.
|
|
13 |
"
|
0
|
14 |
|
|
15 |
StandardSystemView subclass:#ProjectView
|
|
16 |
instanceVariableNames:'myProject toggle'
|
|
17 |
classVariableNames:'ActiveProjectView'
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Interface-Smalltalk'
|
|
20 |
!
|
|
21 |
|
|
22 |
!ProjectView class methodsFor:'instance creation'!
|
|
23 |
|
|
24 |
for:aProject
|
|
25 |
|newView|
|
|
26 |
|
|
27 |
newView := super new.
|
|
28 |
newView setProject:aProject.
|
|
29 |
^ newView
|
|
30 |
|
|
31 |
"ProjectView for:(Project new)"
|
|
32 |
! !
|
|
33 |
|
|
34 |
!ProjectView methodsFor:'private accessing'!
|
|
35 |
|
|
36 |
setProject:aProject
|
|
37 |
|name e|
|
|
38 |
|
|
39 |
name := aProject name.
|
|
40 |
self label:name.
|
17
|
41 |
self iconLabel:name.
|
0
|
42 |
toggle label:'Project: ' , name.
|
|
43 |
toggle resize.
|
|
44 |
myProject := aProject.
|
|
45 |
e := (toggle width @ toggle height).
|
29
|
46 |
drawableId isNil ifTrue:[
|
|
47 |
self minExtent:e.
|
|
48 |
self maxExtent:e.
|
37
|
49 |
self open
|
29
|
50 |
] ifFalse:[
|
|
51 |
self unrealize.
|
|
52 |
self minExtent:e.
|
|
53 |
self maxExtent:e.
|
|
54 |
self extent:e.
|
|
55 |
self rerealize
|
|
56 |
]
|
0
|
57 |
! !
|
|
58 |
|
|
59 |
!ProjectView methodsFor:'initialization'!
|
|
60 |
|
|
61 |
initialize
|
|
62 |
super initialize.
|
|
63 |
toggle := Toggle in:self.
|
|
64 |
toggle borderWidth:0.
|
|
65 |
toggle pressAction:[self showProject].
|
|
66 |
toggle releaseAction:[self hideProject].
|
|
67 |
toggle middleButtonMenu:(
|
|
68 |
PopUpMenu
|
29
|
69 |
labels:(resources array:
|
|
70 |
#('rename'
|
|
71 |
'changes'
|
|
72 |
'directory'
|
|
73 |
'properties'
|
|
74 |
'-'
|
|
75 |
"
|
|
76 |
'build'
|
|
77 |
'-'
|
|
78 |
"
|
|
79 |
'show'
|
|
80 |
'hide'
|
|
81 |
'-'
|
|
82 |
'destroy'
|
|
83 |
)
|
0
|
84 |
)
|
|
85 |
selectors:#(renameProject
|
29
|
86 |
browseChanges
|
|
87 |
projectDirectory
|
3
|
88 |
browseProps
|
0
|
89 |
nil
|
29
|
90 |
"
|
3
|
91 |
buildProject
|
0
|
92 |
nil
|
29
|
93 |
"
|
0
|
94 |
showProject
|
|
95 |
hideProject
|
|
96 |
nil
|
|
97 |
destroy
|
|
98 |
)
|
|
99 |
receiver:self
|
|
100 |
)
|
|
101 |
!
|
|
102 |
|
|
103 |
addToCurrentProject
|
|
104 |
"ignored here"
|
|
105 |
|
|
106 |
^ self
|
|
107 |
! !
|
|
108 |
|
|
109 |
!ProjectView methodsFor:'menu actions'!
|
|
110 |
|
29
|
111 |
projectDirectory
|
|
112 |
|box|
|
|
113 |
|
|
114 |
box := EnterBox new.
|
|
115 |
box title:'Directory of project:'.
|
|
116 |
myProject directory notNil ifTrue:[
|
|
117 |
box initialText:myProject directory
|
|
118 |
].
|
|
119 |
box action:[:dirName |
|
|
120 |
(OperatingSystem isDirectory:dirName) ifFalse:[
|
|
121 |
(OperatingSystem isValidPath:dirName) ifTrue:[
|
|
122 |
self warn:(resources string:'%1 is not a valid directory' with:dirName).
|
|
123 |
^ self
|
|
124 |
].
|
|
125 |
(self confirm:(resources string:'%1 does not exist\\create ?' with:dirName) withCRs) ifTrue:[
|
|
126 |
(OperatingSystem recursiveCreateDirectory:dirName) ifFalse:[
|
|
127 |
self warn:(resources string:'cannot create %1' with:dirName)
|
|
128 |
]
|
|
129 |
].
|
|
130 |
].
|
|
131 |
"did it work ?"
|
|
132 |
(OperatingSystem isDirectory:dirName) ifTrue:[
|
|
133 |
myProject directory:dirName
|
|
134 |
].
|
|
135 |
].
|
|
136 |
box showAtPointer
|
|
137 |
!
|
|
138 |
|
3
|
139 |
buildProject
|
9
|
140 |
(self confirm:'create files in: ' , myProject directory) ifTrue:[
|
|
141 |
myProject createProjectFiles.
|
|
142 |
(self confirm:'starting make in: ' , myProject directory) ifTrue:[
|
|
143 |
myProject buildProject.
|
|
144 |
].
|
|
145 |
].
|
3
|
146 |
!
|
|
147 |
|
0
|
148 |
browseChanges
|
|
149 |
ChangeSetBrowser startOn:(myProject changeSet)
|
|
150 |
!
|
|
151 |
|
3
|
152 |
browseProps
|
9
|
153 |
"will look better, once property inspector runs ..."
|
3
|
154 |
|
9
|
155 |
myProject properties inspect
|
3
|
156 |
!
|
|
157 |
|
0
|
158 |
destroyProject
|
|
159 |
|box|
|
|
160 |
|
|
161 |
box := YesNoBox new.
|
|
162 |
box title:'Destroying a project will discard all changes made
|
|
163 |
for that project and destroy all views opened for it.
|
|
164 |
|
|
165 |
Do you really want to do this ?'.
|
|
166 |
box okText:'yes'.
|
|
167 |
box yesAction:[
|
|
168 |
self doDestroyProject
|
|
169 |
].
|
|
170 |
box showAtPointer
|
|
171 |
!
|
|
172 |
|
|
173 |
showProject
|
|
174 |
ActiveProjectView notNil ifTrue:[
|
|
175 |
ActiveProjectView hideProject
|
|
176 |
].
|
|
177 |
ActiveProjectView := self.
|
|
178 |
|
9
|
179 |
myProject showViews.
|
0
|
180 |
Project current:myProject.
|
|
181 |
toggle turnOn
|
|
182 |
!
|
|
183 |
|
|
184 |
hideProject
|
9
|
185 |
myProject hideViews.
|
0
|
186 |
ActiveProjectView := nil.
|
|
187 |
toggle turnOff
|
|
188 |
!
|
|
189 |
|
|
190 |
renameProject
|
|
191 |
|box|
|
|
192 |
|
|
193 |
box := EnterBox new.
|
|
194 |
box title:'new name of project:'.
|
|
195 |
box okText:'rename'.
|
|
196 |
box initialText:(myProject name).
|
|
197 |
box action:[:newName |
|
|
198 |
myProject name:newName.
|
|
199 |
self setProject:myProject
|
|
200 |
].
|
|
201 |
box showAtPointer
|
|
202 |
!
|
|
203 |
|
|
204 |
doDestroy
|
|
205 |
self hideProject.
|
|
206 |
|
|
207 |
myProject := nil.
|
|
208 |
super destroy
|
|
209 |
!
|
|
210 |
|
|
211 |
destroy
|
|
212 |
|box|
|
|
213 |
|
|
214 |
box := YesNoBox new.
|
|
215 |
box title:'Destroying a project will discard all changes made
|
|
216 |
for that project and destroy all views opened for it.
|
|
217 |
|
|
218 |
Do you really want to do this ?'.
|
|
219 |
box okText:'yes'.
|
|
220 |
box yesAction:[
|
|
221 |
self doDestroy
|
|
222 |
].
|
|
223 |
box showAtPointer
|
|
224 |
! !
|