7926
|
1 |
"
|
10034
|
2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
|
|
3 |
Copyright (c) 2009-2010 eXept Software AG
|
7926
|
4 |
|
10034
|
5 |
Permission is hereby granted, free of charge, to any person
|
|
6 |
obtaining a copy of this software and associated documentation
|
|
7 |
files (the 'Software'), to deal in the Software without
|
|
8 |
restriction, including without limitation the rights to use,
|
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10 |
copies of the Software, and to permit persons to whom the
|
|
11 |
Software is furnished to do so, subject to the following
|
|
12 |
conditions:
|
|
13 |
|
|
14 |
The above copyright notice and this permission notice shall be
|
|
15 |
included in all copies or substantial portions of the Software.
|
|
16 |
|
|
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24 |
OTHER DEALINGS IN THE SOFTWARE.
|
7926
|
25 |
"
|
6660
|
26 |
"{ Package: 'stx:libtool' }"
|
|
27 |
|
|
28 |
"{ NameSpace: Tools }"
|
|
29 |
|
|
30 |
Object subclass:#MethodCategoryCache
|
|
31 |
instanceVariableNames:'cachedMethodCategories lock'
|
|
32 |
classVariableNames:'TheOneAndOnlyCache'
|
|
33 |
poolDictionaries:''
|
|
34 |
category:'Interface-Browsers-New'
|
|
35 |
!
|
|
36 |
|
7926
|
37 |
!MethodCategoryCache class methodsFor:'documentation'!
|
|
38 |
|
|
39 |
copyright
|
|
40 |
"
|
10034
|
41 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
|
|
42 |
Copyright (c) 2009-2010 eXept Software AG
|
|
43 |
|
|
44 |
Permission is hereby granted, free of charge, to any person
|
|
45 |
obtaining a copy of this software and associated documentation
|
|
46 |
files (the 'Software'), to deal in the Software without
|
|
47 |
restriction, including without limitation the rights to use,
|
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
49 |
copies of the Software, and to permit persons to whom the
|
|
50 |
Software is furnished to do so, subject to the following
|
|
51 |
conditions:
|
7926
|
52 |
|
10034
|
53 |
The above copyright notice and this permission notice shall be
|
|
54 |
included in all copies or substantial portions of the Software.
|
|
55 |
|
|
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
63 |
OTHER DEALINGS IN THE SOFTWARE.
|
7926
|
64 |
"
|
|
65 |
! !
|
6660
|
66 |
|
|
67 |
!MethodCategoryCache class methodsFor:'instance creation'!
|
|
68 |
|
|
69 |
new
|
|
70 |
TheOneAndOnlyCache isNil ifTrue:[
|
|
71 |
TheOneAndOnlyCache := self basicNew initialize.
|
|
72 |
].
|
|
73 |
^ TheOneAndOnlyCache
|
|
74 |
! !
|
|
75 |
|
|
76 |
!MethodCategoryCache methodsFor:'accessing'!
|
|
77 |
|
|
78 |
allMethodCategories
|
|
79 |
cachedMethodCategories isNil ifTrue:[
|
|
80 |
self updateCachedMethodCategories
|
|
81 |
].
|
|
82 |
^ cachedMethodCategories
|
|
83 |
!
|
|
84 |
|
|
85 |
updateCachedMethodCategories
|
|
86 |
lock critical:[
|
|
87 |
cachedMethodCategories := Set new.
|
|
88 |
Smalltalk allBehaviorsDo:[:eachClass |
|
17563
|
89 |
cachedMethodCategories addAll:eachClass methodCategories
|
6660
|
90 |
].
|
|
91 |
].
|
17563
|
92 |
|
|
93 |
"Modified: / 05-07-2017 / 09:31:55 / cg"
|
6660
|
94 |
! !
|
|
95 |
|
|
96 |
!MethodCategoryCache methodsFor:'change & update'!
|
|
97 |
|
|
98 |
update:something with:aParameter from:changedObject
|
|
99 |
|removed|
|
|
100 |
|
|
101 |
changedObject == Smalltalk ifTrue:[
|
|
102 |
something == #methodInClassRemoved ifTrue:[
|
|
103 |
cachedMethodCategories := nil.
|
|
104 |
^ self.
|
|
105 |
].
|
|
106 |
(something == #classOrganization) ifTrue:[
|
|
107 |
cachedMethodCategories := nil.
|
|
108 |
^ self.
|
|
109 |
].
|
|
110 |
(something == #methodCategoryAdded) ifTrue:[
|
7991
|
111 |
cachedMethodCategories notNil ifTrue:[
|
|
112 |
cachedMethodCategories add:(aParameter second).
|
|
113 |
].
|
6660
|
114 |
^ self.
|
|
115 |
].
|
|
116 |
(something == #methodCategoryRemoved) ifTrue:[
|
|
117 |
cachedMethodCategories := nil.
|
|
118 |
^ self.
|
|
119 |
].
|
|
120 |
(something == #methodCategoriesRemoved) ifTrue:[
|
7991
|
121 |
cachedMethodCategories := nil.
|
|
122 |
"/ removed := aParameter second asSet.
|
|
123 |
"/ Smalltalk allMethodsDo:[:m |
|
|
124 |
"/ |mCat|
|
|
125 |
"/ mCat := m category.
|
|
126 |
"/ (removed includes:mCat) ifTrue:[
|
|
127 |
"/ removed remove:mCat.
|
|
128 |
"/ removed isEmpty ifTrue:[^ self ].
|
|
129 |
"/ ].
|
|
130 |
"/ ].
|
|
131 |
"/ cachedMethodCategories removeAll:removed.
|
6660
|
132 |
^ self.
|
|
133 |
].
|
|
134 |
(something == #methodCategoryRenamed) ifTrue:[
|
|
135 |
cachedMethodCategories := nil.
|
|
136 |
^ self.
|
|
137 |
].
|
|
138 |
something == #methodInClass ifTrue:[
|
|
139 |
^ self.
|
|
140 |
].
|
|
141 |
^ self.
|
|
142 |
].
|
|
143 |
super update:something with:aParameter from:changedObject
|
|
144 |
! !
|
|
145 |
|
|
146 |
!MethodCategoryCache methodsFor:'initialization'!
|
|
147 |
|
|
148 |
initialize
|
|
149 |
lock := Semaphore forMutualExclusion.
|
|
150 |
Smalltalk addDependent:self.
|
|
151 |
! !
|
|
152 |
|
|
153 |
!MethodCategoryCache class methodsFor:'documentation'!
|
|
154 |
|
10034
|
155 |
version_CVS
|
17563
|
156 |
^ '$Header$'
|
10034
|
157 |
!
|
|
158 |
|
|
159 |
version_SVN
|
17563
|
160 |
^ '$Id$'
|
6660
|
161 |
! !
|
17563
|
162 |
|