[squeak-dev] The Trunk: PackageInfo-UI-fbs.1.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jul 3 21:29:13 UTC 2013


Frank Shearar uploaded a new version of PackageInfo-UI to project The Trunk:
http://source.squeak.org/trunk/PackageInfo-UI-fbs.1.mcz

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

Name: PackageInfo-UI-fbs.1
Author: fbs
Time: 3 July 2013, 10:29:09.239 pm
UUID: 47ca3033-6938-2d4f-9ff6-02b2345a1fc5
Ancestors: 

Split PackageInfo's UI into a separate package.

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

SystemOrganization addCategory: #'PackageInfo-UI'!

Object subclass: #PackageList
	instanceVariableNames: 'selectedPackage packages'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'PackageInfo-UI'!

----- Method: PackageList class>>initialize (in category 'as yet unclassified') -----
initialize
	TheWorldMenu registerOpenCommand: {'Package List'. {self. #open}}!

----- Method: PackageList class>>open (in category 'as yet unclassified') -----
open
	^ self new openInWorld!

----- Method: PackageList>>addPackage (in category 'actions') -----
addPackage
	| packageName |
	packageName := UIManager default request: 'Package name:'.
	packageName isEmpty ifFalse:
		[selectedPackage := self packageOrganizer registerPackageNamed: packageName.
		self changed: #packageSelection]!

----- Method: PackageList>>buildList (in category 'morphic') -----
buildList
	^ PluggableListMorph
		on: self
		list: #packageList
		selected: #packageSelection
		changeSelected: #packageSelection:
		menu: #packageMenu:!

----- Method: PackageList>>buildWindow (in category 'morphic') -----
buildWindow
	| window |
	window := SystemWindow labelled: self label.
	window model: self.
	window addMorph: self buildList fullFrame: (LayoutFrame fractions: (0 at 0 corner: 1 at 1)).
	^ window!

----- Method: PackageList>>defaultBackgroundColor (in category 'morphic') -----
defaultBackgroundColor 
	^ Color white!

----- Method: PackageList>>defaultExtent (in category 'morphic') -----
defaultExtent
	^ 200 at 200!

----- Method: PackageList>>label (in category 'morphic') -----
label
	^ 'Packages'!

----- Method: PackageList>>openInWorld (in category 'morphic') -----
openInWorld
	self packageOrganizer addDependent: self.
	self buildWindow openInWorldExtent: self defaultExtent!

----- Method: PackageList>>packageContextMenu: (in category 'morphic') -----
packageContextMenu: aMenu
	aMenu
		addLine;
		add: 'remove package' action: #removePackage;
		addServices: PackageServices allServices for: selectedPackage extraLines: #()!

----- Method: PackageList>>packageList (in category 'morphic') -----
packageList
	^ self packages collect: [:ea | ea packageName]!

----- Method: PackageList>>packageMenu: (in category 'morphic') -----
packageMenu: aMenu
	aMenu
		defaultTarget: self;
		add: 'add package' action: #addPackage.
	selectedPackage ifNotNil: [self packageContextMenu: aMenu].
	^ aMenu!

----- Method: PackageList>>packageOrganizer (in category 'actions') -----
packageOrganizer
	^ PackageOrganizer default!

----- Method: PackageList>>packageSelection (in category 'morphic') -----
packageSelection
	^ self packages indexOf: selectedPackage!

----- Method: PackageList>>packageSelection: (in category 'morphic') -----
packageSelection: aNumber
	selectedPackage := self packages at: aNumber ifAbsent: [].
	self changed: #packageSelection!

----- Method: PackageList>>packages (in category 'as yet unclassified') -----
packages
	^ packages ifNil: [packages := self packageOrganizer packages asSortedCollection:
									[:a :b | a packageName <= b packageName]]!

----- Method: PackageList>>perform:orSendTo: (in category 'morphic') -----
perform: selector orSendTo: otherTarget
	"Selector was just chosen from a menu by a user.  If can respond, then
perform it on myself. If not, send it to otherTarget, presumably the
editPane from which the menu was invoked."

	(self respondsTo: selector)
		ifTrue: [^ self perform: selector]
		ifFalse: [^ otherTarget perform: selector]!

----- Method: PackageList>>removePackage (in category 'actions') -----
removePackage
	self packageOrganizer unregisterPackage: selectedPackage!

----- Method: PackageList>>update: (in category 'actions') -----
update: aSymbol
	aSymbol = #packages ifTrue:
		[packages := nil.
		self changed: #packageList; changed: #packageSelection]!



More information about the Squeak-dev mailing list