FileBrowserV2.st
author Claus Gittinger <cg@exept.de>
Tue, 13 May 2003 18:12:06 +0200
changeset 4884 cc5186c383b1
parent 4819 e43202c670cd
child 4904 bf2dd6a13fa5
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1991 by Claus Gittinger
              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
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

"{ Package: 'stx:libtool' }"

AbstractFileBrowser subclass:#FileBrowserV2
	instanceVariableNames:'fileEntryFieldHolder pathEntryField previewProcess
		listOfDeviceDrives selectedDeviceDrive'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Tools-File'
!

!FileBrowserV2 class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1991 by Claus Gittinger
              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
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    FileBrowserV2 is based on Filebrowser created by Claus Gittinger

    WARNING: files edited with FileBrowser will have leading spaces (multiple-8)
             being replaced by tabs. If tabs are to be preserved at other
             positions (for example, sendmail-config files) they will be
             corrupt after being written.

    [instance variables]:

        checkDelta      <Integer>       number of seconds of check interval
                                        (looks ever so often if shown directory
                                         has changed). You may make this number
                                        higher, if your network-times are
                                        incorrect and thus, the filebrowser
                                        checks too often.

        compressTabs    <Boolean>       if true, leading spaces will be
                                        replaced by tabs when saving text

    some of the defaults (long/short list etc.) can be set by the resource file;
    see FileBrowser>>initialize for more details..

    [author:]
        Christian Penk

    [start with:]
        FileBrowserV2 open
"
! !

!FileBrowserV2 class methodsFor:'instance creation'!

on:aDirectoryPath
    "return a new FileBrowserV2 in a pathname"

    |instance files|
    instance := self new createBuilder.
    aDirectoryPath isCollection ifTrue:[
        files := aDirectoryPath
    ] ifFalse:[
        files := Array with:aDirectoryPath.
    ].
    instance currentFileNameHolder value:files.
    ^ instance
!

open
    "start a new FileBrowserV2"

    | instance |
    instance := self new.
    instance open.
    ^ instance
    "
     FileBrowserV2 openOn:(OrderedCollection with:(Filename currentDirectory asAbsoluteFilename)) withExtent:800@600
    "
!

openOn:aDirectoryPath 
    "start a new FileBrowserV2 in a pathname"

    | instance|
    instance := self on:aDirectoryPath asFilename.
    ^ instance open.
    "
     FileBrowserV2 openOn:(OrderedCollection with:(Filename currentDirectory asAbsoluteFilename))
    "
!

openOn:aDirectoryPath withExtent:extent
    "start a new FileBrowserV2 in a pathname"

    | instance builder|
    instance := self on:aDirectoryPath.
    builder := instance open.
    builder window extent:extent.
    ^ instance
    "
     FileBrowserV2 openOn:(OrderedCollection with:(Filename currentDirectory asAbsoluteFilename)) withExtent:800@600
    "
!

openWithAspects:someAspects withExtent:extent
    "start a new FileBrowserV2 in a pathname"

    |dir clone|

    dir := someAspects at:#currentFileNameHolder ifAbsent:nil.
    clone := self openOn:(dir value) withExtent:extent.
! !

!FileBrowserV2 class methodsFor:'class initialization'!

applicationIcon
    ^ NewLauncher startNewFileBrowserIcon
!

clearHistoryIcon
    ^ Icon deleteIcon
!

initialize

    self installInLauncher.
!

installInLauncher
    "add myself to the launcher menu and toolBar"

    |menuItem icon action currentLauncher|

    FileBrowserV2 isNil ifTrue:[^ self].

    action := [FileBrowserV2 open].

    icon := self applicationIcon. "/ self defaultIcon magnifiedTo:28@28.

    menuItem := MenuItem new 
                    translateLabel: true;
                    value: action;
                    isButton: false;
                    label:'File Browser V2' icon:icon;
                    nameKey: #fileBrowserV2;
                    activeHelpKey: #fileBrowserV2;
                    submenuChannel: #menuFileHistory;
                    showBusyCursorWhilePerforming:true.

    NewLauncher addMenuItem:menuItem in:'menu.file' position:#( #before #fileBrowser) space:true.

    menuItem := MenuItem new 
                    translateLabel: true;
                    value: action;
                    isButton: true;
                    "label:'File Browser V2'" icon:icon;
                    nameKey: #fileBrowserV2;
                    activeHelpKey: #fileBrowserV2;
                    submenuChannel: #menuFileHistory;
                    showBusyCursorWhilePerforming:true.

    NewLauncher addMenuItem:menuItem in:'toolbar' position:#( #before #fileBrowser) space:false.

    currentLauncher := NewLauncher current.
    currentLauncher notNil ifTrue:[
        currentLauncher fileBrowserItemVisible value:false
    ].
    NewLauncher addSettingsApplicationByClass:#'FileBrowserV2SettingsAppl' 
                withName:'Tools/FileBrowserV2' 
                icon:nil.

    "
     self installInLauncher
     self removeFromLauncher
    "
!

removeFromLauncher
    "/
    "/ remove myself from the launcher menu
    "/

    |currentLauncher|

    NewLauncher isNil ifTrue:[^ self].
    NewLauncher removeUserTool:#fileBrowserV2.
    currentLauncher := NewLauncher current.
    currentLauncher notNil ifTrue:[
        currentLauncher fileBrowserItemVisible value:false
    ].
    NewLauncher removeSettingsApplicationByClass:#'FileBrowserV2SettingsAppl'.

    "
     self removeFromLauncher
    "
! !

!FileBrowserV2 class methodsFor:'defaults'!

entryFieldEndStringForMultipleSelection

    ^ ('[*]')
! !

!FileBrowserV2 class methodsFor:'help specs'!

flyByHelpSpec
    <resource: #help>

    |spec hist|

    spec := super flyByHelpSpec addPairsFrom:#(

#addTerminal
'Shell Terminal'

#make
'Make'

#searchFile
'Search a File'

#directoryUp
'Directory Up'

#directoryBack
'Directory Back'

#directoryForward
'Directory Forward'

#directoryHistory
'Directory'

#copyFile
'Copy File'

#cutFile
'Cut File'

#fileHome
'Home Directory'

#fileGotoDefault
'Default Directory (ST/X Start Directory)'

#pasteFile
'PasteFile'

#deleteFile
'Delete File'

#fileIn
'File In'

#fileHistory
'File History'

#hideToolBar
'Hide Toolbar'

#hideFilenameEntryField
'Hide Filename Field'

#showFileDetails
'Show File Details'

#hideFileDetails
'Hide File Details'

#toggleDetails
'Show/Hide File Details'

).

    hist := self directoryHistory.
    hist notNil ifTrue:[
        hist canForward ifTrue:[
            spec at:#directoryForward put:(self classResources string:'Forward to: %1' with:hist nextForwardItem).
        ].
        hist canBackward ifTrue:[
            spec at:#directoryBack put:(self classResources string:'Back to: %1' with:hist nextBackwardItem).
        ].
    ].
    ^ 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."

    "
     UIHelpTool openOnClass:FileBrowserV2    
    "

    <resource: #help>

    ^ super helpSpec addPairsFrom:#(

#toggleDetails
''

)
! !

!FileBrowserV2 class methodsFor:'icon'!

defaultIcon
    "This resource specification was automatically generated
     by the ImageEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the ImageEditor may not be able to read the specification."

    "
     self defaultIcon inspect
     ImageEditor openOnClass:self andSelector:#defaultIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'FileBrowserV2 class defaultIcon'
        ifAbsentPut:[(Depth4Image new) width: 28; height: 28; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
@@@@@@@@@@@@@@@@@@@@CLA&Y&Y&Y&X@@ADP@@@L0F@@@@@@A @ADAD@@@3@XN;.;.8F@ADPDQ@@CLA ;.@@@@@@D@@@D@@L0FC.8O[6=/@QDADP@@3@X@; 
[6=/[0DPDP@@CLA DNC6<@@F<ADP@@@L0F@A@F= [0= @@@@@@3@X@@P=/[6=/@@@@@@CLA @@A/[6=/X@@@@@@L0FC0@O[6=/[0@@@@@@3@XF<@@@@@@@@@
@@@@CLA = @@@@@@@@@@@@@L0FA/[6=/A @@@@@@@@3@XO[6=/XF@@@@@@@@CLA @@@@@@X@@@@@@@@L0FY&Y&Y&Y @@@@@@@@C@Y&Y&Y&Y&@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@N@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@C @b') ; colorMapFromArray:#[0 0 0 255 255 255 255 0 0 0 255 0 0 0 255 0 255 255 255 255 0 255 0 255 127 0 0 0 127 0 0 0 127 0 127 127 127 127 0 127 0 127 127 127 127 170 170 170]; mask:((Depth1Image new) width: 28; height: 28; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
O??# C??9<@??>? O???<C????@????0O???8C???<@???>@O??<@C???@@???0@O??<@C??8@@??>@@O?? @C??8@@??>@@G?? @@??8@@@@@@@G.P=0AAD
HP@PQBD@GDP8 AADHD@PQBA@DN^=0@@a') ; yourself); yourself]
!

hideFilenameEntryFieldIcon
    <resource: #programImage>

    ^ ToolbarIconLibrary hideToolbarIconH14
!

hideToolBarIcon
    <resource: #programImage>

    ^ ToolbarIconLibrary hideToolbarIconH26
! !

!FileBrowserV2 class methodsFor:'image specs'!

viewDetailsIcon
    "This resource specification was automatically generated
     by the ImageEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the ImageEditor may not be able to read the specification."

    "
     self viewDetailsIcon inspect
     ImageEditor openOnClass:self andSelector:#viewDetailsIcon
     Icon flushCachedIcons
    "

    <resource: #image>

    ^Icon
        constantNamed:#'FileBrowserV2 class viewDetailsIcon'
        ifAbsentPut:[(Depth1Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@]+X@@@@@]+X@@@@@]+X@@@@@]+X@@@@@@@@b') ; yourself); yourself]
!

viewNoDetailsIcon
    "This resource specification was automatically generated
     by the ImageEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the ImageEditor may not be able to read the specification."

    "
     self viewNoDetailsIcon inspect
     ImageEditor openOnClass:self andSelector:#viewNoDetailsIcon
     Icon flushCachedIcons
    "

    <resource: #image>

    ^Icon
        constantNamed:#'FileBrowserV2 class viewNoDetailsIcon'
        ifAbsentPut:[(Depth1Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@A<@@@@@@A<@@@@@@A<@@@@@@A<@@@@@@@@@b') ; yourself); yourself]
! !

!FileBrowserV2 class methodsFor:'interface specs'!

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:FileBrowserV2 andSelector:#windowSpec
     FileBrowserV2 new openInterface:#windowSpec
     FileBrowserV2 open
    "

    <resource: #canvas>

    OperatingSystem isMSWINDOWSlike ifTrue:[
        ^ self windowSpecWindows
    ].
    ^ self windowSpecNonWindows
!

windowSpecNonWindows
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:FileBrowserV2 andSelector:#windowSpecNonWindows
     FileBrowserV2 new openInterface:#windowSpecNonWindows
    "

    <resource: #canvas>

    ^ 
     #(#FullSpec
        #name: #windowSpecNonWindows
        #window: 
       #(#WindowSpec
          #label: #FileBrowser
          #name: #FileBrowser
          #min: #(#Point 10 10)
          #bounds: #(#Rectangle 16 46 816 646)
          #menu: #mainMenu
          #icon: #applicationIcon
        )
        #component: 
       #(#SpecCollection
          #collection: #(
           #(#ViewSpec
              #name: 'ToolbarBox'
              #layout: #(#LayoutFrame 0 0 0 0 0 1 30 0)
              #level: 0
              #visibilityChannel: #toolBarVisibleHolder
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#ActionButtonSpec
                    #label: 'hideToolBarIcon'
                    #name: 'HideToolBarButton'
                    #layout: #(#LayoutFrame 0 0 0 0 13 0 30 0)
                    #activeHelpKey: #hideToolBar
                    #hasCharacterOrientedLabel: false
                    #translateLabel: true
                    #model: #hideToolbar
                    #postBuildCallback: #hideToolBarButtonCreated:
                  )
                 #(#MenuPanelSpec
                    #name: 'ToolBar'
                    #layout: #(#LayoutFrame 13 0 0 0 0 1 30 0)
                    #menu: #toolBarMainMenu
                    #textDefault: true
                  )
                 )
               
              )
            )
           #(#ViewSpec
              #name: 'FilenameEntryFieldBox'
              #layout: #(#LayoutFrame 0 0 30 0 0 1 55 0)
              #level: 0
              #visibilityChannel: #filenameEntryFieldVisibleHolder
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#ActionButtonSpec
                    #label: 'hideFilenameEntryFieldIcon'
                    #name: 'HideFilenameEntryFieldButton'
                    #layout: #(#LayoutFrame 0 0 0 0 13 0 0 1)
                    #activeHelpKey: #hideFilenameEntryField
                    #hasCharacterOrientedLabel: false
                    #translateLabel: true
                    #model: #hideFilenameEntryField
                    #postBuildCallback: #hideFilenameEntryFieldButtonCreated:
                  )
                 #(#ViewSpec
                    #name: 'Box1'
                    #layout: #(#LayoutFrame 13 0.0 0 0.0 0 1.0 0 1.0)
                    #level: 1
                    #component: 
                   #(#SpecCollection
                      #collection: #(
                       #(#VariableHorizontalPanelSpec
                          #name: 'VariableHorizontalPanel1'
                          #layout: #(#LayoutFrame 1 0.0 1 0.0 -1 1.0 -1 1.0)
                          #level: 0
                          #showHandle: true
                          #component: 
                         #(#SpecCollection
                            #collection: #(
                             #(#NonScrollableArbitraryComponentSpec
                                #name: 'NonScrollableArbitraryComponent1'
                                #component: #FilenameEditFieldV2
                                #postBuildCallback: #postBuildEditField:
                              )
                             #(#ViewSpec
                                #name: 'FilterBox'
                                #component: 
                               #(#SpecCollection
                                  #collection: #(
                                   #(#LabelSpec
                                      #label: 'Filter:'
                                      #name: 'Filter'
                                      #layout: #(#LayoutFrame 0 0 0 0 40 0 0 1)
                                      #translateLabel: true
                                      #adjust: #left
                                      #postBuildCallback: #postBuildPathViewBox:
                                    )
                                   #(#ComboBoxSpec
                                      #name: 'FilterSelectionBox'
                                      #layout: #(#LayoutFrame 40 0 0 0 0 1 0 1)
                                      #model: #filterModel
                                      #immediateAccept: true
                                      #acceptOnPointerLeave: false
                                      #comboList: #filterListModel
                                    )
                                   )
                                 
                                )
                                #postBuildCallback: #postBuildPathViewBox:
                              )
                             )
                           
                          )
                          #handles: #(#Any 0.8 1.0)
                          #postBuildCallback: #postBuildPathViewBox:
                        )
                       )
                     
                    )
                    #postBuildCallback: #postBuildPathViewBox:
                  )
                 )
               
              )
            )
           #(#'FileBrowserV2UISpecifications::PanelSpec'
              #name: 'BrowserBox'
              #layout: #(#LayoutFrame 0 0.0 55 0.0 0 1.0 -20 1.0)
              #level: 0
              #showHandle: true
              #snapMode: #both
              #whichView: #last
              #orientation: #vertical
              #visibility: #viewNoteBookApplicationHolder
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#'FileBrowserV2UISpecifications::PanelSpec'
                    #name: 'HorizontalPanel'
                    #level: 0
                    #snapMode: #both
                    #whichView: #first
                    #orientation: #horizontal
                    #visibility: #showDirectoryTree
                    #component: 
                   #(#SpecCollection
                      #collection: #(
                       #(#SubCanvasSpec
                          #name: 'DirectoryTreeBrowser'
                          #hasHorizontalScrollBar: false
                          #hasVerticalScrollBar: false
                          #majorKey: #DirectoryTreeBrowser
                          #createNewApplication: true
                          #createNewBuilder: true
                          #postBuildCallback: #postBuildDirectoryTree:
                        )
                       #(#SubCanvasSpec
                          #name: 'DirectoryContentsBrowser'
                          #hasHorizontalScrollBar: false
                          #hasVerticalScrollBar: false
                          #majorKey: #DirectoryContentsBrowser
                          #createNewApplication: true
                          #createNewBuilder: true
                        )
                       )
                     
                    )
                    #handles: #(#Any 0.225 1.0)
                  )
                 #(#SubCanvasSpec
                    #name: 'FileApplicationNoteBook'
                    #tabable: false
                    #hasHorizontalScrollBar: false
                    #hasVerticalScrollBar: false
                    #majorKey: #FileApplicationNoteBook
                    #createNewApplication: true
                    #createNewBuilder: true
                  )
                 )
               
              )
              #handles: #(#Any 0.5 1.0)
            )
           #(#ViewSpec
              #name: 'Box2'
              #layout: #(#LayoutFrame 0 0 -20 1 0 1 0 1)
              #level: 0
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#LabelSpec
                    #label: 'NotifyLabel'
                    #name: 'NotifyLabel'
                    #layout: #(#LayoutFrame 0 0 1 0.0 -188 1 1 1.0)
                    #level: -1
                    #translateLabel: true
                    #labelChannel: #notifyChannel
                    #adjust: #left
                  )
                 #(#LabelSpec
                    #label: 'Shown Files'
                    #name: 'Label1'
                    #layout: #(#LayoutFrame -188 1 1 0.0 1 1 1 1.0)
                    #level: -1
                    #translateLabel: true
                    #labelChannel: #shownFiles
                    #adjust: #right
                    #postBuildCallback: #postBuildFilterBox:
                  )
                 #(#ProgressIndicatorSpec
                    #name: 'ProgressIndicator1'
                    #layout: #(#LayoutFrame -250 1 4 0 -188 1 -4 1)
                    #visibilityChannel: #activityVisibilityChannel
                    #backgroundColor: #(#Color 0.0 66.6667 66.6667)
                    #isActivityIndicator: true
                  )
                 )
               
              )
            )
           #(#LabelSpec
              #label: 'Preview'
              #name: 'PreviewLabel'
              #layout: #(#LayoutFrame 0 0.5 39 0 100 0.5 61 0)
              #level: 0
              #borderWidth: 1
              #visibilityChannel: #previewVisibleHolder
              #backgroundColor: #(#Color 86.9993 86.9993 86.9993)
              #translateLabel: true
            )
           #(#ArbitraryComponentSpec
              #name: 'Preview'
              #layout: #(#LayoutFrame 0 0.5 63 0 -147 1 -319 1)
              #level: 1
              #visibilityChannel: #previewVisibleHolder
              #hasBorder: false
              #component: #ImageView
            )
           )
         
        )
      )
!

windowSpecWindows
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:FileBrowserV2 andSelector:#windowSpecWindows
     FileBrowserV2 new openInterface:#windowSpecWindows
    "

    <resource: #canvas>

    ^ 
     #(#FullSpec
        #name: #windowSpecWindows
        #window: 
       #(#WindowSpec
          #label: #FileBrowser
          #name: #FileBrowser
          #min: #(#Point 10 10)
          #bounds: #(#Rectangle 14 123 814 723)
          #menu: #mainMenu
          #icon: #applicationIcon
        )
        #component: 
       #(#SpecCollection
          #collection: #(
           #(#ViewSpec
              #name: 'ToolbarBox'
              #layout: #(#LayoutFrame 0 0 0 0 0 1 30 0)
              #level: 0
              #visibilityChannel: #toolBarVisibleHolder
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#ActionButtonSpec
                    #label: 'hideToolBarIcon'
                    #name: 'HideToolBarButton'
                    #layout: #(#LayoutFrame 0 0 0 0 13 0 30 0)
                    #activeHelpKey: #hideToolBar
                    #hasCharacterOrientedLabel: false
                    #translateLabel: true
                    #model: #hideToolbar
                    #postBuildCallback: #hideToolBarButtonCreated:
                  )
                 #(#MenuPanelSpec
                    #name: 'ToolBar'
                    #layout: #(#LayoutFrame 13 0 0 0 0 1 30 0)
                    #menu: #toolBarMainMenu
                    #textDefault: true
                  )
                 )
               
              )
            )
           #(#ViewSpec
              #name: 'FilenameEntryFieldBox'
              #layout: #(#LayoutFrame 0 0 30 0 0 1 55 0)
              #level: 0
              #visibilityChannel: #filenameEntryFieldVisibleHolder
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#ActionButtonSpec
                    #label: 'hideFilenameEntryFieldIcon'
                    #name: 'HideFilenameEntryFieldButton'
                    #layout: #(#LayoutFrame 0 0 0 0 13 0 0 1)
                    #activeHelpKey: #hideFilenameEntryField
                    #hasCharacterOrientedLabel: false
                    #translateLabel: true
                    #model: #hideFilenameEntryField
                    #postBuildCallback: #hideFilenameEntryFieldButtonCreated:
                  )
                 #(#ViewSpec
                    #name: 'Box1'
                    #layout: #(#LayoutFrame 13 0.0 0 0.0 0 1.0 0 1.0)
                    #level: 1
                    #component: 
                   #(#SpecCollection
                      #collection: #(
                       #(#VariableHorizontalPanelSpec
                          #name: 'VariableHorizontalPanel1'
                          #layout: #(#LayoutFrame 1 0.0 1 0.0 -1 1.0 -1 1.0)
                          #level: 0
                          #showHandle: true
                          #component: 
                         #(#SpecCollection
                            #collection: #(
                             #(#ComboListSpec
                                #name: 'ComboList1'
                                #model: #selectedDeviceDrive
                                #comboList: #listOfDeviceDrives
                                #useIndex: false
                              )
                             #(#NonScrollableArbitraryComponentSpec
                                #name: 'NonScrollableArbitraryComponent1'
                                #component: #FilenameEditFieldV2
                                #postBuildCallback: #postBuildEditField:
                              )
                             #(#ViewSpec
                                #name: 'FilterBox'
                                #component: 
                               #(#SpecCollection
                                  #collection: #(
                                   #(#LabelSpec
                                      #label: 'Filter:'
                                      #name: 'Filter'
                                      #layout: #(#LayoutFrame 0 0 0 0 40 0 0 1)
                                      #translateLabel: true
                                      #adjust: #left
                                      #postBuildCallback: #postBuildPathViewBox:
                                    )
                                   #(#ComboBoxSpec
                                      #name: 'FilterSelectionBox'
                                      #layout: #(#LayoutFrame 40 0 0 0 0 1 0 1)
                                      #model: #filterModel
                                      #immediateAccept: true
                                      #acceptOnPointerLeave: false
                                      #comboList: #filterListModel
                                    )
                                   )
                                 
                                )
                                #postBuildCallback: #postBuildPathViewBox:
                              )
                             )
                           
                          )
                          #handles: #(#Any 0.083014 0.814815 1.0)
                          #postBuildCallback: #postBuildPathViewBox:
                        )
                       )
                     
                    )
                    #postBuildCallback: #postBuildPathViewBox:
                  )
                 )
               
              )
            )
           #(#'FileBrowserV2UISpecifications::PanelSpec'
              #name: 'BrowserBox'
              #layout: #(#LayoutFrame 0 0.0 55 0.0 0 1.0 -20 1.0)
              #level: 0
              #showHandle: true
              #snapMode: #both
              #whichView: #last
              #orientation: #vertical
              #visibility: #viewNoteBookApplicationHolder
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#'FileBrowserV2UISpecifications::PanelSpec'
                    #name: 'HorizontalPanel'
                    #level: 0
                    #snapMode: #both
                    #whichView: #first
                    #orientation: #horizontal
                    #visibility: #showDirectoryTree
                    #component: 
                   #(#SpecCollection
                      #collection: #(
                       #(#SubCanvasSpec
                          #name: 'DirectoryTreeBrowser'
                          #hasHorizontalScrollBar: false
                          #hasVerticalScrollBar: false
                          #majorKey: #DirectoryTreeBrowser
                          #createNewApplication: true
                          #createNewBuilder: true
                        )
                       #(#SubCanvasSpec
                          #name: 'DirectoryContentsBrowser'
                          #hasHorizontalScrollBar: false
                          #hasVerticalScrollBar: false
                          #majorKey: #DirectoryContentsBrowser
                          #createNewApplication: true
                          #createNewBuilder: true
                        )
                       )
                     
                    )
                    #handles: #(#Any 0.225 1.0)
                  )
                 #(#SubCanvasSpec
                    #name: 'FileApplicationNoteBook'
                    #tabable: false
                    #hasHorizontalScrollBar: false
                    #hasVerticalScrollBar: false
                    #majorKey: #FileApplicationNoteBook
                    #createNewApplication: true
                    #createNewBuilder: true
                  )
                 )
               
              )
              #handles: #(#Any 0.5 1.0)
            )
           #(#ViewSpec
              #name: 'Box2'
              #layout: #(#LayoutFrame 0 0 -20 1 0 1 0 1)
              #level: 0
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#LabelSpec
                    #label: 'NotifyLabel'
                    #name: 'NotifyLabel'
                    #layout: #(#LayoutFrame 0 0 1 0.0 -188 1 1 1.0)
                    #level: -1
                    #translateLabel: true
                    #labelChannel: #notifyChannel
                    #adjust: #left
                  )
                 #(#LabelSpec
                    #label: 'Shown Files'
                    #name: 'Label1'
                    #layout: #(#LayoutFrame -188 1 1 0.0 1 1 1 1.0)
                    #level: -1
                    #translateLabel: true
                    #labelChannel: #shownFiles
                    #adjust: #right
                    #postBuildCallback: #postBuildFilterBox:
                  )
                 #(#ProgressIndicatorSpec
                    #name: 'ProgressIndicator1'
                    #layout: #(#LayoutFrame -250 1 4 0 -188 1 -4 1)
                    #visibilityChannel: #activityVisibilityChannel
                    #backgroundColor: #(#Color 0.0 66.6667 66.6667)
                    #isActivityIndicator: true
                  )
                 )
               
              )
            )
           #(#LabelSpec
              #label: 'Preview'
              #name: 'PreviewLabel'
              #layout: #(#LayoutFrame 0 0.5 39 0 100 0.5 61 0)
              #level: 0
              #borderWidth: 1
              #visibilityChannel: #previewVisibleHolder
              #backgroundColor: #(#Color 86.9993 86.9993 86.9993)
              #translateLabel: true
            )
           #(#ArbitraryComponentSpec
              #name: 'Preview'
              #layout: #(#LayoutFrame 0 0.5 63 0 -147 1 -319 1)
              #level: 1
              #visibilityChannel: #previewVisibleHolder
              #hasBorder: false
              #component: #ImageView
            )
           )
         
        )
      )
! !

!FileBrowserV2 class methodsFor:'menu specs'!

mainMenu
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the MenuEditor may not be able to read the specification."

    "
     MenuEditor new openOnClass:FileBrowserV2 andSelector:#mainMenu
     (Menu new fromLiteralArrayEncoding:(FileBrowserV2 mainMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(#Menu
        #(
         #(#MenuItem
            #label: 'Browser'
            #translateLabel: true
            #submenuChannel: #browserMenu
          )
         #(#MenuItem
            #label: 'Directory'
            #translateLabel: true
            #submenuChannel: #directoryMenu
          )
         #(#MenuItem
            #label: 'File'
            #translateLabel: true
            #submenuChannel: #fileMenu
          )
         #(#MenuItem
            #label: 'Edit'
            #translateLabel: true
            #submenuChannel: #editMenu
          )
         #(#MenuItem
            #label: 'View'
            #translateLabel: true
            #submenu: 
           #(#Menu
              #(
               #(#MenuItem
                  #label: 'Details'
                  #translateLabel: true
                  #submenuChannel: #viewInContentsBrowserMenu
                )
               #(#MenuItem
                  #label: 'Sort'
                  #translateLabel: true
                  #submenuChannel: #sortMenu
                )
               #(#MenuItem
                  #label: 'Show'
                  #translateLabel: true
                  #submenuChannel: #showMenuSpec
                )
               #(#MenuItem
                  #label: '-'
                )
               #(#MenuItem
                  #label: 'Toolbar'
                  #translateLabel: true
                  #hideMenuOnActivated: false
                  #indication: #toolBarVisibleHolder
                )
               #(#MenuItem
                  #label: 'Path Entry && Filter'
                  #translateLabel: true
                  #hideMenuOnActivated: false
                  #indication: #filenameEntryFieldVisibleHolder
                )
               #(#MenuItem
                  #label: 'Preview'
                  #translateLabel: true
                  #hideMenuOnActivated: false
                  #indication: #previewVisibleHolder
                )
               #(#MenuItem
                  #label: '-'
                )
               #(#MenuItem
                  #label: 'Update'
                  #translateLabel: true
                  #itemValue: #updateCurrentDirectory
                )
               )
              nil
              nil
            )
          )
         #(#MenuItem
            #label: 'Tools'
            #translateLabel: true
            #submenuChannel: #toolsMenuSpec
          )
         #(#MenuItem
            #label: 'CVS'
            #translateLabel: true
            #submenuChannel: #cvsMenu
          )
         #(#MenuItem
            #label: 'Help'
            #translateLabel: true
            #startGroup: #right
            #submenu: 
           #(#Menu
              #(
               #(#MenuItem
                  #label: 'FileBrowser Documentation'
                  #translateLabel: true
                  #value: #openHTMLDocument:
                  #argument: 'tools/fbrowser/TOP.html'
                )
               #(#MenuItem
                  #label: '-'
                )
               #(#MenuItem
                  #label: 'About FileBrowser...'
                  #translateLabel: true
                  #value: #openAboutThisApplication  
                )
               )
              nil
              nil
            )
          )
         )
        nil
        nil
      )
!

previewLabelMenu
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the MenuEditor may not be able to read the specification."

    "
     MenuEditor new openOnClass:FileBrowserV2 andSelector:#previewLabelMenu
     (Menu new fromLiteralArrayEncoding:(FileBrowserV2 previewLabelMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(#Menu
        #(
         #(#MenuItem
            #label: 'Close Preview'
            #itemValue: #closePreview
            #translateLabel: true
          )
         )
        nil
        nil
      )
!

toolBarMainMenu
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the MenuEditor may not be able to read the specification."

    "
     MenuEditor new openOnClass:FileBrowserV2 andSelector:#toolBarMainMenu
     (Menu new fromLiteralArrayEncoding:(FileBrowserV2 toolBarMainMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(#Menu
        #(
         #(#MenuItem
            #activeHelpKey: #directoryUp
            #enabled: #enableDirectoryUp
            #label: 'DirectoryUp'
            #itemValue: #doGoDirectoryUp
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #upArrowIcon)
          )
         #(#MenuItem
            #label: ''
          )
         #(#MenuItem
            #activeHelpKey: #directoryBack
            #enabled: #enableBack
            #label: 'Back'
            #itemValue: #doBack
            #translateLabel: true
            #isButton: true
            #submenuChannel: #menuDirHistoryBack
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #leftArrowIcon)
          )
         #(#MenuItem
            #label: ''
          )
         #(#MenuItem
            #activeHelpKey: #directoryForward
            #enabled: #enableForward
            #label: 'Forward'
            #itemValue: #doForward
            #translateLabel: true
            #isButton: true
            #submenuChannel: #menuDirHistoryForward
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #rightArrowIcon)
          )
         #(#MenuItem
            #label: ''
          )
         #(#MenuItem
            #activeHelpKey: #fileHome
            #enabled: #enableHome
            #label: 'Home'
            #itemValue: #doGotoHomeDirectory
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #goHomeIcon)
          )
         #(#MenuItem
            #activeHelpKey: #fileGotoDefault
            #enabled: #enableGotoDefault
            #label: 'ST/X Default'
            #itemValue: #doGotoDefaultDirectory
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #gotoDefaultDirectoryIcon)
          )
         #(#MenuItem
            #label: ''
          )
         #(#MenuItem
            #activeHelpKey: #fileHistory
            #enabled: #enableFileHistory
            #label: 'File History'
            #translateLabel: true
            #isButton: true
            #submenuChannel: #menuFileHistory
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #historyIcon)
          )
         #(#MenuItem
            #label: '-'
          )
         #(#MenuItem
            #activeHelpKey: #cutFile
            #enabled: #hasSelection
            #label: 'Cut'
            #itemValue: #cutFiles
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #cutIcon)
          )
         #(#MenuItem
            #activeHelpKey: #copyFile
            #enabled: #hasSelection
            #label: 'Copy'
            #itemValue: #copyFiles
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #copyIcon)
          )
         #(#MenuItem
            #activeHelpKey: #pasteFile
            #enabled: #canPaste
            #label: 'Paste'
            #itemValue: #pasteFiles
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #pasteIcon)
          )
         #(#MenuItem
            #activeHelpKey: #deleteFile
            #enabled: #hasSelection
            #label: 'Delete'
            #itemValue: #deleteFiles
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #deleteIcon)
          )
         #(#MenuItem
            #label: '-'
          )
         #(#MenuItem
            #activeHelpKey: #fileIn
            #label: 'File In'
            #itemValue: #fileFileIn
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #fileInIcon)
          )
         #(#MenuItem
            #label: ''
          )
         #(#MenuItem
            #activeHelpKey: #searchFile
            #label: 'Search File'
            #itemValue: #doOpenSearchFile
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #searchIcon)
          )
         #(#MenuItem
            #activeHelpKey: #addTerminal
            #label: 'VT100'
            #itemValue: #doAddTerminal
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #shellWithoutTextIcon)
          )
         #(#MenuItem
            #activeHelpKey: #make
            #enabled: #canMake
            #label: 'Make'
            #itemValue: #doMake
            #translateLabel: true
            #isButton: true
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #makeIcon)
          )
         #(#MenuItem
            #label: 'viewDetails'
            #translateLabel: true
            #isButton: true
            #startGroup: #right
            #hideMenuOnActivated: false
            #indication: #viewDetails
            #labelImage: #(#ResourceRetriever nil #viewDetailsIcon)
          )
         #(#MenuItem
            #activeHelpKey: #toggleDetails
            #label: 'viewDetails'
            #translateLabel: true
            #isButton: true
            #startGroup: #right
            #isVisible: false
            #indication: #viewDetails
            #submenuChannel: #viewDetailsMenuSpec
            #labelImage: #(#ResourceRetriever nil #viewDetailsIcon)
          )
         #(#MenuItem
            #label: ''
            #isButton: true
            #startGroup: #right
            #submenuChannel: #viewDetailsMenuSpec
            #labelImage: #(#ResourceRetriever #ToolbarIconLibrary #empty1x20Icon)
          )
         )
        nil
        nil
      )
! !

!FileBrowserV2 methodsFor:'actions'!

changeFileBrowserTitleTo:aString

    |string|

    string := 'FileBrowser ', aString.
    self window label:string.
!

doSpawn

    self saveRuntimeAspectValues.
    self class openWithAspects:aspects withExtent:self builder window extent.
!

hideFilenameEntryField
    self filenameEntryFieldVisibleHolder value:false.
!

hideToolbar
    self toolBarVisibleHolder value:false.
!

toggleFileDetailsFor:anItem
    |viewDetails|

    viewDetails := self viewDetails value not.
    self viewDetails value:viewDetails.

    viewDetails ifTrue:[
        anItem activeHelpKey:#hideFileDetails.
        anItem label:(self class viewNoDetailsIcon).
    ] ifFalse:[
        anItem activeHelpKey:#showFileDetails.
        anItem label:(self class viewDetailsIcon).
    ].
! !

!FileBrowserV2 methodsFor:'aspects'!

fileEntryFieldHolder

    fileEntryFieldHolder isNil ifTrue:[
        fileEntryFieldHolder := ValueHolder new.
        fileEntryFieldHolder addDependent:self.
    ].
    ^ fileEntryFieldHolder.
!

listOfDeviceDrives

    listOfDeviceDrives isNil ifTrue:[
        listOfDeviceDrives := Filename volumes.
    ].
    ^ listOfDeviceDrives
!

selectedDeviceDrive

    selectedDeviceDrive isNil ifTrue:[
        selectedDeviceDrive := self listOfDeviceDrives first asValue.
        selectedDeviceDrive addDependent:self.
    ].
    ^ selectedDeviceDrive
! !

!FileBrowserV2 methodsFor:'aspects-visibility'!

filenameEntryFieldVisibleHolder
    " aspect for show FileEntryField "

    ^ self aspectFor:#filenameEntryFieldVisibleHolder ifAbsent:[true asValue]
!

previewVisibleHolder
    " aspect for show preview"

    ^ self aspectFor:#previewVisibleHolder ifAbsent:[false asValue]
!

toolBarVisibleHolder
    " aspect for show toolbar"

    ^ self aspectFor:#toolBarVisibleHolder ifAbsent:[true asValue]
! !

!FileBrowserV2 methodsFor:'change & update'!

currentFileNameHolderChanged

    |newEntryValue nSelected files volume|

    files := self currentFileNameHolder value.
    nSelected := files size.

    nSelected == 0 ifTrue:[
        newEntryValue := ''.
    ] ifFalse:[
        nSelected == 1 ifTrue:[
            newEntryValue := files first.
        ] ifFalse:[
            newEntryValue := self commonPrefixOfSelectedFiles.
        ].
    ].
    self fileEntryFieldHolder value:(newEntryValue asString) withoutNotifying:self.

    OperatingSystem isMSWINDOWSlike ifTrue:[
        volume := (nSelected >= 1) ifTrue:[files first volume] ifFalse:nil.    
        self selectedDeviceDrive value:volume.
    ].
    self updatePreview.
!

fileEntryFieldHolderChanged
    |fileName fileNameString answer|

    fileNameString := fileEntryFieldHolder value withoutSeparators.
    fileName := fileNameString asFilename.

    (fileName exists) ifFalse:[ 
        pathEntryField flash.

"/        answer := OptionBox 
"/           request:(resources string:'No file or directory named "%1" exists.\\Create ?' with:fileNameString allBold) withCRs
"/           buttonLabels:#('Create as File' 'Create as Directory' 'Cancel')
"/           values:#(createFile createDirectory nil)
"/           default:nil.
"/
        answer isNil ifTrue:[
            ^ self.
        ].
        [
            answer == #createFile ifTrue:[
                fileName directory recursiveMakeDirectory.
                fileName createAsEmptyFile.
            ] ifFalse:[
                answer == #createDirectory ifTrue:[
                    fileName recursiveMakeDirectory.
                ]
            ].
        ] on:OperatingSystem accessDeniedErrorSignal do:[:ex |
            Dialog warn:'Error: ' , ex description.
        ].
        ^ self
    ].
    self currentFileNameHolder value:(OrderedCollection with:fileName).
!

selectedDeviceDriveChanged

    | newDrive curSel newFile|

    newDrive := self selectedDeviceDrive value.
    curSel := self currentFileNameHolder value.
    curSel notEmpty ifTrue:[
        curSel first volume = newDrive ifTrue:[ ^self].
    ].
    newFile := newDrive asFilename.
    newFile isReadable ifTrue:[
        self gotoFile:newFile.
        ^self.
    ].
    curSel notEmpty ifTrue:[
        self selectedDeviceDrive value:(curSel first volume).
    ] ifFalse:[
        self selectedDeviceDrive value:'C:'.
    ].
!

selectedImage
    |files selectedFile mime img|

    files := self currentSelectedFiles.
    files size >= 1 ifFalse:[
        ^ nil
    ].
    selectedFile := files last.    

    mime := MIMETypes mimeTypeForFilename:selectedFile.
    (mime notNil and:[mime startsWith:'image/']) ifTrue:[
        img := Image fromFile:selectedFile.
        ^ img
    ].

    ^ nil.
!

showImagePreview:image
    |imgView|

    imgView := builder componentAt:#Preview.

    imgView adjust:#fitBig.
    imgView image:image.
!

showPreview
    |shownImage lbl previewLabel|

    shownImage := self selectedImage.
    lbl := shownImage isNil ifTrue:'Preview' ifFalse:[ shownImage fileName asFilename baseName ].

    previewLabel := builder componentAt:#PreviewLabel.
    previewLabel label:lbl; forceResizeHorizontally.     
    self enqueueMessage:#'showImagePreview:' for:self arguments:(Array with:shownImage).        
!

update:something with:aParameter from:changedObject


    changedObject == self selectedDeviceDrive ifTrue:[
        self selectedDeviceDriveChanged.
        ^ self.
    ].
    changedObject == self fileEntryFieldHolder ifTrue:[
        self fileEntryFieldHolderChanged.
        ^ self.
    ].
    changedObject == self currentFileNameHolder ifTrue:[
        super update:something with:aParameter from:changedObject.
        self currentFileNameHolderChanged.
        ^ self.
    ].
    (changedObject == self previewVisibleHolder) ifTrue:[
        self updatePreview.
        ^ self.
    ].
    (changedObject == self toolBarVisibleHolder 
    or:[changedObject == self filenameEntryFieldVisibleHolder]) ifTrue:[
        self updateToolVisibility.
        ^ self.
    ].
    (changedObject == self sortBlockProperty or:[changedObject == self sortDirectoriesBeforeFiles]) ifTrue:[
        self sortFileListsBy:(self sortBlockProperty value) withReverse:false.
        ^ self.
    ].             

    ^ super update:something with:aParameter from:changedObject.
!

updatePreview
    |previewLabel imgView shownImage plug|

    shownImage := nil.
    imgView := builder componentAt:#Preview.
    previewLabel := builder componentAt:#PreviewLabel.

    self previewVisibleHolder value ifTrue:[
        plug := Plug new.
        plug respondTo:#closePreview with:[ self previewVisibleHolder value:false ].

        previewLabel menuHolder:(self class previewLabelMenu decodeAsLiteralArray).
        previewLabel menuPerformer:plug asValue.

        previewProcess notNil ifTrue:[
            previewProcess terminate
        ].
        previewProcess := [
                                |imgView oldBg shownImage lbl|

                                oldBg := previewLabel backgroundColor.
                                previewLabel backgroundColor:(Color red lightened lightened).
                                [
                                    self showPreview.
                                    previewProcess := nil.
                                ] ensure:[
                                    previewLabel backgroundColor:oldBg.
                                ].
                          ] forkAt:7.
    ] ifFalse:[
        imgView notNil ifTrue:[
            imgView image:nil.
        ]
    ].
!

updateToolVisibility
    |builder toolBar filenameEntryField vPanel topOffset visible d|

    builder := self builder.

    topOffset := 0.
    visible := self toolBarVisibleHolder value.
    visible ifTrue:[
        toolBar := builder componentAt:#ToolbarBox.
        topOffset := topOffset + toolBar height.
    ].

    visible := self filenameEntryFieldVisibleHolder value.
    visible ifTrue:[
        filenameEntryField := builder componentAt:#FilenameEntryFieldBox.
        d := filenameEntryField layout bottomOffset - filenameEntryField layout topOffset.
        filenameEntryField layout topOffset:topOffset bottomOffset:topOffset + d.
        topOffset := topOffset + filenameEntryField height.
        filenameEntryField container notNil ifTrue:[
            filenameEntryField containerChangedSize.
        ].
    ].

    vPanel := builder componentAt:#BrowserBox.
    vPanel layout topOffset:topOffset+1.
    vPanel container notNil ifTrue:[
        vPanel containerChangedSize.
    ].
! !

!FileBrowserV2 methodsFor:'event handling'!

processEvent:anEvent
    "filter keyboard events.
     Return true, if I have eaten the event"

    |focusView key rawKey fileName|

    anEvent isKeyPressEvent ifTrue:[
        focusView := anEvent targetView.
        key := anEvent key.
        rawKey := anEvent rawKey.

        (focusView isSameOrComponentOf:self window) ifTrue:[

            ((focusView == pathEntryField) not) ifTrue:[ ^ false].

            (key == #Return) ifTrue:[
                fileName := pathEntryField list first asFilename.
                (fileName exists and:[fileName isDirectory not]) ifTrue:[
                    self openApplForFile:fileName
                ].
            ].
        ]
    ].
    ^ false
! !

!FileBrowserV2 methodsFor:'startup & release'!

closeRequest
    (self applicationNamed:#FileApplicationNoteBook do:[:appl | appl tryCloseApplications]) ifFalse:[
        ^ self
    ].
    ^ super closeRequest.
!

hideFilenameEntryFieldButtonCreated:aButton

    aButton passiveLevel:(MenuPanel defaultLevel). 
    aButton activeLevel:-1.
    aButton backgroundColor:(MenuPanel defaultBackgroundColor).
!

hideToolBarButtonCreated:aButton

    aButton passiveLevel:(MenuPanel defaultLevel). 
    aButton activeLevel:-1.
    aButton backgroundColor:(MenuPanel defaultBackgroundColor).
!

initialize

    self masterApplication:nil.
    self dirHistory resetForwardBackward.
!

makeDependent

    super makeDependent.
    self sortBlockProperty addDependent:self.
    self filenameEntryFieldVisibleHolder addDependent:self.
    self toolBarVisibleHolder addDependent:self.
    self previewVisibleHolder addDependent:self.
!

postBuildDirectoryTree:aWidget
    aWidget application multipleSelect:true.
!

postBuildEditField:aWidget

    pathEntryField := aWidget.
    aWidget model:self fileEntryFieldHolder.
    aWidget listHolder:self dirHistory.
    aWidget level:-1.
!

postBuildFilterBox:aWidget

    self filterValueBox value:aWidget.
    self filterBackgroundColor value:aWidget backgroundColor.
!

postBuildPathField:aWidget
    "
        set the pramters that not can be changed in the window spec
    "

    pathEntryField := aWidget.
    aWidget level:-1.

"/    sClr := aWidget shadowColor.
"/    lClr := aWidget lightColor.
"/    sClr := (self builder componentAt:#ToolBar) shadowColor.
"/    lClr := (self builder componentAt:#ToolBar) lightColor.

"/    aWidget backgroundColor:(aWidget superView viewBackground).
"/    aWidget shadowColor:sClr.
!

postBuildPathViewBox:aWidget

    aWidget backgroundColor:(MenuPanel defaultBackgroundColor).
!

postBuildWith:aBuilder

    super postBuildWith:aBuilder.
    self updateToolVisibility.
!

postOpenWith:aBuilder

    super postOpenWith:aBuilder.
    self currentFileNameHolderChangedForCommon.
    self currentFileNameHolderChanged.

    self windowGroup addPreEventHook:self.
!

release

    self saveRuntimeAspectValues.
    ^ super release
! !

!FileBrowserV2 class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2.st,v 1.83 2003-05-13 16:12:06 cg Exp $'
! !

FileBrowserV2 initialize!