'From Squeak3.1alpha of 5 February 2001 [latest update: #4160] on 21 June 2001 at 12:45:13 pm'! "Change Set: deleteableProjects Date: 6 June 2001 Author: Dan Ingalls Make it possible to expunge a project from a projectViewMorph, and updates the removal effected by closing a project view window. Also fixes a bug in changeSorters opened before the addition of categories. Also fixes a bug in MVC related to the recent addition of MethodReferences. "! !ChangeSorter methodsFor: 'changeSet menu' stamp: 'di 6/20/2001 09:37'! updateIfNecessary "Recompute all of my panes." | newList | self okToChange ifFalse: [^ self]. myChangeSet ifNil: [^ self]. "Has been known to happen though shouldn't" (myChangeSet isMoribund or: [(changeSetCategory notNil and: [changeSetCategory includesChangeSet: myChangeSet]) not]) ifTrue: [self changed: #changeSetList. ^ self showChangeSet: self changeSetCategory defaultChangeSetToShow]. newList _ self changeSetList. (priorChangeSetList == nil or: [priorChangeSetList ~= newList]) ifTrue: [priorChangeSetList _ newList. self changed: #changeSetList]. self showChangeSet: myChangeSet! ! !PluggableListView methodsFor: 'initialization' stamp: 'di 6/20/2001 09:58'! list: arrayOfStrings "Set the receivers items to be the given list of strings The instance variable 'items' holds the original list. The instance variable 'list' is a paragraph constructed from this list." ((items == arrayOfStrings) "fastest" or: [items = arrayOfStrings]) ifTrue: [^ self]. items _ arrayOfStrings. isEmpty _ arrayOfStrings isEmpty. "add top and bottom delimiters" list _ ListParagraph withArray: (Array streamContents: [:s | s nextPut: topDelimiter. arrayOfStrings do: [:item | item == nil ifFalse: [(item isMemberOf: MethodReference) "A very specific fix for MVC" ifTrue: [s nextPut: item asStringOrText] ifFalse: [s nextPut: item]]]. s nextPut: bottomDelimiter]) style: self assuredTextStyle. selection _ self getCurrentSelectionIndex. self positionList.! ! !Project methodsFor: 'release' stamp: 'di 6/6/2001 21:53'! okToChange "Answer whether the window in which the project is housed can be dismissed -- which is destructive. We never clobber a project without confirmation" | ok is list | self subProjects size >0 ifTrue: [self inform: 'The project ', self name printString, ' contains sub-projects. You must remove these explicitly before removing their parent.'. ^ false]. ok _ world isMorph not and: [world scheduledControllers size <= 1]. ok ifFalse: [self isMorphic ifTrue: [self parent == CurrentProject ifFalse: [^ true]]]. "view from elsewhere. just delete it." ok _ (self confirm: 'Really delete the project ', self name printString, ' and all its windows?'). ok ifFalse: [^ false]. world isMorph ifTrue: [Smalltalk at: #WonderlandCameraMorph ifPresent:[:aClass | world submorphs do: "special release for wonderlands" [:m | (m isKindOf: aClass) and: [m getWonderland release]]]. "Remove Player classes and metaclasses owned by project" is _ ImageSegment new arrayOfRoots: (Array with: self). (list _ is rootsIncludingPlayers) ifNotNil: [list do: [:playerCls | (playerCls respondsTo: #isMeta) ifTrue: [playerCls isMeta ifFalse: [playerCls removeFromSystemUnlogged]]]]]. self removeChangeSetIfPossible. "do this last since it will render project inaccessible to #allProjects and their ilk" ProjectHistory forget: self. Project deletingProject: self. ^ true ! ! !ProjectViewMorph methodsFor: 'events' stamp: 'di 6/6/2001 21:36'! showMenuForProjectView | menu selection | (menu _ CustomMenu new) add: 'enter this project' action: [^ self enter]; add: 'ENTER ACTIVE' action: [self setProperty: #wasOpenedAsSubproject toValue: true. ^ self enterAsActiveSubproject]; add: 'PUBLISH (also saves a local copy)' action: [^ project storeOnServerShowProgressOn: self forgetURL: false]; add: 'PUBLISH to a different server' action: [project forgetExistingURL. ^ project storeOnServerShowProgressOn: self forgetURL: true]; add: 'see if server version is more recent' action: [^ self checkForNewerVersionAndLoad]; addLine; add: 'expunge this project' action: [^ self expungeProject]. selection _ menu build startUpCenteredWithCaption: 'Project Named ' , '"' , project name , '"'. selection ifNil: [^ self]. selection value! ! !ProjectViewMorph methodsFor: 'accessing' stamp: 'di 6/6/2001 21:34'! thumbnail ^ project ifNotNil: [project thumbnail]! ! !ProjectViewMorph methodsFor: 'as yet unclassified' stamp: 'di 6/6/2001 21:48'! expungeProject (self confirm: 'Do you really want to delete ' , project name printString , ' and all its content?') ifFalse: [^ self]. ProjectHistory forget: project. Project deletingProject: project. ! ! !StringHolderController methodsFor: 'accessing' stamp: 'di 6/21/2001 10:32'! changeText: aText "The paragraph to be edited is changed to aText." paragraph text: aText. self resetState. self selectInvisiblyFrom: paragraph text size + 1 to: paragraph text size. self selectAndScroll. self deselect! ! Utilities class removeSelector: #removeDisney! "Postscript: " | s new subst | s _ {'KGMpIDE5OTYgQXBwbGUgQ29tcHV0ZXIsIEluYy4NKGMpIDE5OTctMjAwMSBXYWx0IERpc25l eQ1BTEwgUklHSFRTIFJFU0VSVkVELg=='. 'ICAgICAgICAgICAgICAgICAgIChjKSAxOTk2IEFwcGxlIENvbXB1dGVyLCBJbmMuDSAgICAg ICAgICAgICAgICAgICAgIChjKSAxOTk3LTE5OTkgV2FsdCBEaXNuZXkNICAgICAgICAgICAg ICAgICAgICAgICBBTEwgUklHSFRTIFJFU0VSVkVELg=='. 'ICAgICAgICAgICAgICAgICAgIChjKSAxOTk2IEFwcGxlIENvbXB1dGVyLCBJbmMuDSAgICAg ICAgICAgICAgICAgICAgIChjKSAxOTk3LTIwMDAgV2FsdCBEaXNuZXkNICAgICAgICAgICAg ICAgICAgICAgICBBTEwgUklHSFRTIFJFU0VSVkVELg=='} collect: [:m | (Base64MimeConverter mimeDecodeToChars: (ReadStream on: m)) contents]. subst _ [:blk1 :blk2 | new _ (blk1 value copyReplaceAll: s first with: '' asTokens: false) copyReplaceAll: s second with: '' asTokens: false. new == blk1 value ifFalse: [blk2 value: new]]. Workspace allInstancesDo: [:sh | subst value: [sh contents] value: [:n | sh contents: n]]. PluggableTextMorph allInstancesDo: [:sh | subst value: [sh text] value: [:n | sh setText: n]]. StringHolderController allSubInstancesDo: [:sh | subst value: [sh text] value: [:n | sh changeText: n; selectAt: 1. sh view topView uncacheBits]]. StringHolderController removeSelector: #changeText. !