FileSelectionBox.st
changeset 2354 373ee1f525e3
parent 2231 48ab82d819bc
child 2375 1e3b7281d4ac
--- a/FileSelectionBox.st	Thu Apr 19 15:53:06 2001 +0200
+++ b/FileSelectionBox.st	Sun Apr 22 13:34:23 2001 +0200
@@ -300,8 +300,8 @@
      the MenuEditor may not be able to read the specification."
 
     "
-     MenuEditor new openOnClass:FileSelectionBox andSelector:#menu
-     (Menu new fromLiteralArrayEncoding:(FileSelectionBox menu)) startUp
+     MenuEditor new openOnClass:FileSelectionBox andSelector:#fileListMenu
+     (Menu new fromLiteralArrayEncoding:(FileSelectionBox fileListMenu)) startUp
     "
 
     <resource: #menu>
@@ -314,6 +314,14 @@
             #translateLabel: true
             #value: #fileListMenuNewFolder
           )
+         #(#MenuItem
+            #label: '-'
+          )
+         #(#MenuItem
+            #label: 'Remove...'
+            #translateLabel: true
+            #value: #fileListMenuRemove
+          )
          )
         nil
         nil
@@ -567,6 +575,25 @@
     "
      self open
     "
+!
+
+fileListMenuRemove
+    |selectedFilename baseName|
+
+    selectedFilename := self pathName asFilename.
+    baseName := selectedFilename baseName.
+
+    (Dialog confirm:(resources string:'Really remove ''%1'' ?' with:baseName allBold)) ifFalse:[
+        ^ self.
+    ].
+
+    selectedFilename isDirectory ifTrue:[
+        self warn:(resources string:'%1 is a directory..' with:baseName).
+        ^ self.
+    ].
+
+    selectedFilename delete.
+    self updateList.
 ! !
 
 !FileSelectionBox methodsFor:'private'!
@@ -716,5 +743,5 @@
 !FileSelectionBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionBox.st,v 1.57 2000-08-23 12:57:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionBox.st,v 1.58 2001-04-22 11:34:23 cg Exp $'
 ! !