#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Wed, 08 Feb 2017 19:45:40 +0100
changeset 17374 b5dded40c579
parent 17373 62c44bf0d8d5
child 17375 a766e86b4498
#BUGFIX by cg class: FileBrowserV2 comment/format in: #on: #open #openOn: #openOn:withExtent: #openOnDirectory: #openWithAspects:withExtent: changed: #onDirectory: fix: expect a single filename; collection of files is rubbish (and the code for it broke the regular case)
FileBrowserV2.st
--- a/FileBrowserV2.st	Wed Feb 08 19:41:27 2017 +0100
+++ b/FileBrowserV2.st	Wed Feb 08 19:45:40 2017 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2002 by eXept Software AG
 	      All Rights Reserved
@@ -87,17 +89,22 @@
 !FileBrowserV2 class methodsFor:'instance creation'!
 
 on:aDirectoryPath
-    "return a new FileBrowserV2 in a pathname"
+    "return a new FileBrowserV2 in a pathname.
+     The browser is not yet open"
 
     |instance|
 
     instance := self new.
     instance onDirectory:aDirectoryPath.
     ^ instance
+
+    "
+     (self on:'/etc') open
+    "
 !
 
 open
-    "start a new FileBrowserV2"
+    "start a new FileBrowserV2 (in the current directory)"
 
     | instance |
     instance := self new.
@@ -105,6 +112,7 @@
     ^ instance
 
     "
+     FileBrowserV2 open.
      FileBrowserV2 openOn:(OrderedCollection with:(Filename currentDirectory asAbsoluteFilename)) withExtent:800@600
     "
 !
@@ -116,15 +124,17 @@
 !
 
 openOn:aFileOrDirectoryPath
-    "start a new FileBrowserV2 in a pathname"
+    "start a new FileBrowserV2 on aFileOrDirectoryPath.
+     if it represents a file, it is opened and shown for editing;
+     if it represents a directory, the directory is shown."
 
     |fn|
 
     fn := aFileOrDirectoryPath asFilename.
     fn isDirectory ifFalse:[
-	^ self openOnFileNamed:aFileOrDirectoryPath
+        ^ self openOnFileNamed:aFileOrDirectoryPath
     ] ifTrue:[
-	^ self openOn:fn withExtent:nil
+        ^ self openOn:fn withExtent:nil
     ].
 
     "
@@ -136,14 +146,14 @@
 !
 
 openOn:aDirectoryPath withExtent:extentOrNil
-    "start a new FileBrowserV2 in a pathname"
+    "start a new FileBrowserV2 on aDirectoryPath"
 
     |instance builder|
 
     instance := self on:aDirectoryPath.
     builder := instance open.
     extentOrNil notNil ifTrue:[
-	builder window extent:extentOrNil.
+        builder window extent:extentOrNil.
     ].
     ^ instance
 
@@ -158,7 +168,11 @@
     ^ self openOn:aDirectoryPath withExtent:nil
 
     "
-     FileBrowserV2 openOn:(OrderedCollection with:(Filename currentDirectory asAbsoluteFilename)) withExtent:800@600
+     FileBrowserV2 
+            openOn:(OrderedCollection 
+                        with:(Filename currentDirectory asAbsoluteFilename)
+                   ) 
+            withExtent:800@600
     "
 !
 
@@ -191,7 +205,8 @@
 !
 
 openWithAspects:someAspects withExtent:extent
-    "start a new FileBrowserV2 in a pathname"
+    "start a new FileBrowserV2 taking aspects from a dictionary
+     (internal interface - only for spawn)"
 
     |dir clone|
 
@@ -2470,16 +2485,12 @@
 !
 
 onDirectory:aDirectoryPathOrNil
-    |files|
+    |directory|
 
     self createBuilder.
     aDirectoryPathOrNil notNil ifTrue:[
-	aDirectoryPathOrNil isCollection ifTrue:[
-	    files := aDirectoryPathOrNil
-	] ifFalse:[
-	    files := Array with:aDirectoryPathOrNil.
-	].
-	self currentFileNameHolder value:files.
+        directory := aDirectoryPathOrNil asFilename.
+        self currentFileNameHolder value:{ directory }.
     ].
 !