Big Tools question - Why no way to "scope" tools to less than Global?

Zulq Alam me at zulq.net
Fri Jan 4 12:53:16 UTC 2008


I get those bugs too. Not sure about the status of this functionality. I 
just discovered it myself.

Not sure whether the senders / implementors menu items scope should 
match the current browser scope. That's probably because I don't like 
the idea of scoped browsers. I'd prefer targeted menu options and prompts.

For example, if I try to rename #at:put: in my class, rather than be 
presented with yes / no prompt to continue, more options could be 
provided like "package" or "hierarchy only". As it stands the "This will 
modify X implementors. Do you want to proceed?" dialogue is really just 
telling you how much of a bad move you're making.

Anyway, an easy way to view package senders / implementors isn't 
available (unless I've missed it?). I've wanted this for a while so I've 
created the attached change set to add "package implementors" and 
"package senders" menu items.

It's my first time adding stuff to the OmniBrowser so would appreciate 
any comments on the idea and implementation.

Thanks,
Zulq.

itsme213 wrote:
> Hi Zulq,
> 
>> You can restrict the scope of refactorings using the "open environment" 
>> menu item in the class context menu. You may have seen it above "refactor 
>> class", "refactor class variable", etc.
> 
> Fantastic! Seems slightly buggy (I got several #doesNotUnderstand: 
> #includesCategory) but I can see this becoming my default browser.
> 
> Since re-factoring operations are scoped in this browser, I tried 
> Senders/Implementors in the same scoped browser and found them global again 
> (at least I could not find a way). Shouldn't all of these be consistently 
> scoped?
> 
> Thanks,
> 
> Sophie
> 
> 
> 
> 
> 
-------------- next part --------------
'From Squeak3.9 of 7 November 2006 [latest update: #7067] on 4 January 2008 at 12:32:23 pm'!
Smalltalk renameClassNamed: #OBCmdBrowseCategoryImplementors as: #OBCmdBrowsePackageImplementors!
OBCmdBrowseList subclass: #OBCmdBrowsePackageImplementors
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'OB-Standard-Commands'!
OBCmdBrowseList subclass: #OBCmdBrowsePackageSenders
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'OB-Standard-Commands'!
Smalltalk renameClassNamed: #OBCategoryImplementorsBrowser as: #OBPackageImplementorsBrowser!
OBImplementorsBrowser subclass: #OBPackageImplementorsBrowser
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'OB-Standard-Browsers'!
OBSendersBrowser subclass: #OBPackageSendersBrowser
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'OB-Standard-Browsers'!
Smalltalk renameClassNamed: #OBShowCategoryImplementors as: #OBShowPackageImplementors!
OBNavigate subclass: #OBShowPackageImplementors
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'OB-Standard-Announcements'!
OBNavigate subclass: #OBShowPackageSenders
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'OB-Standard-Announcements'!

!OBCmdBrowsePackageImplementors methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:47'!
announcementClass
	^ OBShowPackageImplementors! !

!OBCmdBrowsePackageImplementors methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:14'!
isActive
	^ (target isKindOf: OBMethodNode) and: [requestor isSelected: target]! !

!OBCmdBrowsePackageImplementors methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:49'!
label
    ^ 'package implementors'! !


!OBCmdBrowsePackageSenders methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:55'!
announcementClass
	^ OBShowPackageSenders! !

!OBCmdBrowsePackageSenders methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:54'!
isActive
	^ (target isKindOf: OBMethodNode) and: [requestor isSelected: target]! !

!OBCmdBrowsePackageSenders methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:55'!
label
    ^ 'package senders'! !


!OBCodeBrowser methodsFor: 'commands' stamp: 'za 1/4/2008 11:48'!
cmdBrowseCategoryImplementors
	^ OBCmdBrowsePackageImplementors! !

!OBCodeBrowser methodsFor: 'commands' stamp: 'za 1/4/2008 11:55'!
cmdBrowseCategorySenders
	^ OBCmdBrowsePackageSenders! !


!OBMethodNode methodsFor: 'private' stamp: 'za 1/4/2008 11:56'!
packageImplementorsOf: aSelector 
	^ ((PackageOrganizer default packageOfClass: theClass) classes 
		select: [:eachClass | eachClass includesSelector: aSelector ]) 
		collect: [:eachClass | OBMethodNode on: aSelector inClass: eachClass]! !

!OBMethodNode methodsFor: 'private' stamp: 'za 1/4/2008 12:23'!
packageSendersOf: aSelector
	| special byte classes senders  |
	special := Smalltalk hasSpecialSelector: aSelector ifTrueSetByte: [:b | byte := b].
	classes := (PackageOrganizer default packageOfClass: theClass) classes.
	senders := OrderedCollection new.	
	classes do: [:eachClass | 
		senders addAll: ((Preferences thoroughSenders
			ifTrue: [
				eachClass
					thoroughWhichSelectorsReferTo: aSelector
					special: special
					byte: byte]
			ifFalse: [
				eachClass
					whichSelectorsReferTo: aSelector
					special: special
					byte: byte]) 
			collect: [:eachSymbol | eachClass -> eachSymbol])].
	^ senders collect: [:eachAssociation | OBMethodNode on: eachAssociation value inClass: eachAssociation key]
! !

!OBMethodNode methodsFor: 'navigating' stamp: 'za 1/4/2008 11:45'!
packageImplementors
	^ self packageImplementorsOf: selector! !

!OBMethodNode methodsFor: 'navigating' stamp: 'za 1/4/2008 11:49'!
packageSenders
	^ self packageSendersOf: selector! !


!OBPackageImplementorsBrowser class methodsFor: 'configuration' stamp: 'za 1/4/2008 11:45'!
defaultMetaNode
	^ self implementorsNav: #packageImplementors! !

!OBPackageImplementorsBrowser class methodsFor: 'configuration' stamp: 'za 1/4/2008 11:46'!
title
	^ 'Package Implementors of'! !


!OBPackageSendersBrowser class methodsFor: 'configuration' stamp: 'za 1/4/2008 11:52'!
defaultMetaNode
    ^self sendersNav: #packageSenders.
    ! !

!OBPackageSendersBrowser class methodsFor: 'configuration' stamp: 'za 1/4/2008 11:52'!
title
	^'Package Senders of' 
    ! !


!OBShowPackageImplementors methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:46'!
browserClass
	^ OBPackageImplementorsBrowser! !

!OBShowPackageImplementors methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:47'!
noChildrenMessage
	^ 'no package implementors'! !


!OBShowPackageSenders methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:53'!
browserClass
	^ OBPackageSendersBrowser! !

!OBShowPackageSenders methodsFor: 'as yet unclassified' stamp: 'za 1/4/2008 11:54'!
noChildrenMessage
	^ 'no package senders'! !


!OBPackageImplementorsBrowser class reorganize!
('configuration' defaultMetaNode title)
!



More information about the Squeak-dev mailing list