1557
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
3 |
|
|
4 |
New code and modifications done at SWING Research Group [1]:
|
|
5 |
|
|
6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
7 |
SWING Research Group, Czech Technical University in Prague
|
|
8 |
|
|
9 |
This software is furnished under a license and may be used
|
|
10 |
only in accordance with the terms of that license and with the
|
|
11 |
inclusion of the above copyright notice. This software may not
|
|
12 |
be provided or otherwise made available to, or used by, any
|
|
13 |
other person. No title to or ownership of the software is
|
|
14 |
hereby transferred.
|
|
15 |
|
|
16 |
[1] Code written at SWING Research Group contains a signature
|
|
17 |
of one of the above copright owners. For exact set of such code,
|
|
18 |
see the differences between this version and version stx:libjava
|
|
19 |
as of 1.9.2010
|
|
20 |
"
|
|
21 |
"{ Package: 'stx:libjava' }"
|
|
22 |
|
|
23 |
Object subclass:#JavaPathElement
|
1591
|
24 |
instanceVariableNames:'name pathName enabled origin'
|
1557
|
25 |
classVariableNames:'OriginRelease OriginEnvironment OriginPackage OriginUser'
|
|
26 |
poolDictionaries:''
|
|
27 |
category:'Languages-Java-Support'
|
|
28 |
!
|
|
29 |
|
|
30 |
!JavaPathElement class methodsFor:'documentation'!
|
|
31 |
|
|
32 |
copyright
|
|
33 |
"
|
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
35 |
|
|
36 |
New code and modifications done at SWING Research Group [1]:
|
|
37 |
|
|
38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
39 |
SWING Research Group, Czech Technical University in Prague
|
|
40 |
|
|
41 |
This software is furnished under a license and may be used
|
|
42 |
only in accordance with the terms of that license and with the
|
|
43 |
inclusion of the above copyright notice. This software may not
|
|
44 |
be provided or otherwise made available to, or used by, any
|
|
45 |
other person. No title to or ownership of the software is
|
|
46 |
hereby transferred.
|
|
47 |
|
|
48 |
[1] Code written at SWING Research Group contains a signature
|
|
49 |
of one of the above copright owners. For exact set of such code,
|
|
50 |
see the differences between this version and version stx:libjava
|
|
51 |
as of 1.9.2010
|
|
52 |
|
|
53 |
"
|
|
54 |
!
|
|
55 |
|
|
56 |
documentation
|
|
57 |
"
|
|
58 |
JavaPathElement represents a single element in 'java paths' (Java classPath and
|
|
59 |
Java sourcePath). The aim is to support easy configuration of libjava and storing
|
|
60 |
paths in preferences.
|
|
61 |
|
|
62 |
[author:]
|
|
63 |
Jan Vrany <jan.vrany@fit.cvut.cz>
|
|
64 |
|
|
65 |
[instance variables:]
|
1591
|
66 |
name ...... human-readable name of the entry - displayed by the UI
|
1557
|
67 |
pathName .. path to the file/directory the element represents
|
|
68 |
enable .... whether the elements should be used or not (allows for
|
|
69 |
keeping path elements in prefs but not using them)
|
|
70 |
origin .... one of #jdk #package or #user
|
|
71 |
#release... this element is part of java release (such as rt.jar)
|
|
72 |
#env ...... this element comes from environment (CLASSPATH)
|
|
73 |
#package .. this element was defined by some smalltalk package
|
|
74 |
that uses libjava (see ProjectDefinition>>javaClassPath/javaSourcePath)
|
|
75 |
#user ..... user-defined element (only thise are stored in preferences
|
|
76 |
|
|
77 |
[class variables:]
|
|
78 |
|
|
79 |
[see also:]
|
|
80 |
|
|
81 |
"
|
|
82 |
! !
|
|
83 |
|
|
84 |
!JavaPathElement class methodsFor:'initialization'!
|
|
85 |
|
|
86 |
initialize
|
|
87 |
"Invoked at system start or when the class is dynamically loaded."
|
|
88 |
|
|
89 |
"/ please change as required (and remove this comment)
|
|
90 |
|
|
91 |
OriginRelease := #release.
|
|
92 |
OriginEnvironment := #environment.
|
|
93 |
OriginPackage := #package.
|
|
94 |
OriginUser := #user.
|
|
95 |
|
|
96 |
"Modified: / 27-07-2012 / 11:51:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
97 |
! !
|
|
98 |
|
|
99 |
!JavaPathElement class methodsFor:'accessing-constants'!
|
|
100 |
|
|
101 |
originEnvironment
|
|
102 |
^OriginEnvironment
|
|
103 |
|
|
104 |
"Created: / 27-07-2012 / 11:51:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
105 |
!
|
|
106 |
|
|
107 |
originPackage
|
|
108 |
^OriginPackage
|
|
109 |
|
|
110 |
"Created: / 27-07-2012 / 11:51:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
111 |
!
|
|
112 |
|
|
113 |
originRelease
|
|
114 |
^OriginRelease
|
|
115 |
|
|
116 |
"Created: / 27-07-2012 / 11:51:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
117 |
!
|
|
118 |
|
|
119 |
originUser
|
|
120 |
^OriginUser
|
|
121 |
|
|
122 |
"Created: / 27-07-2012 / 11:51:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
123 |
! !
|
|
124 |
|
|
125 |
!JavaPathElement class methodsFor:'instance'!
|
|
126 |
|
|
127 |
new: pathName
|
|
128 |
^self new: pathName origin: OriginUser
|
|
129 |
|
|
130 |
"Created: / 27-07-2012 / 11:42:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
131 |
!
|
|
132 |
|
|
133 |
new: pathName origin: origin
|
|
134 |
^self new
|
|
135 |
pathName: pathName;
|
|
136 |
origin: origin;
|
|
137 |
yourself
|
|
138 |
|
|
139 |
"Created: / 27-07-2012 / 11:42:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
140 |
!
|
|
141 |
|
1591
|
142 |
new: pathName origin: origin name: name
|
|
143 |
^self new
|
|
144 |
pathName: pathName;
|
|
145 |
origin: origin;
|
|
146 |
name: name;
|
|
147 |
yourself
|
|
148 |
|
|
149 |
"Created: / 10-08-2012 / 19:07:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
150 |
!
|
|
151 |
|
1557
|
152 |
newFromEnvironment: pathName
|
|
153 |
^self new: pathName origin: OriginEnvironment
|
|
154 |
|
|
155 |
"Created: / 27-07-2012 / 11:43:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
156 |
!
|
|
157 |
|
|
158 |
newFromPackage: pathName
|
|
159 |
^self new: pathName origin: OriginPackage
|
|
160 |
|
|
161 |
"Created: / 27-07-2012 / 11:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
162 |
!
|
|
163 |
|
|
164 |
newFromRelease:pathName
|
|
165 |
^ self new:pathName origin: OriginRelease
|
|
166 |
|
|
167 |
"Created: / 27-07-2012 / 11:43:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
168 |
!
|
|
169 |
|
|
170 |
newFromUser: pathName
|
|
171 |
^self new: pathName origin: OriginUser
|
|
172 |
|
|
173 |
"Created: / 27-07-2012 / 11:43:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
174 |
! !
|
|
175 |
|
|
176 |
!JavaPathElement methodsFor:'accessing'!
|
|
177 |
|
|
178 |
enabled
|
|
179 |
^ enabled ? true "/ enabled by default
|
|
180 |
|
|
181 |
"Modified (comment): / 27-07-2012 / 11:26:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
182 |
!
|
|
183 |
|
|
184 |
enabled:aBoolean
|
|
185 |
enabled := aBoolean.
|
|
186 |
!
|
|
187 |
|
1591
|
188 |
name
|
|
189 |
^ name notNil ifTrue:[name] ifFalse:[self nameDefault]
|
|
190 |
|
|
191 |
"Modified: / 10-08-2012 / 19:21:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
192 |
!
|
|
193 |
|
|
194 |
name:aString
|
|
195 |
name := aString.
|
|
196 |
!
|
|
197 |
|
|
198 |
nameDefault
|
|
199 |
^ pathName ? '???'
|
|
200 |
"/ pathName isNil ifTrue:[ ^ '???' ].
|
|
201 |
"/ ^ pathName asFilename baseName
|
|
202 |
|
|
203 |
"Created: / 10-08-2012 / 19:02:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
204 |
!
|
|
205 |
|
1595
|
206 |
nameOrNil
|
|
207 |
^ name
|
|
208 |
|
|
209 |
"Created: / 13-08-2012 / 22:50:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
210 |
!
|
|
211 |
|
1557
|
212 |
origin
|
|
213 |
^ origin
|
|
214 |
!
|
|
215 |
|
|
216 |
origin: newOrigin
|
|
217 |
self assert: origin isNil description: 'Trying to set origin twice'.
|
|
218 |
self assert: (newOrigin == OriginRelease
|
|
219 |
or:[newOrigin == OriginEnvironment
|
|
220 |
or:[newOrigin == OriginPackage
|
|
221 |
or:[newOrigin == OriginUser]]]) description:'Unknown/Unssuported path element origin ' , newOrigin printString.
|
|
222 |
|
|
223 |
origin := newOrigin.
|
|
224 |
|
|
225 |
"Modified: / 27-07-2012 / 12:17:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
226 |
!
|
|
227 |
|
|
228 |
pathName
|
|
229 |
^ pathName
|
|
230 |
!
|
|
231 |
|
|
232 |
pathName:aString
|
1591
|
233 |
"/ self assert: pathName isNil description: 'Trying to set pathName twice'.
|
1557
|
234 |
pathName := aString.
|
|
235 |
|
1591
|
236 |
"Modified: / 10-08-2012 / 19:14:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
1557
|
237 |
! !
|
|
238 |
|
1585
|
239 |
!JavaPathElement methodsFor:'comparing'!
|
|
240 |
|
|
241 |
= another
|
|
242 |
|
1595
|
243 |
^another class == self class
|
|
244 |
and:[self nameOrNil = another nameOrNil
|
1591
|
245 |
and:[ pathName = another pathName
|
|
246 |
and:[self enabled = another enabled
|
|
247 |
and:[origin = another origin]]]]
|
1585
|
248 |
|
|
249 |
"Created: / 02-08-2012 / 09:50:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
250 |
!
|
|
251 |
|
|
252 |
hash
|
1591
|
253 |
^name hash bitXor:(pathName hash bitXor:(enabled hash bitXor: origin hash))
|
1585
|
254 |
|
|
255 |
"Created: / 02-08-2012 / 09:49:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
256 |
! !
|
|
257 |
|
1557
|
258 |
!JavaPathElement methodsFor:'conversion'!
|
|
259 |
|
|
260 |
asFilename
|
|
261 |
^pathName asFilename
|
|
262 |
|
|
263 |
"Created: / 27-07-2012 / 11:26:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
264 |
!
|
|
265 |
|
|
266 |
asString
|
|
267 |
^pathName
|
|
268 |
|
|
269 |
"Created: / 27-07-2012 / 11:27:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
270 |
! !
|
|
271 |
|
|
272 |
!JavaPathElement methodsFor:'printing & storing'!
|
|
273 |
|
|
274 |
printOn:aStream
|
|
275 |
"append a printed representation if the receiver to the argument, aStream"
|
|
276 |
|
|
277 |
self enabled ifTrue:[
|
|
278 |
aStream nextPutAll:'[X] '
|
|
279 |
] ifFalse:[
|
|
280 |
aStream nextPutAll:'[ ] '
|
|
281 |
].
|
|
282 |
pathName printOn:aStream.
|
|
283 |
aStream space; nextPut:${.
|
|
284 |
origin printOn:aStream.
|
|
285 |
aStream nextPut:$}.
|
|
286 |
|
|
287 |
"Modified: / 27-07-2012 / 12:25:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
288 |
! !
|
|
289 |
|
|
290 |
!JavaPathElement class methodsFor:'documentation'!
|
|
291 |
|
1864
|
292 |
version_HG
|
|
293 |
|
|
294 |
^ '$Changeset: <not expanded> $'
|
|
295 |
!
|
|
296 |
|
1557
|
297 |
version_SVN
|
1864
|
298 |
^ '§Id:: §'
|
1557
|
299 |
! !
|
|
300 |
|
|
301 |
JavaPathElement initialize!
|