12 "{ Package: 'stx:libtool' }" |
12 "{ Package: 'stx:libtool' }" |
13 |
13 |
14 "{ NameSpace: Tools }" |
14 "{ NameSpace: Tools }" |
15 |
15 |
16 Object subclass:#NavigationHistory |
16 Object subclass:#NavigationHistory |
17 instanceVariableNames:'items position isGlobalHistory' |
17 instanceVariableNames:'items position isGlobalHistory' |
18 classVariableNames:'' |
18 classVariableNames:'' |
19 poolDictionaries:'' |
19 poolDictionaries:'' |
20 category:'Interface-History' |
20 category:'Interface-History' |
21 ! |
21 ! |
22 |
22 |
23 !NavigationHistory class methodsFor:'documentation'! |
23 !NavigationHistory class methodsFor:'documentation'! |
24 |
24 |
25 copyright |
25 copyright |
98 ! ! |
98 ! ! |
99 |
99 |
100 !NavigationHistory methodsFor:'backward list compatibility'! |
100 !NavigationHistory methodsFor:'backward list compatibility'! |
101 |
101 |
102 addFirst:anEntry |
102 addFirst:anEntry |
103 items addFirst:anEntry |
103 "backward compatible list protocol" |
|
104 |
|
105 items addFirst:anEntry. |
|
106 self changed: #value with: anEntry. |
104 |
107 |
105 "Created: / 03-07-2011 / 13:26:48 / cg" |
108 "Created: / 03-07-2011 / 13:26:48 / cg" |
106 ! |
109 ! |
107 |
110 |
108 collect:aBlock thenSelect:filter |
111 collect:aBlock thenSelect:filter |
|
112 "backward compatible list protocol" |
|
113 |
109 ^ items collect:aBlock thenSelect:filter |
114 ^ items collect:aBlock thenSelect:filter |
110 |
115 |
111 "Created: / 03-07-2011 / 13:34:14 / cg" |
116 "Created: / 03-07-2011 / 13:34:14 / cg" |
112 ! |
117 ! |
113 |
118 |
114 detect:aBlock ifNone:exeptionalValue |
119 detect:aBlock ifNone:exeptionalValue |
|
120 "backward compatible list protocol" |
|
121 |
115 ^ items detect:aBlock ifNone:exeptionalValue |
122 ^ items detect:aBlock ifNone:exeptionalValue |
116 |
123 |
117 "Created: / 03-07-2011 / 13:25:37 / cg" |
124 "Created: / 03-07-2011 / 13:25:37 / cg" |
118 ! |
125 ! |
119 |
126 |
120 removeIdentical:anEntry |
127 removeIdentical:anEntry |
121 items removeIdentical:anEntry |
128 "backward compatible list protocol" |
|
129 |
|
130 items removeIdentical:anEntry. |
|
131 self changed: #value with:nil. |
122 |
132 |
123 "Created: / 03-07-2011 / 13:27:34 / cg" |
133 "Created: / 03-07-2011 / 13:27:34 / cg" |
124 ! ! |
134 ! ! |
125 |
135 |
126 !NavigationHistory methodsFor:'initialization'! |
136 !NavigationHistory methodsFor:'initialization'! |
193 "Modified: / 27-02-2008 / 08:48:14 / janfrog" |
203 "Modified: / 27-02-2008 / 08:48:14 / janfrog" |
194 "Modified: / 03-07-2011 / 16:19:27 / cg" |
204 "Modified: / 03-07-2011 / 16:19:27 / cg" |
195 ! |
205 ! |
196 |
206 |
197 goForward |
207 goForward |
198 |
|
199 | value | |
208 | value | |
|
209 |
200 position := (position + 1) min: items size. |
210 position := (position + 1) min: items size. |
201 self changed: #currentItem with: (value := self currentItem). |
211 self changed: #currentItem with: (value := self currentItem). |
202 ^value |
212 ^value |
203 |
213 |
204 "Created: / 21-02-2008 / 16:37:37 / janfrog" |
214 "Created: / 21-02-2008 / 16:37:37 / janfrog" |
212 isGlobalHistory ifTrue:[ |
222 isGlobalHistory ifTrue:[ |
213 idx ~~ 0 ifTrue:[ |
223 idx ~~ 0 ifTrue:[ |
214 items removeIndex:idx. |
224 items removeIndex:idx. |
215 ]. |
225 ]. |
216 items addFirst:navigationHistoryItem. |
226 items addFirst:navigationHistoryItem. |
217 ^ navigationHistoryItem |
227 ] ifFalse:[ |
218 ]. |
228 idx == 0 ifFalse: [ |
219 |
229 position := idx |
220 idx == 0 |
230 ] ifTrue:[ |
221 ifFalse: |
231 position < items size ifTrue:[ |
222 [position := idx] |
232 items removeFromIndex: position + 1 toIndex: items size |
223 ifTrue: |
233 ]. |
224 [position < items size ifTrue: |
|
225 [items removeFromIndex: position + 1 toIndex: items size]. |
|
226 items addLast: navigationHistoryItem. |
234 items addLast: navigationHistoryItem. |
227 position := position + 1]. |
235 position := position + 1 |
|
236 ]. |
|
237 ]. |
|
238 |
|
239 "/ for the canGoXXX apect. |
228 self changed: #value with: navigationHistoryItem. |
240 self changed: #value with: navigationHistoryItem. |
229 ^navigationHistoryItem |
241 ^ navigationHistoryItem |
230 |
242 |
231 "Created: / 21-02-2008 / 16:40:39 / janfrog" |
243 "Created: / 21-02-2008 / 16:40:39 / janfrog" |
232 "Modified: / 21-02-2008 / 19:12:35 / janfrog" |
244 "Modified: / 21-02-2008 / 19:12:35 / janfrog" |
233 "Modified: / 03-07-2011 / 16:03:11 / cg" |
245 "Modified: / 03-07-2011 / 16:03:11 / cg" |
234 ! ! |
246 ! ! |