'From Squeak3.3alpha of 24 January 2002 [latest update: #4653] on 24 January 2002 at 11:17:22 pm'! "Change Set: FileList2ModalDialogsFix Date: 6 January 2002 Author: Leandro Caniglia Before this change set if the user deleted a modal dialog in FileList2, then the answer wasn't nil but the selected file or folder. Now the answer is not nil only if the user accepts the dialog. (typo in test class name fixed -dew) Published in 3.3a as 4721FileList2MDialogs-LC.cs. TestCases included. " ! FileList subclass: #FileList2 instanceVariableNames: 'showDirsInFileList currentDirectorySelected fileSelectionBlock dirSelectionBlock optionalButtonSpecs modalView directoryChangeBlock ok ' classVariableNames: '' module: #(Squeak Development FileList)! TestCase subclass: #FileList2ModalDialogsTest instanceVariableNames: '' classVariableNames: '' module: #(Squeak Development FileList Test)! !FileList2ModalDialogsTest commentStamp: '' prior: 0! TestRunner open! !FileList2 methodsFor: 'as yet unclassified' stamp: 'LC 1/6/2002 06:50'! currentDirectorySelected ^ currentDirectorySelected ! ! !FileList2 methodsFor: 'as yet unclassified' stamp: 'LC 1/6/2002 06:51'! getSelectedDirectory ok == true ifFalse: [^ nil]. ^ currentDirectorySelected ! ! !FileList2 methodsFor: 'as yet unclassified' stamp: 'LC 1/6/2002 07:19'! getSelectedFile ok == true ifFalse: [^ nil]. directory ifNil: [^ nil]. fileName ifNil: [^ nil]. ^ directory oldFileNamed: fileName ! ! !FileList2 methodsFor: 'as yet unclassified' stamp: 'LC 1/6/2002 07:20'! morphicDirectoryTreePaneFiltered: aSymbol ^(SimpleHierarchicalListMorph on: self list: aSymbol selected: #currentDirectorySelected changeSelected: #setSelectedDirectoryTo: menu: nil keystroke: nil) autoDeselect: false ! ! !FileList2 methodsFor: 'as yet unclassified' stamp: 'LC 1/5/2002 19:08'! okHit ok _ true. currentDirectorySelected ifNil: [Smalltalk beep] ifNotNil: [modalView delete]! ! !FileList2 methodsFor: 'as yet unclassified' stamp: 'LC 1/6/2002 06:44'! okHitForProjectLoader | areaOfProgress | ok _ true. areaOfProgress _ modalView firstSubmorph. [ areaOfProgress setProperty: #deleteOnProgressCompletion toValue: modalView. self openProjectFromFile. modalView delete. "probably won't get here" ] on: ProgressTargetRequestNotification do: [ :ex | ex resume: areaOfProgress]. ! ! !FileList2 methodsFor: 'as yet unclassified' stamp: 'LC 1/6/2002 07:12'! saveLocalOnlyHit ok _ true. modalView delete. directory _ fileName _ nil. currentDirectorySelected _ #localOnly.! ! !FileList2 methodsFor: 'as yet unclassified' stamp: 'LC 1/6/2002 09:03'! setSelectedDirectoryTo: aFileDirectoryWrapper currentDirectorySelected _ aFileDirectoryWrapper. self directory: aFileDirectoryWrapper withoutListWrapper. brevityState := #FileList. "self addPath: path." self changed: #fileList. self changed: #contents. self changed: #currentDirectorySelected.! ! !FileList2ModalDialogsTest methodsFor: 'running' stamp: 'LC 1/6/2002 08:45'! testModalFileSelector | window fileList2 | window _ FileList2 morphicViewFileSelector. window openCenteredInWorld. fileList2 _ window valueOfProperty: #fileListModel. fileList2 fileListIndex: 1. window delete. self assert: fileList2 getSelectedFile isNil. fileList2 okHit. self deny: fileList2 getSelectedFile isNil ! ! !FileList2ModalDialogsTest methodsFor: 'running' stamp: 'LC 1/6/2002 08:50'! testModalFileSelectorForSuffixes | window fileList2 | window _ FileList2 morphicViewFileSelectorForSuffixes: nil. window openCenteredInWorld. fileList2 _ window valueOfProperty: #fileListModel. fileList2 fileListIndex: 1. window delete. self assert: fileList2 getSelectedFile isNil. fileList2 okHit. self deny: fileList2 getSelectedFile isNil ! ! !FileList2ModalDialogsTest methodsFor: 'running' stamp: 'LC 1/6/2002 08:55'! testModalFolderSelector | window fileList2 | window _ FileList2 morphicViewFolderSelector. fileList2 _ window model. window openInWorld: self currentWorld extent: 300@400. fileList2 fileListIndex: 1. window delete. self assert: fileList2 getSelectedDirectory withoutListWrapper isNil. fileList2 okHit. self deny: fileList2 getSelectedDirectory withoutListWrapper isNil ! ! !FileList2ModalDialogsTest methodsFor: 'running' stamp: 'LC 1/6/2002 09:01'! testModalFolderSelectorForProjectLoad | window fileList2 w | window _ FileList2 morphicViewProjectLoader2InWorld: self currentWorld reallyLoad: false. fileList2 _ window valueOfProperty: #FileList. w _ self currentWorld. window position: w topLeft + (w extent - window extent // 2). window openInWorld: w. window delete. self assert: fileList2 getSelectedDirectory withoutListWrapper isNil. fileList2 okHit. self deny: fileList2 getSelectedDirectory withoutListWrapper isNil ! ! "Postscript: Remove the misnamed test class in case it exists." | class | class _ Smalltalk at: #FileList2ModalDialgosTest ifAbsent: [nil]. class ifNotNil: [class removeFromSystem]. !