pharo icon indicating copy to clipboard operation
pharo copied to clipboard

[RB] Replace senders does not work from the code pane

Open Ducasse opened this issue 3 years ago • 1 comments

We could not find a way to make ReplaceMessageSendTransformation (menu item (T) Replace senders to work because the context is different from the one we get when we click on the method in the method list. May be two different commands are needed. A first solution would be to not show it in the menu list.

Ducasse avatar Nov 09 '22 15:11 Ducasse

in method prepareFullExecutionInContext: ....

prepareFullExecutionInContext: aToolContext

	| methodName dialog |
	super prepareFullExecutionInContext: aToolContext.

	"This is for the code editor 
		selectedClass := aToolContext selectedMethod methodClass.
	
	The following expression 	selectedClass := originalMessage methodClass. is for the method list. The context is pain bad because it cannot handle both. We kept the method list.
	Check class side canBeExecutedInContext: if you know how to fix it" 

	selectedClass := originalMessage methodClass.
	methodName := RBMethodName
		              selector: originalMessage selector
		              arguments: originalMessage argumentNames copy.
	dialog := SycMethodNameEditorPresenter openOn: methodName.
	dialog cancelled ifTrue: [ CmdCommandAborted signal ].

	originalMessage selector = methodName selector ifTrue: [ 
		CmdCommandAborted signal ].
	newSelector := methodName

Ducasse avatar Nov 09 '22 15:11 Ducasse