[squeak-dev] The Inbox: ButtonForIt-yo.1.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jun 23 08:43:28 UTC 2011


A new version of ButtonForIt was added to project The Inbox:
http://source.squeak.org/inbox/ButtonForIt-yo.1.mcz

==================== Summary ====================

Name: ButtonForIt-yo.1
Author: yo
Time: 23 June 2011, 1:43:27.834 am
UUID: 2a0e0bf3-0a14-4230-a214-6eab6e569b26
Ancestors: 

Adapt Scott Wallace's 'button for it' feature to trunk.

==================== Snapshot ====================

----- Method: StringHolder class>>yellowButtonMenuItems (in category '*buttonForIt-overrides') -----
yellowButtonMenuItems
	"Returns the standard yellow button menu items"
	^{
			{'set font... (k)' translated.				#offerFontMenu}.
			{'set style... (K)' translated.				#changeStyle}.
			{'set alignment... (u)' translated.		#chooseAlignment}.
			#-.
			{'make project link (P)' translated.	#makeProjectLink}.
			#-.
			{'find...(f)' translated.					#find}.
			{'find again (g)' translated.				#findAgain}.
			{'set search string (h)' translated.		#setSearchString}.
			#-.
			{'do again (j)' translated.				#again}.
			{'undo (z)' translated.					#undo}.
			#-.
			{'copy (c)' translated.					#copySelection}.
			{'cut (x)' translated.						#cut}.
			{'paste (v)' translated.					#paste}.
			{'paste...' translated.					#pasteRecent}.
			#-.
			{'do it (d)' translated.		#doIt}.			     
		{'print it (p)' translated.		#printIt}.		     
		{'inspect it (i)' translated.		#inspectIt}.		     
		{'explore it (I)' translated.		#exploreIt}.		     
		{'debug it' translated.			#debugIt}.		     
		{'button for it' translated.			#buttonForIt}.		     
		{'tally it' translated.			#tallyIt}.
			#-.
			{'accept (s)' translated.					#accept}.
			{'cancel (l)' translated.					#cancel}.
			#-.
			{'show bytecodes' translated.			#showBytecodes}.
			#-.
			{'copy html' translated.					#copyHtml}.
			#-.
			{'more...' translated.					#shiftedTextPaneMenuRequest}.
		}!

----- Method: PluggableTextMorph>>buttonForIt (in category '*buttonForIt') -----
buttonForIt
	self handleEdit: [textMorph editor buttonForIt]!

----- Method: SmalltalkEditor>>buttonForIt (in category '*buttonForIt') -----
buttonForIt

	^ self doItButtonFromSelection openInHand!

----- Method: SmalltalkEditor>>doItButtonFromSelection (in category '*buttonForIt') -----
doItButtonFromSelection

	| button string |
	self lineSelectAndEmptyCheck: [^ ''].
	button := SimpleButtonMorph new.
	string := self selection.
	(model respondsTo: #doItReceiver) 
		ifTrue: [
			button setProperty: #rcvr toValue: model doItReceiver.
			button setProperty: #ctxt toValue: model doItContext].

	button target: [:b | 
		[(b valueOfProperty: #rcvr) class evaluatorClass new 
			evaluate: string
			in: (b valueOfProperty: #ctxt)
			to: (b valueOfProperty: #rcvr)
			notifying: nil
			ifFail: [^ b valueOfProperty: #rcvr]
			logged: false]
	
		on: OutOfScopeNotification 
		do: [ :ex | ex resume: true]];
		actionSelector: #value:;
		arguments: {button}.
	button label: string.
	^ button.
!




More information about the Squeak-dev mailing list