author | vranyj1 |
Sun, 04 Dec 2011 12:44:23 +0000 | |
branch | jk_new_structure |
changeset 1209 | 953b9d7c328a |
parent 1156 | 23474d7edbe1 |
child 1390 | 4a623c4ec05f |
permissions | -rw-r--r-- |
894 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
894 | 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 |
||
1155 | 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 |
|
1152 | 19 |
as of 1.9.2010 |
894 | 20 |
" |
1156
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
21 |
"{ Package: 'stx:libjava' }" |
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
22 |
|
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
23 |
NameSpace subclass:#JavaPackage |
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
24 |
instanceVariableNames:'' |
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
25 |
classVariableNames:'' |
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
26 |
poolDictionaries:'' |
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
27 |
category:'Languages-Java-Support' |
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
28 |
! |
894 | 29 |
|
30 |
!JavaPackage class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 35 |
|
1155 | 36 |
New code and modifications done at SWING Research Group [1]: |
1152 | 37 |
|
894 | 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 |
||
1155 | 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 |
|
1152 | 51 |
as of 1.9.2010 |
894 | 52 |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
1209 | 56 |
!JavaPackage class methodsFor:'instance creation'! |
57 |
||
58 |
fullName:aFullNameSpacePathName |
|
59 |
"given a possibly nested name of a namespace, create all required |
|
60 |
intermediate spaces (if not already existing) and return the |
|
61 |
bottom-level space." |
|
62 |
||
63 |
"/ break it up, check for all intermediate spaces to exist |
|
64 |
"/ create them as required. |
|
65 |
||
66 |
|list thisNamespace| |
|
67 |
||
68 |
(aFullNameSpacePathName includes:$:) ifTrue:[ |
|
69 |
"/ old style |
|
70 |
list := aFullNameSpacePathName asCollectionOfSubstringsSeparatedByAll:'::'. |
|
71 |
] ifFalse:[ |
|
72 |
"/ new style |
|
73 |
list := aFullNameSpacePathName asCollectionOfSubstringsSeparatedBy:$.. |
|
74 |
]. |
|
75 |
||
76 |
"/ now, look and create 'em |
|
77 |
||
78 |
thisNamespace := nil. |
|
79 |
list do:[:aName | |
|
80 |
|key x| |
|
81 |
||
82 |
key := aName asSymbol. |
|
83 |
||
84 |
thisNamespace isNil ifTrue:[ |
|
85 |
(Smalltalk includesKey:key) ifTrue:[ |
|
86 |
thisNamespace := Smalltalk at:key. |
|
87 |
(thisNamespace notNil |
|
88 |
and:[thisNamespace isBehavior not]) ifTrue:[ |
|
89 |
self error:'name conflict: namespace ' , aName , ' vs. global'. |
|
90 |
] |
|
91 |
]. |
|
92 |
thisNamespace isNil ifTrue:[ |
|
93 |
key == #JAVA ifTrue:[ |
|
94 |
thisNamespace := NameSpace name: #JAVA. |
|
95 |
] ifFalse:[ |
|
96 |
self breakPoint: #jv. |
|
97 |
thisNamespace := self name:key |
|
98 |
]. |
|
99 |
]. |
|
100 |
] ifFalse:[ |
|
101 |
thisNamespace isNameSpace ifTrue:[ |
|
102 |
x := thisNamespace at:key. |
|
103 |
] ifFalse:[ |
|
104 |
thisNamespace isBehavior ifTrue:[ |
|
105 |
x := thisNamespace privateClassesAt:key. |
|
106 |
]. |
|
107 |
]. |
|
108 |
x isNil ifTrue:[ |
|
109 |
x := |
|
110 |
self subclass:key |
|
111 |
instanceVariableNames:'' |
|
112 |
classVariableNames:'' |
|
113 |
poolDictionaries:'' |
|
114 |
privateIn:thisNamespace. |
|
115 |
"/ nameSpaces are not in any package (yet) |
|
116 |
x setPackage:nil. |
|
117 |
]. |
|
118 |
thisNamespace := x. |
|
119 |
]. |
|
120 |
]. |
|
121 |
||
122 |
^ thisNamespace |
|
123 |
||
124 |
"Created: / 08-11-1996 / 13:41:59 / cg" |
|
125 |
"Modified: / 04-01-1997 / 16:50:59 / cg" |
|
126 |
"Modified: / 04-12-2011 / 12:15:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
127 |
! ! |
|
128 |
||
1156
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
129 |
!JavaPackage class methodsFor:'fileOut'! |
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
130 |
|
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
131 |
fileOutDefinitionOn:aStream |
1209 | 132 |
"redefined to generate another definition message" |
133 |
||
134 |
self == JavaPackage ifTrue:[ |
|
135 |
self basicFileOutDefinitionOn: aStream withNameSpace: false. |
|
136 |
] ifFalse:[ |
|
137 |
aStream nextPutAll:('JavaPackage name:' , self name storeString) |
|
138 |
]. |
|
1156
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
139 |
|
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
140 |
"Created: / 24-03-2009 / 15:56:17 / karpij1 <karpij1@fel.cvut.cz>" |
1209 | 141 |
"Modified: / 04-12-2011 / 12:19:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1156
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
142 |
! ! |
23474d7edbe1
JavaPackage: added fileOutDefinitionOn: so it is fileouted correctly
vranyj1
parents:
1155
diff
changeset
|
143 |
|
894 | 144 |
!JavaPackage class methodsFor:'queries'! |
145 |
||
1209 | 146 |
isJavaPackage |
147 |
"Anser true, if receiver is a java package. My subclasses are java packages" |
|
148 |
||
149 |
^self ~~ JavaPackage |
|
150 |
||
151 |
"Created: / 04-12-2011 / 12:22:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
152 |
! |
|
153 |
||
894 | 154 |
isNameSpace |
155 |
"return true, if the receiver is a nameSpace. |
|
156 |
Unconditionally true here for subclasses - my subclasses are namespaces" |
|
157 |
||
158 |
^ self ~~ JavaPackage . |
|
159 |
! |
|
160 |
||
161 |
isRealNameSpace |
|
162 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class). |
|
163 |
Unconditionally true here for subclasses - my subclasses are namespaces" |
|
164 |
||
165 |
^ self ~~ JavaPackage . |
|
166 |
! ! |
|
167 |
||
168 |
!JavaPackage class methodsFor:'documentation'! |
|
169 |
||
170 |
version_SVN |
|
171 |
^ '$Id$' |
|
172 |
! ! |