'From Squeak3.2alpha of 3 October 2001 [latest update: #4530] on 21 November 2001 at 4:21:55 pm'! "Change Set: initialsInLexicon-sw Date: 21 November 2001 Author: Scott Wallace Adds a feature in the Lexicon/InstanceBrowser that allows you to query for methods stamped with any given initials. Also eliminates some annoying flashing that could happen on each method-selection in some query modes"! !Lexicon methodsFor: 'menu commands' stamp: 'sw 11/21/2001 11:01'! offerMenu "Offer a menu to the user, in response to the hitting of the menu button on the tool pane" | aMenu | aMenu _ MenuMorph new defaultTarget: self. aMenu addTitle: 'Lexicon'. aMenu addStayUpItem. aMenu addList: #( ('vocabulary...' chooseVocabulary) ('what to show...' offerWhatToShowMenu) - ('inst var refs (here)' setLocalInstVarRefs) ('inst var defs (here)' setLocalInstVarDefs) ('class var refs (here)' setLocalClassVarRefs) - ('navigate to a sender...' navigateToASender) ('recent...' navigateToRecentMethod) ('show methods in current change set' showMethodsInCurrentChangeSet) ('show methods with initials...' showMethodsWithInitials) - "('toggle search pane' toggleSearch)" - ('browse full (b)' browseMethodFull) ('browse hierarchy (h)' classHierarchy) ('browse method (O)' openSingleMessageBrowser) ('browse protocol (p)' browseFullProtocol) - ('fileOut' fileOutMessage) ('printOut' printOutMessage) - ('senders of... (n)' browseSendersOfMessages) ('implementors of... (m)' browseMessages) ('versions (v)' browseVersions) ('inheritance (i)' methodHierarchy) - ('inst var refs' browseInstVarRefs) ('inst var defs' browseInstVarDefs) ('class var refs' browseClassVarRefs) - ('more...' shiftedYellowButtonActivity)). aMenu popUpInWorld: ActiveWorld! ! !Lexicon methodsFor: 'within-tool queries' stamp: 'sw 11/21/2001 10:48'! methodsWithInitials "Answer the list of method selectors within the scope of this tool whose time stamps begin with the initials designated by my currentQueryParameter" ^ self methodsWithInitials: currentQueryParameter! ! !Lexicon methodsFor: 'within-tool queries' stamp: 'sw 11/21/2001 11:00'! methodsWithInitials: initials "Return a list of selectors representing methods whose timestamps have the given initials and which are in the protocol of this object and within the range dictated by my limitClass." | classToUse | classToUse _ self targetObject ifNotNil: [self targetObject class] ifNil: [targetClass]. "In support of lightweight uniclasses" ^ targetClass allSelectorsUnderstood select: [:aSelector | (currentVocabulary includesSelector: aSelector forInstance: self targetObject ofClass: classToUse limitClass: limitClass) and: [Utilities doesMethod: aSelector forClass: classToUse bearInitials: initials]]. ! ! !Lexicon methodsFor: 'within-tool queries' stamp: 'sw 11/21/2001 07:45'! queryCharacterization "Answer a characterization of the most recent query" currentQuery == #selectorName ifTrue: [^ 'All methods whose names include "', self lastSearchString, '"']. currentQuery == #methodsWithInitials ifTrue: [^ 'All methods stamped with initials ', currentQueryParameter]. currentQuery == #senders ifTrue: [^ 'All methods that send #', self lastSendersSearchSelector]. currentQuery == #currentChangeSet ifTrue: [^ 'Methods in the current change set']. currentQuery == #instVarRefs ifTrue: [^ 'Methods that refer to instance variable "', currentQueryParameter, '"']. currentQuery == #instVarDefs ifTrue: [^ 'Methods that store into instance variable "', currentQueryParameter, '"']. currentQuery == #classVarRefs ifTrue: [^ 'Methods that refer to class variable "', currentQueryParameter, '"']. ^ 'Results of queries will show up here'! ! !Lexicon methodsFor: 'within-tool queries' stamp: 'sw 11/21/2001 10:53'! selectorsRetrieved "Anwer a list of selectors in the receiver that have been retrieved for the query category. This protocol is used when reformulating a list after, say, a limitClass change" currentQuery == #classVarRefs ifTrue: [^ self selectorsReferringToClassVar]. currentQuery == #currentChangeSet ifTrue: [^ self selectorsChanged]. currentQuery == #instVarDefs ifTrue: [^ self selectorsDefiningInstVar]. currentQuery == #instVarRefs ifTrue: [^ self selectorsReferringToInstVar]. currentQuery == #methodsWithInitials ifTrue: [^ self methodsWithInitials]. currentQuery == #selectorName ifTrue: [^ self selectorsMatching]. currentQuery == #senders ifTrue: [^ self selectorsSendingSelectedSelector]. ^ #()! ! !Lexicon methodsFor: 'within-tool queries' stamp: 'sw 11/21/2001 11:19'! showMethodsInCurrentChangeSet "Set the current query to be for methods in the current change set" currentQuery _ #currentChangeSet. autoSelectString _ nil. self categoryListIndex: (categoryList indexOf: self class queryCategoryName).! ! !Lexicon methodsFor: 'within-tool queries' stamp: 'sw 11/21/2001 10:46'! showMethodsWithInitials "Prompt the user for initials to scan for; then show, in the query-results category, all methods with those initials in their time stamps" | initials | initials _ FillInTheBlank request: 'whose initials? ' initialAnswer: Utilities authorInitials. initials isEmptyOrNil ifTrue: [^ self]. self showMethodsWithInitials: initials ! ! !Lexicon methodsFor: 'within-tool queries' stamp: 'sw 11/21/2001 10:44'! showMethodsWithInitials: initials "Make the current query be for methods stamped with the given initials" currentQuery _ #methodsWithInitials. currentQueryParameter _ initials. self showQueryResultsCategory. autoSelectString _ nil. self changed: #messageList. self adjustWindowTitle ! ! !InstanceBrowser methodsFor: 'menu commands' stamp: 'sw 11/21/2001 14:36'! offerMenu "Offer a menu to the user, in response to the hitting of the menu button on the tool pane" | aMenu | aMenu _ MenuMorph new defaultTarget: self. aMenu title: 'Messages of ', objectViewed nameForViewer. aMenu addStayUpItem. aMenu addList: #( ('vocabulary...' chooseVocabulary) ('what to show...' offerWhatToShowMenu) - ('inst var refs (here)' setLocalInstVarRefs) ('inst var defs (here)' setLocalInstVarDefs) ('class var refs (here)' setLocalClassVarRefs) - ('navigate to a sender...' navigateToASender) ('recent...' navigateToRecentMethod) ('show methods in current change set' showMethodsInCurrentChangeSet) ('show methods with initials...' showMethodsWithInitials) - "('toggle search pane' toggleSearch)" - - ('browse full (b)' browseMethodFull) ('browse hierarchy (h)' classHierarchy) ('browse method (O)' openSingleMessageBrowser) ('browse protocol (p)' browseFullProtocol) - ('fileOut' fileOutMessage) ('printOut' printOutMessage) - ('senders of... (n)' browseSendersOfMessages) ('implementors of... (m)' browseMessages) ('versions (v)' browseVersions) ('inheritance (i)' methodHierarchy) - ('inst var refs' browseInstVarRefs) ('inst var defs' browseInstVarDefs) ('class var refs' browseClassVarRefs) - ('viewer on me' viewViewee) ('inspector on me' inspectViewee) - ('more...' shiftedYellowButtonActivity)). aMenu popUpInWorld: ActiveWorld! ! !Utilities class methodsFor: 'miscellaneous' stamp: 'sw 11/21/2001 10:58'! doesMethod: aSelector forClass: aClass bearInitials: initials "Answer whether a method bears the given initials at the head of its time stamp" | aTimeStamp implementingClass aMethod | implementingClass _ aClass whichClassIncludesSelector: aSelector. implementingClass ifNil: [^ false]. (aMethod _ implementingClass compiledMethodAt: aSelector) ifNil: [^ false]. ^ (aTimeStamp _ self timeStampForMethod: aMethod) notNil and: [aTimeStamp beginsWith: initials]! !