author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 19 Jul 2017 09:42:32 +0200 | |
branch | jv |
changeset 17619 | edb119820fcb |
parent 12431 | 9f0c59c742d5 |
child 18532 | cccb41254edf |
permissions | -rw-r--r-- |
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 | |
|
89 |
cachedMethodCategories addAll:eachClass categories |
|
90 |
]. |
|
91 |
]. |
|
92 |
! ! |
|
93 |
||
94 |
!MethodCategoryCache methodsFor:'change & update'! |
|
95 |
||
96 |
update:something with:aParameter from:changedObject |
|
97 |
|removed| |
|
98 |
||
99 |
changedObject == Smalltalk ifTrue:[ |
|
100 |
something == #methodInClassRemoved ifTrue:[ |
|
101 |
cachedMethodCategories := nil. |
|
102 |
^ self. |
|
103 |
]. |
|
104 |
(something == #classOrganization) ifTrue:[ |
|
105 |
cachedMethodCategories := nil. |
|
106 |
^ self. |
|
107 |
]. |
|
108 |
(something == #methodCategoryAdded) ifTrue:[ |
|
7991 | 109 |
cachedMethodCategories notNil ifTrue:[ |
110 |
cachedMethodCategories add:(aParameter second). |
|
111 |
]. |
|
6660 | 112 |
^ self. |
113 |
]. |
|
114 |
(something == #methodCategoryRemoved) ifTrue:[ |
|
115 |
cachedMethodCategories := nil. |
|
116 |
^ self. |
|
117 |
]. |
|
118 |
(something == #methodCategoriesRemoved) ifTrue:[ |
|
7991 | 119 |
cachedMethodCategories := nil. |
120 |
"/ removed := aParameter second asSet. |
|
121 |
"/ Smalltalk allMethodsDo:[:m | |
|
122 |
"/ |mCat| |
|
123 |
"/ mCat := m category. |
|
124 |
"/ (removed includes:mCat) ifTrue:[ |
|
125 |
"/ removed remove:mCat. |
|
126 |
"/ removed isEmpty ifTrue:[^ self ]. |
|
127 |
"/ ]. |
|
128 |
"/ ]. |
|
129 |
"/ cachedMethodCategories removeAll:removed. |
|
6660 | 130 |
^ self. |
131 |
]. |
|
132 |
(something == #methodCategoryRenamed) ifTrue:[ |
|
133 |
cachedMethodCategories := nil. |
|
134 |
^ self. |
|
135 |
]. |
|
136 |
something == #methodInClass ifTrue:[ |
|
137 |
^ self. |
|
138 |
]. |
|
139 |
^ self. |
|
140 |
]. |
|
141 |
super update:something with:aParameter from:changedObject |
|
142 |
! ! |
|
143 |
||
144 |
!MethodCategoryCache methodsFor:'initialization'! |
|
145 |
||
146 |
initialize |
|
147 |
lock := Semaphore forMutualExclusion. |
|
148 |
Smalltalk addDependent:self. |
|
149 |
! ! |
|
150 |
||
151 |
!MethodCategoryCache class methodsFor:'documentation'! |
|
152 |
||
10034 | 153 |
version_CVS |
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10034
diff
changeset
|
154 |
^ '§Header: /cvs/stx/stx/libtool/Tools__MethodCategoryCache.st,v 1.4 2011/07/03 13:33:26 cg Exp §' |
10034 | 155 |
! |
156 |
||
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
157 |
version_HG |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
158 |
|
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
159 |
^ '$Changeset: <not expanded> $' |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
160 |
! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
161 |
|
10034 | 162 |
version_SVN |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12123
diff
changeset
|
163 |
^ '$Id: Tools__MethodCategoryCache.st 7854 2012-01-30 17:49:41Z vranyj1 $' |
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
164 |
! ! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
165 |