--- a/FileDialogV2.st Tue Jan 16 22:14:36 2018 +0100
+++ b/FileDialogV2.st Tue Jan 16 22:28:14 2018 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 2002 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -28,7 +28,7 @@
copyright
"
COPYRIGHT (c) 2002 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -44,7 +44,7 @@
documentation to be added.
[author:]
- Martin Walser (martin@vercingetorix)
+ Martin Walser (martin@vercingetorix)
[instance variables:]
@@ -57,37 +57,37 @@
examples
"
- [exBegin]
+ [exBegin]
FileDialog open
- [exEnd]
+ [exEnd]
- [exBegin]
- FileDialog
- requestFileName:'enter a fileName:'
- default:''
- version:nil
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:'/etc'
- whenBoxCreatedEvaluate:nil.
- [exEnd]
- [exBegin]
+ [exBegin]
+ FileDialog
+ requestFileName:'enter a fileName:'
+ default:''
+ version:nil
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:'/etc'
+ whenBoxCreatedEvaluate:nil.
+ [exEnd]
+ [exBegin]
|fd|
fd := FileDialog new.
fd multipleSelect:true.
fd open
- [exEnd]
+ [exEnd]
"
!
todo
"
- make the filedialog windows like f
- filename entry field shows only the filename not the whole directory
+ filename entry field shows only the filename not the whole directory
the tree allways starts in currrent directory
the parent tree is shown in a compobox where the perents are selectable
- - do not expand the ~ or relative pathnames to absolute pathnames
+ - do not expand the ~ or relative pathnames to absolute pathnames
"
! !
@@ -96,73 +96,73 @@
requestDirectoryName:title default:aFileName ifFail:failBlock
"same as requestFileName, but only show directories"
- ^ self
- requestDirectoryName:title
- default:aFileName
- ok:nil
- abort:nil
- version:nil
- pattern:nil
- fromDirectory:nil
- ifFail:failBlock
- whenBoxCreatedEvaluate:nil
- asLoadDialog:nil.
+ ^ self
+ requestDirectoryName:title
+ default:aFileName
+ ok:nil
+ abort:nil
+ version:nil
+ pattern:nil
+ fromDirectory:nil
+ ifFail:failBlock
+ whenBoxCreatedEvaluate:nil
+ asLoadDialog:nil.
"
FileDialogV2
- requestDirectoryName:'which directory ?'
- default:Filename currentDirectory pathName
- ifFail:'none'
+ requestDirectoryName:'which directory ?'
+ default:Filename currentDirectory pathName
+ ifFail:'none'
"
!
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock
"same as requestFileName, but only show directories"
- ^ self
- requestDirectoryName:title
- default:aFileName
- ok:okText
- abort:abortText
- version:nil
- pattern:nil
- fromDirectory:nil
- ifFail:failBlock
- whenBoxCreatedEvaluate:nil
- asLoadDialog:nil.
+ ^ self
+ requestDirectoryName:title
+ default:aFileName
+ ok:okText
+ abort:abortText
+ version:nil
+ pattern:nil
+ fromDirectory:nil
+ ifFail:failBlock
+ whenBoxCreatedEvaluate:nil
+ asLoadDialog:nil.
"
FileDialog
- requestDirectoryName:'which directory ?'
- default:Filename currentDirectory pathName
- ok:'Yes'
- abort:'No'
- ifFail:'none'
+ requestDirectoryName:'which directory ?'
+ default:Filename currentDirectory pathName
+ ok:'Yes'
+ abort:'No'
+ ifFail:'none'
"
!
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean
"same as requestFileName, but only show directories"
- ^ self
- requestDirectoryName:title
- default:aFileName
- ok:okText
- abort:abortText
- version:nil
- pattern:nil
- fromDirectory:nil
- ifFail:failBlock
- whenBoxCreatedEvaluate:[:box|box doubleClickAction:[:index|box doAccept]]
- asLoadDialog:nil.
+ ^ self
+ requestDirectoryName:title
+ default:aFileName
+ ok:okText
+ abort:abortText
+ version:nil
+ pattern:nil
+ fromDirectory:nil
+ ifFail:failBlock
+ whenBoxCreatedEvaluate:[:box|box doubleClickAction:[:index|box doAccept]]
+ asLoadDialog:nil.
"
FileDialog
- requestDirectoryName:'which directory ?'
- default:Filename currentDirectory pathName
- ok:'Yes'
- abort:'No'
- ifFail:'none'
+ requestDirectoryName:'which directory ?'
+ default:Filename currentDirectory pathName
+ ok:'Yes'
+ abort:'No'
+ ifFail:'none'
"
!
@@ -171,110 +171,110 @@
|enteredFileName instance enteredFileNameString|
- instance := self
- startApplicationFor:titleString
- default:aFileName
- ok:okText
- abort:abortText
- ifFail:failBlock
- pattern:pattern
- fromDirectory:aDirectoryPath
- whenBoxCreatedEvaluate:boxCreatedCallback
- asLoadDialog:aBoolean
- viewFiles:false
- multipleSelect:false.
+ instance := self
+ startApplicationFor:titleString
+ default:aFileName
+ ok:okText
+ abort:abortText
+ ifFail:failBlock
+ pattern:pattern
+ fromDirectory:aDirectoryPath
+ whenBoxCreatedEvaluate:boxCreatedCallback
+ asLoadDialog:aBoolean
+ viewFiles:false
+ multipleSelect:false.
enteredFileNameString := instance result.
enteredFileNameString isNil ifTrue:[
- ^ failBlock value
+ ^ failBlock value
].
enteredFileName := enteredFileNameString asFilename.
enteredFileNameString := enteredFileName asString.
- (enteredFileName notNil
+ (enteredFileName notNil
and:[enteredFileNameString notEmpty]) ifTrue:[
- versionSymbol isNil ifTrue:[ ^ enteredFileNameString].
- versionSymbol == #mustBeNew ifTrue:[
- "/ file may not exist
- enteredFileName exists ifTrue:[^ ''].
- ].
- versionSymbol == #new ifTrue:[
- "/ file may not exist
- enteredFileName exists ifTrue:[
- (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs)
- ifFalse:[^ ''].
- ].
- ].
- versionSymbol == #mustBeOld ifTrue:[
- enteredFileName exists ifFalse:[^ ''].
- ].
- versionSymbol == #old ifTrue:[
- "/ file may not exist
- enteredFileName exists ifFalse:[
- (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs)
- ifFalse:[^ ''].
- ].
- ].
- FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString).
+ versionSymbol isNil ifTrue:[ ^ enteredFileNameString].
+ versionSymbol == #mustBeNew ifTrue:[
+ "/ file may not exist
+ enteredFileName exists ifTrue:[^ ''].
+ ].
+ versionSymbol == #new ifTrue:[
+ "/ file may not exist
+ enteredFileName exists ifTrue:[
+ (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs)
+ ifFalse:[^ ''].
+ ].
+ ].
+ versionSymbol == #mustBeOld ifTrue:[
+ enteredFileName exists ifFalse:[^ ''].
+ ].
+ versionSymbol == #old ifTrue:[
+ "/ file may not exist
+ enteredFileName exists ifFalse:[
+ (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs)
+ ifFalse:[^ ''].
+ ].
+ ].
+ FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString).
].
^ enteredFileNameString
"
FileDialog
- requestDirectoryName:'which directory ?'
- default:Filename currentDirectory pathName
- ifFail:nil
+ requestDirectoryName:'which directory ?'
+ default:Filename currentDirectory pathName
+ ifFail:nil
"
"
FileDialog
- requestDirectoryName:'which directory ?'
- default:Filename currentDirectory pathName
- ok:nil
- abort:nil
- version:nil
- pattern:nil
- fromDirectory:nil
- ifFail:nil
- whenBoxCreatedEvaluate:nil
- asLoadDialog:true
+ requestDirectoryName:'which directory ?'
+ default:Filename currentDirectory pathName
+ ok:nil
+ abort:nil
+ version:nil
+ pattern:nil
+ fromDirectory:nil
+ ifFail:nil
+ whenBoxCreatedEvaluate:nil
+ asLoadDialog:true
"
!
requestDirectoryName:title default:aFileName ok:okText ifFail:failBlock
"same as requestFileName, but only show directories"
- ^ self
- requestDirectoryName:title
- default:aFileName
- ok:okText
- abort:nil
- version:nil
- pattern:nil
- fromDirectory:nil
- ifFail:failBlock
- whenBoxCreatedEvaluate:nil
- asLoadDialog:nil.
+ ^ self
+ requestDirectoryName:title
+ default:aFileName
+ ok:okText
+ abort:nil
+ version:nil
+ pattern:nil
+ fromDirectory:nil
+ ifFail:failBlock
+ whenBoxCreatedEvaluate:nil
+ asLoadDialog:nil.
"
FileDialogV2
- requestDirectoryName:'which directory ?'
- default:Filename currentDirectory pathName
- ok:'Yes'
- ifFail:'none'
+ requestDirectoryName:'which directory ?'
+ default:Filename currentDirectory pathName
+ ok:'Yes'
+ ifFail:'none'
"
!
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback
- ^ self
- requestFileName:titleString
- default:defaultName
- ok:okText
- abort:abortText
- version:nil
- ifFail:nil
- pattern:pattern
- fromDirectory:aDirectoryPathOrNil
- whenBoxCreatedEvaluate:boxCreatedCallback
+ ^ self
+ requestFileName:titleString
+ default:defaultName
+ ok:okText
+ abort:abortText
+ version:nil
+ ifFail:nil
+ pattern:pattern
+ fromDirectory:aDirectoryPathOrNil
+ whenBoxCreatedEvaluate:boxCreatedCallback
!
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback
@@ -286,24 +286,24 @@
Return the string, or nil if cancel was pressed
The version argument allows validation of the files existance;
it may be any of:
- #mustBeNew - fail (return empty string) if the file exists
- #new - confirm if the file exists
- #mustBeOld - fail if the file does not exist
- #old - confirm if the file does not exist
- #any (other) - no validation
+ #mustBeNew - fail (return empty string) if the file exists
+ #new - confirm if the file exists
+ #mustBeOld - fail if the file does not exist
+ #old - confirm if the file does not exist
+ #any (other) - no validation
"
- ^ self
- requestFileName:titleString
- default:defaultName
- ok:okText
- abort:abortText
- version:versionSymbol
- ifFail:failBlock
- pattern:pattern
- fromDirectory:aDirectoryPath
- whenBoxCreatedEvaluate:boxCreatedCallback
- asLoadDialog:nil
+ ^ self
+ requestFileName:titleString
+ default:defaultName
+ ok:okText
+ abort:abortText
+ version:versionSymbol
+ ifFail:failBlock
+ pattern:pattern
+ fromDirectory:aDirectoryPath
+ whenBoxCreatedEvaluate:boxCreatedCallback
+ asLoadDialog:nil
!
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean
@@ -315,128 +315,128 @@
Return the string, or nil if cancel was pressed
The version argument allows validation of the files existance;
it may be any of:
- #mustBeNew - fail (return empty string) if the file exists
- #new - confirm if the file exists
- #mustBeOld - fail if the file does not exist
- #old - confirm if the file does not exist
- #any (other) - no validation
+ #mustBeNew - fail (return empty string) if the file exists
+ #new - confirm if the file exists
+ #mustBeOld - fail if the file does not exist
+ #old - confirm if the file does not exist
+ #any (other) - no validation
"
| instance enteredFileName enteredFileNameString|
- instance := self
- startApplicationFor:titleString
- default:defaultName
- ok:okText
- abort:abortText
- ifFail:failBlock
- pattern:pattern
- fromDirectory:aDirectoryPath
- whenBoxCreatedEvaluate:boxCreatedCallback
- asLoadDialog:aBoolean
- viewFiles:true
- multipleSelect:false.
+ instance := self
+ startApplicationFor:titleString
+ default:defaultName
+ ok:okText
+ abort:abortText
+ ifFail:failBlock
+ pattern:pattern
+ fromDirectory:aDirectoryPath
+ whenBoxCreatedEvaluate:boxCreatedCallback
+ asLoadDialog:aBoolean
+ viewFiles:true
+ multipleSelect:false.
enteredFileNameString := instance result.
(enteredFileNameString isNil or:[enteredFileNameString isEmpty]) ifTrue:[
- ^ failBlock value
+ ^ failBlock value
].
enteredFileName := enteredFileNameString asFilename.
enteredFileNameString := enteredFileName asString.
- (enteredFileName notNil
+ (enteredFileName notNil
and:[enteredFileNameString notEmpty]) ifTrue:[
- FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName).
- versionSymbol isNil ifTrue:[ ^ enteredFileNameString].
- versionSymbol == #mustBeNew ifTrue:[
- "/ file may not exist
- enteredFileName exists ifTrue:[^ ''].
- ].
- versionSymbol == #new ifTrue:[
- "/ file may not exist
- enteredFileName exists ifTrue:[
- (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs)
- ifFalse:[^ ''].
- ].
- ].
- versionSymbol == #mustBeOld ifTrue:[
- enteredFileName exists ifFalse:[^ ''].
- ].
- versionSymbol == #old ifTrue:[
- "/ file may not exist
- enteredFileName exists ifFalse:[
- (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs)
- ifFalse:[^ ''].
- ].
- ].
+ FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName).
+ versionSymbol isNil ifTrue:[ ^ enteredFileNameString].
+ versionSymbol == #mustBeNew ifTrue:[
+ "/ file may not exist
+ enteredFileName exists ifTrue:[^ ''].
+ ].
+ versionSymbol == #new ifTrue:[
+ "/ file may not exist
+ enteredFileName exists ifTrue:[
+ (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs)
+ ifFalse:[^ ''].
+ ].
+ ].
+ versionSymbol == #mustBeOld ifTrue:[
+ enteredFileName exists ifFalse:[^ ''].
+ ].
+ versionSymbol == #old ifTrue:[
+ "/ file may not exist
+ enteredFileName exists ifFalse:[
+ (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs)
+ ifFalse:[^ ''].
+ ].
+ ].
].
^ enteredFileNameString
"
- FileDialog
- requestFileName:'enter a fileName:'
- default:''
- ok:nil
- abort:nil
- version:nil
- ifFail:['none']
- pattern:'*'
- fromDirectory:Filename currentDirectory pathName
- whenBoxCreatedEvaluate:nil
- asLoadDialog:true
+ FileDialog
+ requestFileName:'enter a fileName:'
+ default:''
+ ok:nil
+ abort:nil
+ version:nil
+ ifFail:['none']
+ pattern:'*'
+ fromDirectory:Filename currentDirectory pathName
+ whenBoxCreatedEvaluate:nil
+ asLoadDialog:true
"
!
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback
- ^ self
- requestFileName:titleString
- default:defaultName
- ok:nil
- abort:nil
- version:versionSymbol
- ifFail:failBlock
- pattern:pattern
- fromDirectory:aDirectoryPathOrNil
- whenBoxCreatedEvaluate:boxCreatedCallback
+ ^ self
+ requestFileName:titleString
+ default:defaultName
+ ok:nil
+ abort:nil
+ version:versionSymbol
+ ifFail:failBlock
+ pattern:pattern
+ fromDirectory:aDirectoryPathOrNil
+ whenBoxCreatedEvaluate:boxCreatedCallback
"
- FileDialog
- requestFileName:'enter a fileName:'
- default:''
- version:nil
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:Filename currentDirectory pathName
- whenBoxCreatedEvaluate:nil.
- Dialog
- requestFileName:'enter a fileName:'
- default:''
- version:nil
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:Filename currentDirectory pathName
- whenBoxCreatedEvaluate:nil
+ FileDialog
+ requestFileName:'enter a fileName:'
+ default:''
+ version:nil
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:Filename currentDirectory pathName
+ whenBoxCreatedEvaluate:nil.
+ Dialog
+ requestFileName:'enter a fileName:'
+ default:''
+ version:nil
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:Filename currentDirectory pathName
+ whenBoxCreatedEvaluate:nil
"
"
FileDialog
- requestFileName:'enter a fileName:'
- default:''
- version:#old
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:Filename currentDirectory pathName
- whenBoxCreatedEvaluate:nil
+ requestFileName:'enter a fileName:'
+ default:''
+ version:#old
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:Filename currentDirectory pathName
+ whenBoxCreatedEvaluate:nil
"
"
FileDialog
- requestFileName:'enter a fileName:'
- default:''
- version:#mustBeNew
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:Filename currentDirectory pathName
- whenBoxCreatedEvaluate:nil
+ requestFileName:'enter a fileName:'
+ default:''
+ version:#mustBeNew
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:Filename currentDirectory pathName
+ whenBoxCreatedEvaluate:nil
"
!
@@ -450,28 +450,28 @@
"
- ^ self
- requestFileNames:titleString
- default:defaultName
- ok:okText
- abort:abortText
- ifFail:failBlock
- pattern:pattern
- fromDirectory:aDirectoryPath
- whenBoxCreatedEvaluate:boxCreatedCallback
- asLoadDialog:nil.
+ ^ self
+ requestFileNames:titleString
+ default:defaultName
+ ok:okText
+ abort:abortText
+ ifFail:failBlock
+ pattern:pattern
+ fromDirectory:aDirectoryPath
+ whenBoxCreatedEvaluate:boxCreatedCallback
+ asLoadDialog:nil.
"
- FileDialogV2
- requestFileNames:'enter a fileName:'
- default:''
- ok:nil
- abort:nil
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:Filename currentDirectory pathName
- whenBoxCreatedEvaluate:nil.
+ FileDialogV2
+ requestFileNames:'enter a fileName:'
+ default:''
+ ok:nil
+ abort:nil
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:Filename currentDirectory pathName
+ whenBoxCreatedEvaluate:nil.
"
!
@@ -487,22 +487,22 @@
| instance enteredFileNames lastDirectory|
- instance := self
- startApplicationFor:titleString
- default:defaultName
- ok:okText
- abort:abortText
- ifFail:failBlock
- pattern:pattern
- fromDirectory:aDirectoryPath
- whenBoxCreatedEvaluate:boxCreatedCallback
- asLoadDialog:asLoadDialog
- viewFiles:true
- multipleSelect:true.
+ instance := self
+ startApplicationFor:titleString
+ default:defaultName
+ ok:okText
+ abort:abortText
+ ifFail:failBlock
+ pattern:pattern
+ fromDirectory:aDirectoryPath
+ whenBoxCreatedEvaluate:boxCreatedCallback
+ asLoadDialog:asLoadDialog
+ viewFiles:true
+ multipleSelect:true.
enteredFileNames := instance currentSelectedFiles.
(enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[
- ^ failBlock value
+ ^ failBlock value
].
lastDirectory := enteredFileNames first.
lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory].
@@ -510,16 +510,16 @@
^ enteredFileNames
"
- FileDialog
- requestFileNames:'enter a fileName:'
- default:''
- ok:nil
- abort:nil
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:Filename currentDirectory pathName
- whenBoxCreatedEvaluate:nil
- asLoadDialog:true.
+ FileDialog
+ requestFileNames:'enter a fileName:'
+ default:''
+ ok:nil
+ abort:nil
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:Filename currentDirectory pathName
+ whenBoxCreatedEvaluate:nil
+ asLoadDialog:true.
"
!
@@ -532,25 +532,25 @@
Return the string, or nil if cancel was pressed
The version argument allows validation of the files existance;
it may be any of:
- #mustBeNew - fail (return empty string) if the file exists
- #new - confirm if the file exists
- #mustBeOld - fail if the file does not exist
- #old - confirm if the file does not exist
- #any (other) - no validation
+ #mustBeNew - fail (return empty string) if the file exists
+ #new - confirm if the file exists
+ #mustBeOld - fail if the file does not exist
+ #old - confirm if the file does not exist
+ #any (other) - no validation
"
|defaultDir instance defaultFile okText abortText initialDefaultFileName|
initialDefaultFileName := initialDefaultFileNameArg.
- initialDefaultFileName notNil ifTrue:[
- initialDefaultFileName := initialDefaultFileName asFilename
+ initialDefaultFileName notNil ifTrue:[
+ initialDefaultFileName := initialDefaultFileName asFilename
].
okText := okTextArg.
- okText isNil ifTrue:[ okText := self resources string:'OK' ].
+ okText isNil ifTrue:[ okText := self resources string:'OK' ].
abortText := abortTextArg.
- abortText isNil ifTrue:[ abortText := self resources string:'Cancel' ].
+ abortText isNil ifTrue:[ abortText := self resources string:'Cancel' ].
defaultDir := aDirectoryPath.
"/ defaultDir isNil ifTrue:[
@@ -559,30 +559,30 @@
"/ ] ifFalse:[
"/ defaultDir := FileSelectionBox lastFileSelectionDirectory.
"/ defaultDir isNil ifTrue:[
-"/ defaultDir := Filename currentDirectory asAbsoluteFilename.
+"/ defaultDir := Filename currentDirectory asAbsoluteFilename.
"/ ].
"/ defaultDir asFilename exists ifFalse:[
"/ defaultDir := nil
"/ ].
"/ ]
"/ ].
- (initialDefaultFileName notNil
- and:[initialDefaultFileName isAbsolute
+ (initialDefaultFileName notNil
+ and:[initialDefaultFileName isAbsolute
and:[true "initialDefaultFileName asFilename exists"]]) ifTrue:[
- defaultDir := initialDefaultFileName asAbsoluteFilename.
- viewFiles ifTrue:[
- defaultDir := defaultDir directory.
- ].
+ defaultDir := initialDefaultFileName asAbsoluteFilename.
+ viewFiles ifTrue:[
+ defaultDir := defaultDir directory.
+ ].
] ifFalse:[
- defaultDir isNil ifTrue:[
- defaultDir := FileSelectionBox lastFileSelectionDirectory.
- defaultDir isNil ifTrue:[
- defaultDir := Filename currentDirectory asAbsoluteFilename.
- ].
- defaultDir asFilename exists ifFalse:[
- defaultDir := nil
- ].
- ]
+ defaultDir isNil ifTrue:[
+ defaultDir := FileSelectionBox lastFileSelectionDirectory.
+ defaultDir isNil ifTrue:[
+ defaultDir := Filename currentDirectory asAbsoluteFilename.
+ ].
+ defaultDir asFilename exists ifFalse:[
+ defaultDir := nil
+ ].
+ ]
].
defaultDir := defaultDir asFilename asAbsoluteFilename.
"/ [defaultDir exists] whileFalse:[
@@ -590,14 +590,14 @@
"/ ].
viewFiles ifFalse:[
- defaultFile := defaultDir asAbsoluteFilename.
+ defaultFile := defaultDir asAbsoluteFilename.
] ifTrue:[
- (initialDefaultFileName notNil and:[initialDefaultFileName withoutSuffix baseName ~= '*']) ifTrue:[
- defaultFile := defaultDir construct:initialDefaultFileName baseName.
- ].
+ (initialDefaultFileName notNil and:[initialDefaultFileName withoutSuffix baseName ~= '*']) ifTrue:[
+ defaultFile := defaultDir construct:initialDefaultFileName baseName.
+ ].
].
defaultFile isNil ifTrue:[
- defaultFile := defaultDir.
+ defaultFile := defaultDir.
].
instance := self new.
@@ -626,14 +626,14 @@
setDoubleClickActionFor:instance
instance doubleClickAction:[:anIndex|
- | item |
- item := instance contentsBrowser browserItemList at:anIndex ifAbsent:nil.
- item notNil ifTrue:[
- ((instance viewFiles and:[item isDirectory not])
- " or:[(instance viewFiles not and:[item isDirectory])] " ) ifTrue:[
- instance doAccept.
- ]
- ]
+ | item |
+ item := instance contentsBrowser browserItemList at:anIndex ifAbsent:nil.
+ item notNil ifTrue:[
+ ((instance viewFiles and:[item isDirectory not])
+ " or:[(instance viewFiles not and:[item isDirectory])] " ) ifTrue:[
+ instance doAccept.
+ ]
+ ]
].
!
@@ -643,12 +643,12 @@
!FileDialogV2 class methodsFor:'help specs'!
-flyByHelpSpec
+helpSpec
<resource: #help>
|spec|
- spec := AbstractFileBrowser flyByHelpSpec addPairsFrom:#(
+ spec := AbstractFileBrowser helpSpec addPairsFrom:#(
#fileBrowse
'Browse'
@@ -667,32 +667,8 @@
^ spec.
"
- self flyByHelpSpec
- "
-!
-
-helpSpec
- "This resource specification was automatically generated
- by the UIHelpTool of ST/X."
-
- "Do not manually edit this!! If it is corrupted,
- the UIHelpTool may not be able to read the specification."
-
+ self helpSpec
"
- UIHelpTool openOnClass:FileDialogV2
- "
-
- <resource: #help>
-
- ^ super helpSpec addPairsFrom:#(
-
-#fileHome
-''
-
-#fileBrowse
-'Browse'
-
-)
! !
!FileDialogV2 class methodsFor:'interface specs'!
@@ -712,158 +688,158 @@
<resource: #canvas>
- ^
+ ^
#(FullSpec
- name: windowSpec
- window:
+ name: windowSpec
+ window:
(WindowSpec
- label: 'FileDialogV2'
- name: 'FileDialogV2'
- min: (Point 10 10)
- max: (Point 1024 768)
- bounds: (Rectangle 0 0 400 400)
- )
- component:
+ label: 'FileDialogV2'
+ name: 'FileDialogV2'
+ min: (Point 10 10)
+ max: (Point 1024 768)
+ bounds: (Rectangle 0 0 400 400)
+ )
+ component:
(SpecCollection
- collection: (
- (ViewSpec
- name: 'FilePart'
- layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0)
- component:
- (SpecCollection
- collection: (
- (MenuPanelSpec
- name: 'ToolBar1'
- layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 32 0)
- tabable: true
- menu: toolBarMenu
- textDefault: true
- )
- (SubCanvasSpec
- name: 'DirectoryContentsBrowser'
- layout: (LayoutFrame 0 0.0 57 0 0 1.0 -30 1)
- tabable: true
- hasHorizontalScrollBar: false
- hasVerticalScrollBar: false
- majorKey: DirectoryContentsBrowser
- createNewApplication: true
- createNewBuilder: true
- postBuildCallback: postBuildTreeBrowser:
- )
- (VariableHorizontalPanelSpec
- name: 'VariableHorizontalPanel1'
- layout: (LayoutFrame 0 0 32 0 0 1 57 0)
- level: 1
- showHandle: false
- barLevel: 0
- component:
- (SpecCollection
- collection: (
- (ViewSpec
- name: 'Box1'
- )
- (ViewSpec
- name: 'Box2'
- component:
- (SpecCollection
- collection: (
- (LabelSpec
- label: 'Filter:'
- name: 'FilterLabel'
- layout: (LayoutFrame 8 0 2 0 59 0 -2 1)
- translateLabel: true
- adjust: right
- )
- (InputFieldSpec
- name: 'FilterEntryField'
- layout: (LayoutFrame 60 0 -22 1 -2 1 -2 1)
- model: filterHolder
- immediateAccept: true
- acceptOnReturn: true
- acceptOnTab: true
- acceptOnLostFocus: true
- acceptOnPointerLeave: false
- postBuildCallback: postBuildFilterField:
- )
- )
-
- )
- )
- )
-
- )
- handles: (Any 0.5 1.0)
- )
- (LabelSpec
- label: 'Filename:'
- name: 'FilenameLabel'
- layout: (LayoutFrame 3 0 -21 1 73 0 -1 1)
- translateLabel: true
- labelChannel: filenameLabelHolder
- adjust: left
- )
- (FilenameInputFieldSpec
- name: 'FilenameEntryField'
- layout: (LayoutFrame 70 0 -21 1 -4 1 -1 1)
- tabable: true
- model: filenameHolder
- immediateAccept: false
- acceptOnPointerLeave: false
- hasKeyboardFocusInitially: true
- postBuildCallback: postBuildFileNameField:
- )
- )
-
- )
- )
- (HorizontalPanelViewSpec
- name: 'ButtonPanel'
- layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1)
- visibilityChannel: buttonPanelVisibleHolder
- horizontalLayout: fitSpace
- verticalLayout: center
- horizontalSpace: 3
- verticalSpace: 3
- reverseOrderIfOKAtLeft: true
- component:
- (SpecCollection
- collection: (
- (ActionButtonSpec
- label: 'Cancel'
- name: 'cancelButton'
- translateLabel: true
- labelChannel: cancelLabelHolder
- tabable: true
- model: doCancel
- extent: (Point 129 22)
- )
- (ActionButtonSpec
- label: 'Append'
- name: 'appendButton'
- visibilityChannel: appendButtonVisibleHolder
- translateLabel: true
- labelChannel: appendLabelHolder
- tabable: true
- model: appendPressed
- extent: (Point 129 22)
- )
- (ActionButtonSpec
- label: 'OK'
- name: 'okButton'
- translateLabel: true
- labelChannel: okLabelHolder
- tabable: true
- model: okPressed
- isDefault: true
- extent: (Point 130 22)
- )
- )
-
- )
- )
- )
-
- )
+ collection: (
+ (ViewSpec
+ name: 'FilePart'
+ layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0)
+ component:
+ (SpecCollection
+ collection: (
+ (MenuPanelSpec
+ name: 'ToolBar1'
+ layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 32 0)
+ tabable: true
+ menu: toolBarMenu
+ textDefault: true
+ )
+ (SubCanvasSpec
+ name: 'DirectoryContentsBrowser'
+ layout: (LayoutFrame 0 0.0 57 0 0 1.0 -30 1)
+ tabable: true
+ hasHorizontalScrollBar: false
+ hasVerticalScrollBar: false
+ majorKey: DirectoryContentsBrowser
+ createNewApplication: true
+ createNewBuilder: true
+ postBuildCallback: postBuildTreeBrowser:
+ )
+ (VariableHorizontalPanelSpec
+ name: 'VariableHorizontalPanel1'
+ layout: (LayoutFrame 0 0 32 0 0 1 57 0)
+ level: 1
+ showHandle: false
+ barLevel: 0
+ component:
+ (SpecCollection
+ collection: (
+ (ViewSpec
+ name: 'Box1'
+ )
+ (ViewSpec
+ name: 'Box2'
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'Filter:'
+ name: 'FilterLabel'
+ layout: (LayoutFrame 8 0 2 0 59 0 -2 1)
+ translateLabel: true
+ adjust: right
+ )
+ (InputFieldSpec
+ name: 'FilterEntryField'
+ layout: (LayoutFrame 60 0 -22 1 -2 1 -2 1)
+ model: filterHolder
+ immediateAccept: true
+ acceptOnReturn: true
+ acceptOnTab: true
+ acceptOnLostFocus: true
+ acceptOnPointerLeave: false
+ postBuildCallback: postBuildFilterField:
+ )
+ )
+
+ )
+ )
+ )
+
+ )
+ handles: (Any 0.5 1.0)
+ )
+ (LabelSpec
+ label: 'Filename:'
+ name: 'FilenameLabel'
+ layout: (LayoutFrame 3 0 -21 1 73 0 -1 1)
+ translateLabel: true
+ labelChannel: filenameLabelHolder
+ adjust: left
+ )
+ (FilenameInputFieldSpec
+ name: 'FilenameEntryField'
+ layout: (LayoutFrame 70 0 -21 1 -4 1 -1 1)
+ tabable: true
+ model: filenameHolder
+ immediateAccept: false
+ acceptOnPointerLeave: false
+ hasKeyboardFocusInitially: true
+ postBuildCallback: postBuildFileNameField:
+ )
+ )
+
+ )
+ )
+ (HorizontalPanelViewSpec
+ name: 'ButtonPanel'
+ layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1)
+ visibilityChannel: buttonPanelVisibleHolder
+ horizontalLayout: fitSpace
+ verticalLayout: center
+ horizontalSpace: 3
+ verticalSpace: 3
+ reverseOrderIfOKAtLeft: true
+ component:
+ (SpecCollection
+ collection: (
+ (ActionButtonSpec
+ label: 'Cancel'
+ name: 'cancelButton'
+ translateLabel: true
+ labelChannel: cancelLabelHolder
+ tabable: true
+ model: doCancel
+ extent: (Point 129 22)
+ )
+ (ActionButtonSpec
+ label: 'Append'
+ name: 'appendButton'
+ visibilityChannel: appendButtonVisibleHolder
+ translateLabel: true
+ labelChannel: appendLabelHolder
+ tabable: true
+ model: appendPressed
+ extent: (Point 129 22)
+ )
+ (ActionButtonSpec
+ label: 'OK'
+ name: 'okButton'
+ translateLabel: true
+ labelChannel: okLabelHolder
+ tabable: true
+ model: okPressed
+ isDefault: true
+ extent: (Point 130 22)
+ )
+ )
+
+ )
+ )
+ )
+
+ )
)
! !
@@ -883,118 +859,118 @@
<resource: #menu>
- ^
+ ^
#(Menu
- (
- (MenuItem
- activeHelpKey: directoryBack
- enabled: enableBack
- label: 'Back'
- itemValue: doBack
- translateLabel: true
- isButton: true
- submenuChannel: menuDirHistoryBack
- labelImage: (ResourceRetriever ToolbarIconLibrary historyBackIcon)
- keepLinkedMenu: true
- )
- (MenuItem
- activeHelpKey: directoryForward
- enabled: enableForward
- label: 'Forward'
- itemValue: doForward
- translateLabel: true
- isButton: true
- submenuChannel: menuDirHistoryForward
- labelImage: (ResourceRetriever ToolbarIconLibrary historyForwardIcon)
- keepLinkedMenu: true
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- activeHelpKey: directoryUp
- enabled: enableDirectoryUp
- label: 'DirectoryUp'
- itemValue: doGoDirectoryUp
- translateLabel: true
- isButton: true
- labelImage: (ResourceRetriever ToolbarIconLibrary directoryUpIcon)
- )
- (MenuItem
- label: ''
- )
- (MenuItem
- activeHelpKey: fileHome
- enabled: enableHome
- label: 'Home'
- itemValue: doGotoHomeDirectory
- translateLabel: true
- isButton: true
- labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon)
- )
- (MenuItem
- activeHelpKey: fileGotoBookmark
- label: 'Bookmarks'
- translateLabel: true
- isButton: true
- submenuChannel: gotoBookmarksMenuSpec
- labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon)
- )
- (MenuItem
- label: '-'
- isVisible: browseVisibleHolder
- )
- (MenuItem
- activeHelpKey: fileBrowse
- label: 'Browse'
- itemValue: doBrowseDirectory
- translateLabel: true
- isButton: true
- isVisible: browseVisibleHolder
- labelImage: (ResourceRetriever ToolbarIconLibrary fileBrowser24x24Icon)
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- label: 'New Directory...'
- itemValue: newDirectory
- translateLabel: true
- isButton: true
- isVisible: newDirectoryVisibilityHolder
- labelImage: (ResourceRetriever ToolbarIconLibrary newDirectoryIcon)
- )
- (MenuItem
- label: 'viewDetails'
- translateLabel: true
- isButton: true
- startGroup: right
- hideMenuOnActivated: false
- indication: viewDetails
- labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon)
- )
- (MenuItem
- activeHelpKey: toggleDetails
- label: 'viewDetails'
- translateLabel: true
- isButton: true
- startGroup: right
- isVisible: false
- indication: viewDetails
- submenuChannel: viewDetailsMenuSpec
- labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon)
- )
- (MenuItem
- activeHelpKey: selectDetails
- label: ''
- isButton: true
- startGroup: right
- submenuChannel: viewDetailsMenuSpec
- labelImage: (ResourceRetriever ToolbarIconLibrary empty1x20Icon)
- )
- )
- nil
- nil
+ (
+ (MenuItem
+ activeHelpKey: directoryBack
+ enabled: enableBack
+ label: 'Back'
+ itemValue: doBack
+ translateLabel: true
+ isButton: true
+ submenuChannel: menuDirHistoryBack
+ labelImage: (ResourceRetriever ToolbarIconLibrary historyBackIcon)
+ keepLinkedMenu: true
+ )
+ (MenuItem
+ activeHelpKey: directoryForward
+ enabled: enableForward
+ label: 'Forward'
+ itemValue: doForward
+ translateLabel: true
+ isButton: true
+ submenuChannel: menuDirHistoryForward
+ labelImage: (ResourceRetriever ToolbarIconLibrary historyForwardIcon)
+ keepLinkedMenu: true
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ activeHelpKey: directoryUp
+ enabled: enableDirectoryUp
+ label: 'DirectoryUp'
+ itemValue: doGoDirectoryUp
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary directoryUpIcon)
+ )
+ (MenuItem
+ label: ''
+ )
+ (MenuItem
+ activeHelpKey: fileHome
+ enabled: enableHome
+ label: 'Home'
+ itemValue: doGotoHomeDirectory
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon)
+ )
+ (MenuItem
+ activeHelpKey: fileGotoBookmark
+ label: 'Bookmarks'
+ translateLabel: true
+ isButton: true
+ submenuChannel: gotoBookmarksMenuSpec
+ labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon)
+ )
+ (MenuItem
+ label: '-'
+ isVisible: browseVisibleHolder
+ )
+ (MenuItem
+ activeHelpKey: fileBrowse
+ label: 'Browse'
+ itemValue: doBrowseDirectory
+ translateLabel: true
+ isButton: true
+ isVisible: browseVisibleHolder
+ labelImage: (ResourceRetriever ToolbarIconLibrary fileBrowser24x24Icon)
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'New Directory...'
+ itemValue: newDirectory
+ translateLabel: true
+ isButton: true
+ isVisible: newDirectoryVisibilityHolder
+ labelImage: (ResourceRetriever ToolbarIconLibrary newDirectoryIcon)
+ )
+ (MenuItem
+ label: 'viewDetails'
+ translateLabel: true
+ isButton: true
+ startGroup: right
+ hideMenuOnActivated: false
+ indication: viewDetails
+ labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon)
+ )
+ (MenuItem
+ activeHelpKey: toggleDetails
+ label: 'viewDetails'
+ translateLabel: true
+ isButton: true
+ startGroup: right
+ isVisible: false
+ indication: viewDetails
+ submenuChannel: viewDetailsMenuSpec
+ labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon)
+ )
+ (MenuItem
+ activeHelpKey: selectDetails
+ label: ''
+ isButton: true
+ startGroup: right
+ submenuChannel: viewDetailsMenuSpec
+ labelImage: (ResourceRetriever ToolbarIconLibrary empty1x20Icon)
+ )
+ )
+ nil
+ nil
)
"Modified: / 06-12-2006 / 12:08:39 / cg"
@@ -1025,7 +1001,7 @@
initialText
initialText isNil ifTrue:[
- ^ resources string:'File Dialog'.
+ ^ resources string:'File Dialog'.
].
^ resources string:initialText
!
@@ -1072,7 +1048,7 @@
"return the value of the instance variable 'startFilename' (automatically generated)"
startFilename isNil ifTrue:[
- startFilename := Filename currentDirectory asAbsoluteFilename.
+ startFilename := Filename currentDirectory asAbsoluteFilename.
].
^ startFilename
!
@@ -1188,7 +1164,7 @@
multipleSelect:aBoolean
multipleSelect := aBoolean.
contentsBrowser notNil ifTrue:[
- contentsBrowser multipleSelect:aBoolean.
+ contentsBrowser multipleSelect:aBoolean.
].
! !
@@ -1196,9 +1172,9 @@
addButton:aButton
DialogBox defaultOKButtonAtLeft ifTrue:[
- (self componentAt:#ButtonPanel) addSubView:aButton before:(self okButton)
+ (self componentAt:#ButtonPanel) addSubView:aButton before:(self okButton)
] ifFalse:[
- (self componentAt:#ButtonPanel) addSubView:aButton after:(self okButton)
+ (self componentAt:#ButtonPanel) addSubView:aButton after:(self okButton)
].
!
@@ -1209,7 +1185,7 @@
!
okButton
- ^ (self componentAt:#okButton)
+ ^ (self componentAt:#okButton)
! !
!FileDialogV2 methodsFor:'accessing-look'!
@@ -1224,7 +1200,7 @@
newDirectoryVisibilityHolder
newDirectoryVisibilityHolder isNil ifTrue:[
- newDirectoryVisibilityHolder := true asValue.
+ newDirectoryVisibilityHolder := true asValue.
].
^ newDirectoryVisibilityHolder
!
@@ -1249,14 +1225,14 @@
appendButtonVisibleHolder
appendButtonVisibleHolder isNil ifTrue:[
- appendButtonVisibleHolder := false asValue.
+ appendButtonVisibleHolder := false asValue.
].
^ appendButtonVisibleHolder
!
appendLabelHolder
appendLabelHolder isNil ifTrue:[
- appendLabelHolder := 'Append' asValue.
+ appendLabelHolder := 'Append' asValue.
].
^ appendLabelHolder
!
@@ -1265,17 +1241,17 @@
"this hook provides an aspect for a subApp"
aKey == #currentFileNameHolder ifTrue:[
- directory notNil ifTrue:[
- ^ (OrderedCollection with:directory) asValue
- ]
+ directory notNil ifTrue:[
+ ^ (OrderedCollection with:directory) asValue
+ ]
].
^ nil
!
buttonPanelVisibleHolder
buttonPanelVisibleHolder isNil ifTrue:[
- buttonPanelVisibleHolder := true asValue.
- buttonPanelVisibleHolder onChangeSend:#buttonPanelVisibilityChanged to:self.
+ buttonPanelVisibleHolder := true asValue.
+ buttonPanelVisibleHolder onChangeSend:#buttonPanelVisibilityChanged to:self.
].
^ buttonPanelVisibleHolder.
!
@@ -1289,7 +1265,7 @@
"*** (and replace this comment by something more useful ;-)"
cancelLabelHolder isNil ifTrue:[
- cancelLabelHolder := 'Cancel' asValue.
+ cancelLabelHolder := 'Cancel' asValue.
].
^ cancelLabelHolder.
!
@@ -1319,10 +1295,10 @@
holder := builder bindingAt:#filenameHolder.
holder ifNil:[
- holder := ValueHolder new.
- holder addDependent:self.
- builder aspectAt:#filenameHolder
- put:holder.
+ holder := ValueHolder new.
+ holder addDependent:self.
+ builder aspectAt:#filenameHolder
+ put:holder.
].
^ holder.
@@ -1332,7 +1308,7 @@
"Return a value holder for the input string.
"
filenameLabelHolder isNil ifTrue:[
- filenameLabelHolder := 'Filename:' asValue.
+ filenameLabelHolder := 'Filename:' asValue.
].
^ filenameLabelHolder
!
@@ -1342,10 +1318,10 @@
"
filterHolder isNil ifTrue:[
- filterHolder := contentsBrowser filterModel.
- self pattern notNil ifTrue:[
- filterHolder value:pattern.
- ]
+ filterHolder := contentsBrowser filterModel.
+ self pattern notNil ifTrue:[
+ filterHolder value:pattern.
+ ]
].
^ filterHolder
!
@@ -1386,7 +1362,7 @@
"*** (and replace this comment by something more useful ;-)"
okLabelHolder isNil ifTrue:[
- okLabelHolder := 'OK' asValue.
+ okLabelHolder := 'OK' asValue.
].
^ okLabelHolder.
! !
@@ -1398,12 +1374,12 @@
filePart := builder componentAt:#FilePart.
filePart notNil ifTrue:[
- buttonPanelVisibleHolder value ifTrue:[
- filePart layout bottomOffset:-40
- ] ifFalse:[
- filePart layout bottomOffset:0
- ].
- filePart containerChangedSize "/ force resize
+ buttonPanelVisibleHolder value ifTrue:[
+ filePart layout bottomOffset:-40
+ ] ifFalse:[
+ filePart layout bottomOffset:0
+ ].
+ filePart containerChangedSize "/ force resize
]
!
@@ -1411,40 +1387,40 @@
|files newFile newLabel fn entryFieldFilename|
changedObject == contentsBrowser currentFileNameHolder ifTrue:[
- files := changedObject value.
+ files := changedObject value.
- (files isEmpty) ifTrue:[
- newFile := nil.
- ] ifFalse:[
- files size == 1 ifTrue:[
- newFile := files first.
- ] ifFalse:[
- newFile := ''.
- ].
- ].
- (self filenameHolder value notNil and:[newFile asFilename isDirectory]) ifTrue:[
- entryFieldFilename := self filenameHolder value asFilename.
- self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[
- entryFieldFilename isDirectory not ifTrue:[
- newFile := newFile asFilename construct:entryFieldFilename baseName.
- ].
- ].
- ].
- self filenameHolder value:newFile withoutNotifying:self.
+ (files isEmpty) ifTrue:[
+ newFile := nil.
+ ] ifFalse:[
+ files size == 1 ifTrue:[
+ newFile := files first.
+ ] ifFalse:[
+ newFile := ''.
+ ].
+ ].
+ (self filenameHolder value notNil and:[newFile asFilename isDirectory]) ifTrue:[
+ entryFieldFilename := self filenameHolder value asFilename.
+ self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[
+ entryFieldFilename isDirectory not ifTrue:[
+ newFile := newFile asFilename construct:entryFieldFilename baseName.
+ ].
+ ].
+ ].
+ self filenameHolder value:newFile withoutNotifying:self.
].
changedObject == contentsBrowser viewFilesInDirectoryTree ifTrue:[
- changedObject value ifTrue:[
- newLabel := 'Filename:'.
- ] ifFalse:[
- newLabel := 'Directory:'.
- ].
- self filenameLabelHolder value:(resources string:newLabel)
+ changedObject value ifTrue:[
+ newLabel := 'Filename:'.
+ ] ifFalse:[
+ newLabel := 'Directory:'.
+ ].
+ self filenameLabelHolder value:(resources string:newLabel)
].
changedObject == self filenameHolder ifTrue:[
- fn := changedObject value asFilename.
- (fn exists) ifFalse:[^ self].
- contentsBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self.
+ fn := changedObject value asFilename.
+ (fn exists) ifFalse:[^ self].
+ contentsBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self.
].
^ super update:something with:aParameter from:changedObject
! !
@@ -1474,7 +1450,7 @@
contentsBrowser := aSubCanvasView client.
!
-postBuildWith:aBuilder
+postBuildWith:aBuilder
contentsBrowser multipleSelect:multipleSelect.
appendWasPressed := false.
@@ -1492,7 +1468,7 @@
"No ok and cancel buttons, when dialog is part of a larger dialog"
self window topView isModal ifFalse:[
- self hideButtonPanel
+ self hideButtonPanel
].
contentsBrowser currentFileNameHolder addDependent:self.
@@ -1511,18 +1487,18 @@
self isLoadDialog ifTrue:[
"/ contentsBrowser newVisibilityHolder value:false.
"/ contentsBrowser allowFileOperations value:false.
- self newDirectoryVisibilityHolder value:false.
+ self newDirectoryVisibilityHolder value:false.
].
self filenameHolder value:self startFilename.
self window label:self initialText.
!
-postOpenAsSubcanvasWith:aBuilder
+postOpenAsSubcanvasWith:aBuilder
self postOpen.
^ super postOpenAsSubcanvasWith:aBuilder
!
-postOpenWith:aBuilder
+postOpenWith:aBuilder
self postOpen.
^ super postOpenWith:aBuilder.
@@ -1534,12 +1510,12 @@
|ev|
ev := self windowGroup lastEvent.
- (ev notNil
- and:[ev isKeyEvent
+ (ev notNil
+ and:[ev isKeyEvent
and:[ev key == #Return
- and:[( ev targetView isSameOrComponentOf:filterField)
- or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[
- ^ true
+ and:[( ev targetView isSameOrComponentOf:filterField)
+ or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[
+ ^ true
].
^ false
!
@@ -1548,12 +1524,12 @@
|ev|
ev := self windowGroup lastEvent.
- (ev notNil
- and:[ev isKeyEvent
+ (ev notNil
+ and:[ev isKeyEvent
and:[ev key == #Return
- and:[( ev targetView isSameOrComponentOf:filterField)
- or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[
- ^ true
+ and:[( ev targetView isSameOrComponentOf:filterField)
+ or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[
+ ^ true
].
^ false
! !
@@ -1576,7 +1552,7 @@
"force accept - ignore in filterField"
self returnWasPressedInFilterField ifTrue:[
- ^ self
+ ^ self
].
appendWasPressed := false.
self commonAcceptAction.
@@ -1635,5 +1611,5 @@
!FileDialogV2 class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/FileDialogV2.st,v 1.6 2006-12-06 11:09:13 cg Exp $'
+ ^ '$Header$'
! !