FilenameEditFieldV2.st
changeset 5012 47e675b8c9fe
parent 4743 4236ffd981fc
child 5140 36c7da05d814
--- a/FilenameEditFieldV2.st	Tue Jul 01 11:19:57 2003 +0200
+++ b/FilenameEditFieldV2.st	Tue Jul 01 11:35:44 2003 +0200
@@ -147,51 +147,6 @@
     "Modified: 6.9.1995 / 20:34:57 / claus"
 ! !
 
-!FilenameEditFieldV2 methodsFor:'event handling'!
-
-keyPress:key x:x y:y
-    "handle tab for filename completion.
-     Bug: it completes the last word; it should complete the
-          word before the cursor."
-
-    <resource: #keyboard ( #Tab #FilenameCompletion ) >
-
-    |oldContents newContents myEditor|
-
-    myEditor := self editor.
-    myEditor enabled ifTrue:[
-        ((key == myEditor entryCompletionCharacter)
-        or:[key == #FilenameCompletion]) ifTrue:[
-            oldContents := self contents.
-            oldContents isNil ifTrue:[
-                oldContents := ''
-            ] ifFalse:[
-                oldContents := oldContents asString
-            ].
-            myEditor entryCompletionBlock value:oldContents.
-
-            newContents := self contents.
-            newContents isNil ifTrue:[
-                newContents := ''
-            ] ifFalse:[
-                newContents := newContents asString
-            ].
-            newContents ~= oldContents ifTrue:[
-                self textChanged.
-                acceptOnExpand ifTrue:[
-                    self accept 
-                ]
-            ].
-            ^ self
-        ].
-        self list:nil.
-        pullDownButton turnOff.
-    ].
-    ^ super keyPress:key x:x y:y.
-
-    "Modified: 7.3.1996 / 13:16:49 / cg"
-! !
-
 !FilenameEditFieldV2 methodsFor:'initialization'!
 
 initialize
@@ -223,8 +178,10 @@
                                 self action:[: string |  | newFile |
                                     string isString ifTrue:[
                                         newFile := string asFilename.
-                                        (newFile name endsWith:newFile separator) ifFalse:[
-                                            myEditor contents:(newFile name copyWith:newFile separator)
+                                        (newFile exists and:[newFile isDirectory]) ifTrue:[
+                                            (newFile name endsWith:newFile separator) ifFalse:[
+                                                 myEditor contents:(newFile name copyWith:newFile separator)
+                                            ].
                                         ].
                                     ]
                                 ].
@@ -313,5 +270,5 @@
 !FilenameEditFieldV2 class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FilenameEditFieldV2.st,v 1.6 2003-03-29 15:49:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FilenameEditFieldV2.st,v 1.7 2003-07-01 09:35:44 cg Exp $'
 ! !