DirectoryTreeBrowser.st
author penk
Mon, 28 Oct 2002 13:37:51 +0100
changeset 4080 c32f68f51f47
parent 4071 f923c8257818
child 4085 9e58ddfa6969
permissions -rw-r--r--
translation to german
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
     1
"{ Package: 'stx:libtool' }"
321c1729db5b initial checkin
penk
parents:
diff changeset
     2
321c1729db5b initial checkin
penk
parents:
diff changeset
     3
AbstractFileBrowser subclass:#DirectoryTreeBrowser
4071
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
     4
	instanceVariableNames:'dirBrowser updateToExternFileHolderLock oldDropItem
3995
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
     5
		expandItemTimedBlock updateTreeSelection inDropMode canDropItem
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
     6
		doubleClickAction newVisibilityHolder allowFileOperations
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
     7
		multipleSelect treeSelectionHolder'
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
     8
	classVariableNames:''
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
     9
	poolDictionaries:''
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
    10
	category:'Interface-Tools-File'
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    11
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    12
321c1729db5b initial checkin
penk
parents:
diff changeset
    13
HierarchicalFileList subclass:#DirTreeBrowserHFL
3995
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
    14
	instanceVariableNames:'draggedItem grayDirectoryIcon'
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
    15
	classVariableNames:''
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
    16
	poolDictionaries:''
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
    17
	privateIn:DirectoryTreeBrowser
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    18
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    19
321c1729db5b initial checkin
penk
parents:
diff changeset
    20
!DirectoryTreeBrowser class methodsFor:'documentation'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    21
321c1729db5b initial checkin
penk
parents:
diff changeset
    22
documentation
321c1729db5b initial checkin
penk
parents:
diff changeset
    23
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    24
    documentation to be added.
321c1729db5b initial checkin
penk
parents:
diff changeset
    25
321c1729db5b initial checkin
penk
parents:
diff changeset
    26
    [author:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    27
        Christian Penk (penk@bierfix)
321c1729db5b initial checkin
penk
parents:
diff changeset
    28
321c1729db5b initial checkin
penk
parents:
diff changeset
    29
    [see also:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    30
321c1729db5b initial checkin
penk
parents:
diff changeset
    31
    [instance variables:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    32
321c1729db5b initial checkin
penk
parents:
diff changeset
    33
    [class variables:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    34
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    35
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    36
321c1729db5b initial checkin
penk
parents:
diff changeset
    37
examples
321c1729db5b initial checkin
penk
parents:
diff changeset
    38
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    39
  Starting the application:
321c1729db5b initial checkin
penk
parents:
diff changeset
    40
                                                                [exBegin]
321c1729db5b initial checkin
penk
parents:
diff changeset
    41
    DirectoryTreeBrowser open
321c1729db5b initial checkin
penk
parents:
diff changeset
    42
321c1729db5b initial checkin
penk
parents:
diff changeset
    43
                                                                [exEnd]
321c1729db5b initial checkin
penk
parents:
diff changeset
    44
321c1729db5b initial checkin
penk
parents:
diff changeset
    45
  more examples to be added:
321c1729db5b initial checkin
penk
parents:
diff changeset
    46
                                                                [exBegin]
321c1729db5b initial checkin
penk
parents:
diff changeset
    47
    ... add code fragment for 
321c1729db5b initial checkin
penk
parents:
diff changeset
    48
    ... executable example here ...
321c1729db5b initial checkin
penk
parents:
diff changeset
    49
                                                                [exEnd]
321c1729db5b initial checkin
penk
parents:
diff changeset
    50
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    51
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
    52
321c1729db5b initial checkin
penk
parents:
diff changeset
    53
!DirectoryTreeBrowser class methodsFor:'instance creation'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    54
321c1729db5b initial checkin
penk
parents:
diff changeset
    55
open
321c1729db5b initial checkin
penk
parents:
diff changeset
    56
321c1729db5b initial checkin
penk
parents:
diff changeset
    57
    ^ super open
321c1729db5b initial checkin
penk
parents:
diff changeset
    58
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    59
    DirectoryTreeBrowser open
321c1729db5b initial checkin
penk
parents:
diff changeset
    60
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    61
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    62
321c1729db5b initial checkin
penk
parents:
diff changeset
    63
openOn:aFileName
321c1729db5b initial checkin
penk
parents:
diff changeset
    64
321c1729db5b initial checkin
penk
parents:
diff changeset
    65
    | file |
321c1729db5b initial checkin
penk
parents:
diff changeset
    66
    file := aFileName asFilename.
321c1729db5b initial checkin
penk
parents:
diff changeset
    67
    file exists ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
    68
        self openOn:aFileName withFiles:(file isDirectory not)
321c1729db5b initial checkin
penk
parents:
diff changeset
    69
    ]        
321c1729db5b initial checkin
penk
parents:
diff changeset
    70
321c1729db5b initial checkin
penk
parents:
diff changeset
    71
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    72
    DirectoryTreeBrowser openOn:Filename homeDirectory   
321c1729db5b initial checkin
penk
parents:
diff changeset
    73
    DirectoryTreeBrowser openOn:(Filename homeDirectory construct:'.bashrc')  
321c1729db5b initial checkin
penk
parents:
diff changeset
    74
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    75
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    76
321c1729db5b initial checkin
penk
parents:
diff changeset
    77
openOn:aFileName withFiles:aBoolean
321c1729db5b initial checkin
penk
parents:
diff changeset
    78
321c1729db5b initial checkin
penk
parents:
diff changeset
    79
    | instance|
321c1729db5b initial checkin
penk
parents:
diff changeset
    80
321c1729db5b initial checkin
penk
parents:
diff changeset
    81
    instance := DirectoryTreeBrowser new.
321c1729db5b initial checkin
penk
parents:
diff changeset
    82
    instance open.
321c1729db5b initial checkin
penk
parents:
diff changeset
    83
    instance viewFilesInDirectoryTree value:aBoolean.
321c1729db5b initial checkin
penk
parents:
diff changeset
    84
    instance currentFileNameHolder value:(OrderedCollection with:aFileName).
321c1729db5b initial checkin
penk
parents:
diff changeset
    85
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    86
    DirectoryTreeBrowser openOn:Filename homeDirectory  
321c1729db5b initial checkin
penk
parents:
diff changeset
    87
    DirectoryTreeBrowser openOn:(Filename homeDirectory construct:'.bashrc') withFiles:false  
321c1729db5b initial checkin
penk
parents:
diff changeset
    88
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    89
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
    90
321c1729db5b initial checkin
penk
parents:
diff changeset
    91
!DirectoryTreeBrowser class methodsFor:'defaults'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    92
321c1729db5b initial checkin
penk
parents:
diff changeset
    93
timeForExpandOnDropInMilliseconds
321c1729db5b initial checkin
penk
parents:
diff changeset
    94
321c1729db5b initial checkin
penk
parents:
diff changeset
    95
    ^ 1500
321c1729db5b initial checkin
penk
parents:
diff changeset
    96
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
    97
321c1729db5b initial checkin
penk
parents:
diff changeset
    98
!DirectoryTreeBrowser class methodsFor:'interface specs'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    99
321c1729db5b initial checkin
penk
parents:
diff changeset
   100
windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   101
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   102
     by the UIPainter of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   103
321c1729db5b initial checkin
penk
parents:
diff changeset
   104
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   105
     the UIPainter may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   106
321c1729db5b initial checkin
penk
parents:
diff changeset
   107
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   108
     UIPainter new openOnClass:DirectoryTreeBrowser andSelector:#windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   109
     DirectoryTreeBrowser new openInterface:#windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   110
     DirectoryTreeBrowser open
321c1729db5b initial checkin
penk
parents:
diff changeset
   111
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   112
321c1729db5b initial checkin
penk
parents:
diff changeset
   113
    <resource: #canvas>
321c1729db5b initial checkin
penk
parents:
diff changeset
   114
321c1729db5b initial checkin
penk
parents:
diff changeset
   115
    ^ 
321c1729db5b initial checkin
penk
parents:
diff changeset
   116
     #(#FullSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   117
        #name: #windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   118
        #window: 
321c1729db5b initial checkin
penk
parents:
diff changeset
   119
       #(#WindowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   120
          #label: 'DirectoryTreeBrowser'
321c1729db5b initial checkin
penk
parents:
diff changeset
   121
          #name: 'DirectoryTreeBrowser'
321c1729db5b initial checkin
penk
parents:
diff changeset
   122
          #min: #(#Point 10 10)
321c1729db5b initial checkin
penk
parents:
diff changeset
   123
          #max: #(#Point 1024 768)
321c1729db5b initial checkin
penk
parents:
diff changeset
   124
          #bounds: #(#Rectangle 16 42 316 342)
321c1729db5b initial checkin
penk
parents:
diff changeset
   125
          #menu: #mainMenu
321c1729db5b initial checkin
penk
parents:
diff changeset
   126
        )
321c1729db5b initial checkin
penk
parents:
diff changeset
   127
        #component: 
321c1729db5b initial checkin
penk
parents:
diff changeset
   128
       #(#SpecCollection
321c1729db5b initial checkin
penk
parents:
diff changeset
   129
          #collection: #(
321c1729db5b initial checkin
penk
parents:
diff changeset
   130
           #(#HierarchicalListViewSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   131
              #name: 'HierarchicalListView'
321c1729db5b initial checkin
penk
parents:
diff changeset
   132
              #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
321c1729db5b initial checkin
penk
parents:
diff changeset
   133
              #model: #treeSelectionHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
   134
              #menu: #menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   135
              #hasHorizontalScrollBar: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   136
              #hasVerticalScrollBar: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   137
              #miniScrollerHorizontal: false
321c1729db5b initial checkin
penk
parents:
diff changeset
   138
              #miniScrollerVertical: false
321c1729db5b initial checkin
penk
parents:
diff changeset
   139
              #listModel: #fileList
321c1729db5b initial checkin
penk
parents:
diff changeset
   140
              #multipleSelectOk: true
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   141
              #useIndex: false
3906
8a76cb4f5884 next stage
penk
parents: 3892
diff changeset
   142
              #highlightMode: #label
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   143
              #doubleClickSelector: #doDoubleClick:
321c1729db5b initial checkin
penk
parents:
diff changeset
   144
              #indicatorSelector: #doIndicatorClick:
321c1729db5b initial checkin
penk
parents:
diff changeset
   145
              #postBuildCallback: #postBuildDirBrowser:
321c1729db5b initial checkin
penk
parents:
diff changeset
   146
              #properties: 
321c1729db5b initial checkin
penk
parents:
diff changeset
   147
             #(#PropertyListDictionary
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   148
                #overSelector: #dropOver:
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   149
                #dragArgument: #directoryTreeBrowser
321c1729db5b initial checkin
penk
parents:
diff changeset
   150
                #startDragSelector: #doStartDrag:in:
321c1729db5b initial checkin
penk
parents:
diff changeset
   151
                #displayObjectSelector: #getDisplayObjects:
321c1729db5b initial checkin
penk
parents:
diff changeset
   152
                #dropObjectSelector: #getDropObjects:
321c1729db5b initial checkin
penk
parents:
diff changeset
   153
                #dropArgument: #directoryTreeBrowser
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   154
                #canDropSelector: #canDrop:
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   155
                #leaveSelector: #dropLeave:
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   156
                #enterSelector: #dropEnter:
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   157
                #dropSelector: #doDrop:
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   158
              )
321c1729db5b initial checkin
penk
parents:
diff changeset
   159
            )
321c1729db5b initial checkin
penk
parents:
diff changeset
   160
           )
321c1729db5b initial checkin
penk
parents:
diff changeset
   161
         
321c1729db5b initial checkin
penk
parents:
diff changeset
   162
        )
321c1729db5b initial checkin
penk
parents:
diff changeset
   163
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   164
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   165
321c1729db5b initial checkin
penk
parents:
diff changeset
   166
!DirectoryTreeBrowser class methodsFor:'menu specs'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   167
321c1729db5b initial checkin
penk
parents:
diff changeset
   168
menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   169
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   170
     by the MenuEditor of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   171
321c1729db5b initial checkin
penk
parents:
diff changeset
   172
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   173
     the MenuEditor may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   174
321c1729db5b initial checkin
penk
parents:
diff changeset
   175
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   176
     MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   177
     (Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser menu)) startUp
321c1729db5b initial checkin
penk
parents:
diff changeset
   178
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   179
321c1729db5b initial checkin
penk
parents:
diff changeset
   180
    <resource: #menu>
321c1729db5b initial checkin
penk
parents:
diff changeset
   181
321c1729db5b initial checkin
penk
parents:
diff changeset
   182
    ^ 
321c1729db5b initial checkin
penk
parents:
diff changeset
   183
     #(#Menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   184
        #(
321c1729db5b initial checkin
penk
parents:
diff changeset
   185
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   186
            #label: 'Copy'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   187
            #itemValue: #doCopy
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   188
            #translateLabel: true
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   189
            #isVisible: #allowFileOperations
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   190
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   191
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   192
            #label: 'Cut'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   193
            #itemValue: #doCut
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   194
            #translateLabel: true
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   195
            #isVisible: #allowFileOperations
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   196
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   197
         #(#MenuItem
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   198
            #enabled: #canPaste
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   199
            #label: 'Paste'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   200
            #itemValue: #pasteFiles
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   201
            #translateLabel: true
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   202
            #isVisible: #allowFileOperations
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   203
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   204
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   205
            #label: 'Delete'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   206
            #itemValue: #doDelete
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   207
            #nameKey: #delete
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   208
            #translateLabel: true
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   209
            #isVisible: #allowFileOperations
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   210
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   211
         #(#MenuItem
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   212
            #label: 'Rename'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   213
            #itemValue: #treeViewFileRename
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   214
            #translateLabel: true
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   215
            #isVisible: #allowFileOperations
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   216
          )
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   217
         #(#MenuItem
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   218
            #label: '-'
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   219
            #isVisible: #allowFileOperations
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   220
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   221
         #(#MenuItem
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   222
            #label: 'View Files'
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   223
            #translateLabel: true
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   224
            #indication: #viewFilesInDirectoryTree
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   225
          )
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   226
         #(#MenuItem
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   227
            #label: 'Sort'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   228
            #nameKey: #Sort
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   229
            #translateLabel: true
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   230
            #submenuChannel: #sortMenu
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   231
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   232
         #(#MenuItem
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   233
            #enabled: #selectedFilesIncludesNonRootDirectory
4010
ae8dc4d9ff77 *** empty log message ***
penk
parents: 4009
diff changeset
   234
            #label: 'Set Selection to Root'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   235
            #itemValue: #doSetSelectionToRoot
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   236
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   237
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   238
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   239
            #label: '-'
321c1729db5b initial checkin
penk
parents:
diff changeset
   240
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   241
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   242
            #label: 'New'
321c1729db5b initial checkin
penk
parents:
diff changeset
   243
            #translateLabel: true
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   244
            #isVisible: #newVisibilityHolder
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   245
            #submenuChannel: #newMenu
321c1729db5b initial checkin
penk
parents:
diff changeset
   246
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   247
         #(#MenuItem
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   248
            #label: 'Update'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   249
            #itemValue: #doUpdate
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   250
            #translateLabel: true
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   251
          )
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   252
         #(#MenuItem
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   253
            #enabled: #hasSelection
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   254
            #label: 'Properties...'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   255
            #itemValue: #doShowProperties
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   256
            #translateLabel: true
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   257
          )
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   258
         #(#MenuItem
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   259
            #label: 'More'
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   260
            #translateLabel: true
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   261
            #submenu: 
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   262
           #(#Menu
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   263
              #(
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   264
               #(#MenuItem
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   265
                  #enabled: #enableDirectoryUp
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   266
                  #label: 'Directory Up'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   267
                  #itemValue: #doGoDirectoryUp
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   268
                  #translateLabel: true
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   269
                )
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   270
               #(#MenuItem
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   271
                  #label: 'Re-/ Expand Directory'
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
   272
                  #itemValue: #toggleExpandSelectedItem
3907
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   273
                  #translateLabel: true
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   274
                )
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   275
               )
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   276
              nil
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   277
              nil
a06fe9db6195 next stage
penk
parents: 3906
diff changeset
   278
            )
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   279
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   280
         )
321c1729db5b initial checkin
penk
parents:
diff changeset
   281
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   282
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   283
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   284
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   285
321c1729db5b initial checkin
penk
parents:
diff changeset
   286
!DirectoryTreeBrowser class methodsFor:'plugIn spec'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   287
321c1729db5b initial checkin
penk
parents:
diff changeset
   288
aspectSelectors
321c1729db5b initial checkin
penk
parents:
diff changeset
   289
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   290
     by the UIPainter of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   291
321c1729db5b initial checkin
penk
parents:
diff changeset
   292
    "Do not manually edit this. If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   293
     the UIPainter may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   294
321c1729db5b initial checkin
penk
parents:
diff changeset
   295
    "Return a description of exported aspects;
321c1729db5b initial checkin
penk
parents:
diff changeset
   296
     these can be connected to aspects of an embedding application
321c1729db5b initial checkin
penk
parents:
diff changeset
   297
     (if this app is embedded in a subCanvas)."
321c1729db5b initial checkin
penk
parents:
diff changeset
   298
321c1729db5b initial checkin
penk
parents:
diff changeset
   299
    ^ #(
321c1729db5b initial checkin
penk
parents:
diff changeset
   300
        #selectedDirectoryModel
321c1729db5b initial checkin
penk
parents:
diff changeset
   301
      ).
321c1729db5b initial checkin
penk
parents:
diff changeset
   302
321c1729db5b initial checkin
penk
parents:
diff changeset
   303
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   304
321c1729db5b initial checkin
penk
parents:
diff changeset
   305
!DirectoryTreeBrowser methodsFor:'accessing'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   306
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   307
doubleClickAction
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   308
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   309
    ^ doubleClickAction
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   310
!
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   311
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   312
doubleClickAction:aBlock
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   313
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   314
    " aBlock is a one arg block with selected index as argument "
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   315
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   316
    doubleClickAction := aBlock
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   317
!
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   318
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   319
updateToExternFileHolderLock
321c1729db5b initial checkin
penk
parents:
diff changeset
   320
    "return the value of the instance variable 'updateToExternFileHolder' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   321
321c1729db5b initial checkin
penk
parents:
diff changeset
   322
    updateToExternFileHolderLock isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   323
        updateToExternFileHolderLock := self class newLock.
321c1729db5b initial checkin
penk
parents:
diff changeset
   324
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   325
    ^ updateToExternFileHolderLock
321c1729db5b initial checkin
penk
parents:
diff changeset
   326
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   327
321c1729db5b initial checkin
penk
parents:
diff changeset
   328
updateTreeSelection
321c1729db5b initial checkin
penk
parents:
diff changeset
   329
    "return the value of the instance variable 'updateToExternFileHolder' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   330
321c1729db5b initial checkin
penk
parents:
diff changeset
   331
    updateTreeSelection isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   332
        updateTreeSelection := self class newLock.
321c1729db5b initial checkin
penk
parents:
diff changeset
   333
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   334
    ^ updateTreeSelection
321c1729db5b initial checkin
penk
parents:
diff changeset
   335
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   336
321c1729db5b initial checkin
penk
parents:
diff changeset
   337
!DirectoryTreeBrowser methodsFor:'actions'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   338
321c1729db5b initial checkin
penk
parents:
diff changeset
   339
doDoubleClick:anIndex 
321c1729db5b initial checkin
penk
parents:
diff changeset
   340
    "handle a doubleClick on a directory
321c1729db5b initial checkin
penk
parents:
diff changeset
   341
    "
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   342
    | item file isDirectory|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   343
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   344
    self doubleClickAction notNil ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   345
        self doubleClickAction value:anIndex.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   346
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   347
    item := self fileList at:anIndex ifAbsent:nil.
321c1729db5b initial checkin
penk
parents:
diff changeset
   348
    item notNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   349
        isDirectory := item isDirectory.
321c1729db5b initial checkin
penk
parents:
diff changeset
   350
        file := item fileName.
321c1729db5b initial checkin
penk
parents:
diff changeset
   351
        isDirectory ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   352
            (file isReadable and:[file isExecutable]) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   353
                self doExpand:item.
321c1729db5b initial checkin
penk
parents:
diff changeset
   354
            ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   355
        ] ifFalse:[
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   356
"/                      self openApplByFileItem:item.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   357
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   358
    ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   359
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   360
321c1729db5b initial checkin
penk
parents:
diff changeset
   361
doExpand:anItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   362
" expand the item; return true the item have expanded "
321c1729db5b initial checkin
penk
parents:
diff changeset
   363
321c1729db5b initial checkin
penk
parents:
diff changeset
   364
    (anItem notNil and:[anItem isDirectory and:[anItem isExpanded not]]) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   365
        anItem toggleExpand.
321c1729db5b initial checkin
penk
parents:
diff changeset
   366
        ^ true.
321c1729db5b initial checkin
penk
parents:
diff changeset
   367
    ].          
321c1729db5b initial checkin
penk
parents:
diff changeset
   368
    ^ false
321c1729db5b initial checkin
penk
parents:
diff changeset
   369
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   370
321c1729db5b initial checkin
penk
parents:
diff changeset
   371
doIndicatorClick:anIndex 
321c1729db5b initial checkin
penk
parents:
diff changeset
   372
    "handle a click on the indicator
321c1729db5b initial checkin
penk
parents:
diff changeset
   373
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   374
321c1729db5b initial checkin
penk
parents:
diff changeset
   375
    |item|
321c1729db5b initial checkin
penk
parents:
diff changeset
   376
321c1729db5b initial checkin
penk
parents:
diff changeset
   377
    item := self fileList at:anIndex ifAbsent:nil.
321c1729db5b initial checkin
penk
parents:
diff changeset
   378
    self toggleExpand:item
321c1729db5b initial checkin
penk
parents:
diff changeset
   379
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   380
4010
ae8dc4d9ff77 *** empty log message ***
penk
parents: 4009
diff changeset
   381
doSetSelectionToRoot
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   382
    | selDir|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   383
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   384
    selDir := self firstSelectedDirectory.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   385
    selDir notNil ifTrue:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   386
        self rootHolder value asFilename = selDir ifTrue:[ ^ self].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   387
        self rootHolder value:selDir.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   388
        self currentFileNameHolder value:(OrderedCollection with:selDir).
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   389
    ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   390
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   391
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   392
doUpdate
321c1729db5b initial checkin
penk
parents:
diff changeset
   393
321c1729db5b initial checkin
penk
parents:
diff changeset
   394
    self fileList monitoringCycle.
321c1729db5b initial checkin
penk
parents:
diff changeset
   395
"/    self updateSelectedItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   396
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   397
3989
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   398
evaluateSortBlock
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   399
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   400
    self fileList sortBlock:(self sortBlockHolder value).
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   401
!
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   402
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   403
setMatchBlockForList:list
321c1729db5b initial checkin
penk
parents:
diff changeset
   404
4021
201bd62a53f3 *** empty log message ***
penk
parents: 4018
diff changeset
   405
    | selection matchBlock filterBlock viewFiles|
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   406
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   407
    selection := self selectedItems.
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   408
    filterBlock := self filterBlockHolder value.
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   409
    viewFiles := self viewFilesInDirectoryTree value.
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   410
    matchBlock := [:fileName :isDir|
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   411
        (isDir 
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   412
        or:[viewFiles
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   413
            and:[filterBlock value:fileName baseName]])
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   414
    ].
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   415
    list matchBlock:matchBlock.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   416
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   417
321c1729db5b initial checkin
penk
parents:
diff changeset
   418
toggleExpand:anItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   419
321c1729db5b initial checkin
penk
parents:
diff changeset
   420
    (anItem notNil and:[anItem isDirectory]) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   421
        anItem toggleExpand
321c1729db5b initial checkin
penk
parents:
diff changeset
   422
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   423
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   424
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   425
toggleExpandSelectedItem
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   426
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   427
    |selDir|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   428
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   429
    selDir := self selectedDirectoryItems.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   430
    selDir do:[:item|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   431
        self toggleExpand:item.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   432
    ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   433
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   434
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   435
treeViewFileRename
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   436
3906
8a76cb4f5884 next stage
penk
parents: 3892
diff changeset
   437
    dirBrowser openEditor.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   438
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   439
321c1729db5b initial checkin
penk
parents:
diff changeset
   440
updateSelectedItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   441
321c1729db5b initial checkin
penk
parents:
diff changeset
   442
    | sel |
321c1729db5b initial checkin
penk
parents:
diff changeset
   443
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   444
    sel := self selectedItems.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   445
    sel isEmpty ifTrue:[ ^ self].
321c1729db5b initial checkin
penk
parents:
diff changeset
   446
    sel do:[:item|
321c1729db5b initial checkin
penk
parents:
diff changeset
   447
        item invalidateRepairNow:true.
321c1729db5b initial checkin
penk
parents:
diff changeset
   448
    ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   449
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   450
321c1729db5b initial checkin
penk
parents:
diff changeset
   451
!DirectoryTreeBrowser methodsFor:'aspects'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   452
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   453
allowFileOperations
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   454
    "allowFileOperations
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   455
    "
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   456
    allowFileOperations isNil ifTrue:[
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   457
        allowFileOperations := true asValue.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   458
    ].
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   459
    ^ allowFileOperations.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   460
!
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   461
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   462
fileList
321c1729db5b initial checkin
penk
parents:
diff changeset
   463
    "holder, which keeps the current list of file entries shown by the directory-browser
321c1729db5b initial checkin
penk
parents:
diff changeset
   464
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   465
321c1729db5b initial checkin
penk
parents:
diff changeset
   466
    |list|
321c1729db5b initial checkin
penk
parents:
diff changeset
   467
321c1729db5b initial checkin
penk
parents:
diff changeset
   468
    (list := builder bindingAt:#fileList) isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   469
        list := DirTreeBrowserHFL new.
321c1729db5b initial checkin
penk
parents:
diff changeset
   470
        list application:self.
321c1729db5b initial checkin
penk
parents:
diff changeset
   471
        list showRoot:true.
321c1729db5b initial checkin
penk
parents:
diff changeset
   472
        self setMatchBlockForList:list.
321c1729db5b initial checkin
penk
parents:
diff changeset
   473
        list directory:(self rootHolder value).
321c1729db5b initial checkin
penk
parents:
diff changeset
   474
        builder aspectAt:#fileList put:list.
321c1729db5b initial checkin
penk
parents:
diff changeset
   475
        list monitoringTaskDelay:2
321c1729db5b initial checkin
penk
parents:
diff changeset
   476
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   477
    ^ list
321c1729db5b initial checkin
penk
parents:
diff changeset
   478
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   479
3958
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   480
multipleSelect
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   481
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   482
    multipleSelect isNil ifTrue:[
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   483
        multipleSelect := true.
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   484
    ].
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   485
    ^ multipleSelect
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   486
!
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   487
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   488
multipleSelect:aBoolean
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   489
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   490
    multipleSelect := aBoolean.
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   491
    dirBrowser multipleSelectOk:aBoolean.
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   492
!
39364b0202cf fileDialog multiple select changes
penk
parents: 3957
diff changeset
   493
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   494
newVisibilityHolder
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   495
    "newVisibilityHolder
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   496
    "
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   497
    newVisibilityHolder isNil ifTrue:[
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   498
        newVisibilityHolder := true asValue.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   499
    ].
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   500
    ^ newVisibilityHolder.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   501
!
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3952
diff changeset
   502
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   503
treeSelectionHolder
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   504
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   505
    treeSelectionHolder isNil ifTrue:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   506
        treeSelectionHolder := ValueHolder new.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   507
        treeSelectionHolder addDependent:self.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   508
    ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   509
    ^ treeSelectionHolder
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   510
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   511
321c1729db5b initial checkin
penk
parents:
diff changeset
   512
!DirectoryTreeBrowser methodsFor:'change & update'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   513
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   514
changeMatchBlock
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   515
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   516
    |list|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   517
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   518
    list := self fileList.
4021
201bd62a53f3 *** empty log message ***
penk
parents: 4018
diff changeset
   519
    self setMatchBlockForList:list.
201bd62a53f3 *** empty log message ***
penk
parents: 4018
diff changeset
   520
    self currentFileNameHolderChanged.
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   521
!
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   522
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   523
currentFileNameHolderChanged
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   524
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   525
    | selectFiles viewFiles|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   526
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   527
    viewFiles:= self viewFilesInDirectoryTree value.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   528
    viewFiles ifTrue:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   529
        selectFiles := self currentFileNameHolder value.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   530
    ] ifFalse:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   531
        selectFiles := self currentDirectories value.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   532
    ].
4018
43e02c59719d *** empty log message ***
penk
parents: 4011
diff changeset
   533
    self rootHolder notNil ifTrue:[
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   534
        self selectFiles:selectFiles.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   535
      ^ self
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   536
    ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   537
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   538
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   539
rootHolderChanged
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   540
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   541
    |list file rootHolder|
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   542
    list := self fileList.
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   543
    rootHolder := self rootHolder.
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   544
    file := rootHolder value.
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   545
    file notNil ifTrue:[
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   546
        file := Filename named:(file asString).
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   547
        file isDirectory ifTrue:[
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   548
            list directory:file
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   549
        ]
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   550
    ].
4071
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
   551
    self rootHolder value:(list directory asString) withoutNotifying:self.
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   552
!
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   553
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   554
selectionChanged
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   555
3995
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
   556
    |sel currentFileDir|
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   557
3995
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
   558
    " if viewFiles is false i can't take my 
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
   559
      selection to overwrite currentFileNameHolder"
8341aed594d2 Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents: 3989
diff changeset
   560
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   561
    sel := self selectedFiles.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   562
    (self viewFilesInDirectoryTree value not) ifTrue:[
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   563
        (self currentFilesAreInSameDirectory and:[sel size == 1]) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   564
            currentFileDir := self getDirWithoutFileName:(self currentFileNameHolder value first).
321c1729db5b initial checkin
penk
parents:
diff changeset
   565
            (sel first = currentFileDir) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   566
                ^ self.
321c1729db5b initial checkin
penk
parents:
diff changeset
   567
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   568
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   569
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   570
    self currentFileNameHolder value:sel.
321c1729db5b initial checkin
penk
parents:
diff changeset
   571
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   572
321c1729db5b initial checkin
penk
parents:
diff changeset
   573
update:something with:aParameter from:aModel 
321c1729db5b initial checkin
penk
parents:
diff changeset
   574
    "one of my models changed
321c1729db5b initial checkin
penk
parents:
diff changeset
   575
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   576
321c1729db5b initial checkin
penk
parents:
diff changeset
   577
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   578
    " the execution of selectionChanged and currentFileNameHolderChanged must
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   579
      lock against each other because values dont must be the same (e.g. no files
321c1729db5b initial checkin
penk
parents:
diff changeset
   580
      in tree view)
321c1729db5b initial checkin
penk
parents:
diff changeset
   581
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   582
321c1729db5b initial checkin
penk
parents:
diff changeset
   583
    aModel == self currentFileNameHolder ifTrue:[
4003
4e74b3a853c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4002
diff changeset
   584
        super update:something with:aParameter from:aModel.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   585
        self updateTreeSelection doIfUnLocked:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   586
            self updateToExternFileHolderLock doLocked:[
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   587
                self currentFileNameHolderChanged.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   588
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   589
        ].
4003
4e74b3a853c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4002
diff changeset
   590
        ^ self.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   591
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   592
    aModel == self treeSelectionHolder ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   593
        self updateToExternFileHolderLock doIfUnLocked:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   594
            self updateTreeSelection doLocked:[
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   595
                self selectionChanged.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   596
            ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   597
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   598
        ^ self
321c1729db5b initial checkin
penk
parents:
diff changeset
   599
    ].
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   600
    aModel == self rootHolder ifTrue:[
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   601
        self rootHolderChanged.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   602
        ^ self.
321c1729db5b initial checkin
penk
parents:
diff changeset
   603
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   604
    aModel == self viewFilesInDirectoryTree ifTrue:[
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   605
        self updateToExternFileHolderLock doLocked:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   606
            self changeMatchBlock.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   607
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   608
        ^ self.
321c1729db5b initial checkin
penk
parents:
diff changeset
   609
    ].
3989
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   610
    aModel == self sortBlockHolder ifTrue:[
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   611
        self evaluateSortBlock.
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   612
        ^ self.
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   613
    ].             
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   614
    aModel == self filterBlockHolder ifTrue:[
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   615
        " filter goes only on fileNames not on directories 
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   616
          have to change the matchBlock only if files are shown"
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   617
        self viewFilesInDirectoryTree value ifTrue:[
4018
43e02c59719d *** empty log message ***
penk
parents: 4011
diff changeset
   618
            self changeMatchBlock.
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   619
        ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   620
        ^ self
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   621
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   622
    super update:something with:aParameter from:aModel.
321c1729db5b initial checkin
penk
parents:
diff changeset
   623
    ^ self
321c1729db5b initial checkin
penk
parents:
diff changeset
   624
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   625
321c1729db5b initial checkin
penk
parents:
diff changeset
   626
!DirectoryTreeBrowser methodsFor:'drag & drop'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   627
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   628
canDrop:aContext
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   629
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   630
    ^ canDropItem
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   631
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   632
321c1729db5b initial checkin
penk
parents:
diff changeset
   633
doDrop:aContext 
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   634
    |col destination destinationPath receiver|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   635
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   636
    destination := self fileList draggedItem.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   637
    self dropLeave:aContext.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   638
    destination ifNil:[^ false].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   639
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   640
    destinationPath := destination fileName.
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   641
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   642
    aContext dropSource argument == #archivApplication ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   643
        receiver := aContext dropSource receiver.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   644
        receiver extractSelectedFilesTo:destinationPath askForExtractOptions:true.
321c1729db5b initial checkin
penk
parents:
diff changeset
   645
        ^ true
321c1729db5b initial checkin
penk
parents:
diff changeset
   646
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   647
    col := OrderedCollection new.
321c1729db5b initial checkin
penk
parents:
diff changeset
   648
    aContext dropObjects do:[:obj | 
321c1729db5b initial checkin
penk
parents:
diff changeset
   649
        col add:(obj theObject)
321c1729db5b initial checkin
penk
parents:
diff changeset
   650
    ].
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   651
    self copyOrMoveFiles:col to:destinationPath.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   652
    ^ true
321c1729db5b initial checkin
penk
parents:
diff changeset
   653
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   654
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   655
dropEnter:aContext
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   656
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   657
    |dropedObjects|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   658
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   659
    self dropTargetItemChangedTo:nil in:aContext.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   660
    inDropMode := false.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   661
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   662
    dropedObjects := aContext dropObjects.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   663
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   664
    dropedObjects do:[:aObject| |checkObject checkObjectString|
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   665
        aObject isFileObject ifFalse:[^ self].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   666
        checkObject := aObject theObject.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   667
        checkObject isFilename not ifTrue:[^ self].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   668
        ((aContext dropSource argument == #archivApplication) not) ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   669
            checkObject isSpecialFile ifTrue:[^ self].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   670
            checkObject isReadable ifFalse:[^ self].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   671
        ].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   672
    ].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   673
    inDropMode := true.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   674
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   675
321c1729db5b initial checkin
penk
parents:
diff changeset
   676
dropLeave:aDropContext 
321c1729db5b initial checkin
penk
parents:
diff changeset
   677
    "send the last time, when leaving the widget
321c1729db5b initial checkin
penk
parents:
diff changeset
   678
    "
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   679
    inDropMode ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   680
        self dropTargetItemChangedTo:nil in:aDropContext.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   681
        self removeExpandItemTimedBlock.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   682
        inDropMode := false.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   683
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   684
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   685
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   686
dropOver:aContext 
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   687
    "send the last time, when leaving the widget
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   688
    "
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   689
    |lineNr newDest|
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   690
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   691
    inDropMode ifFalse:[^ self].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   692
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   693
    lineNr  := self getLineNumberFor:aContext.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   694
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   695
    lineNr notNil ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   696
        newDest := self fileList at:lineNr ifAbsent:nil.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   697
    ].
4018
43e02c59719d *** empty log message ***
penk
parents: 4011
diff changeset
   698
    (newDest isNil or:[newDest == self fileList draggedItem]) ifTrue:[
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   699
        ^ self
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   700
    ].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   701
    newDest isDirectory not ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   702
        newDest := nil.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   703
        canDropItem := false.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   704
    ].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   705
    self dropTargetItemChangedTo:newDest in:aContext.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   706
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   707
    newDest notNil ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   708
        aContext dropSource argument == #archivApplication ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   709
            canDropItem := true.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   710
        ] ifFalse:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   711
            canDropItem := self canDropFiles:(aContext dropObjects) for:newDest fileName.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   712
        ].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   713
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   714
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   715
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   716
dropTargetItemChangedTo:anItem in:aDropContext
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   717
     |current|
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   718
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   719
    current := self fileList draggedItem.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   720
    current == anItem ifTrue:[^ self].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   721
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   722
    self fileList draggedItem:anItem.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   723
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   724
    aDropContext contentsWillChange.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   725
    current ifNotNil:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   726
        current isDirectory ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   727
            self removeExpandItemTimedBlock.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   728
            current changed:#icon.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   729
        ]
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   730
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   731
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   732
    anItem ifNotNil:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   733
        anItem isDirectory ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   734
            anItem changed:#icon.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   735
            (anItem notNil and:[anItem isDirectory and:[anItem fileName isWritable]]) ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   736
                expandItemTimedBlock := [
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   737
                        self expandForDrop:anItem with:aDropContext.    
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   738
                ].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   739
                Processor addTimedBlock:expandItemTimedBlock
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   740
                    afterMilliseconds:(self class timeForExpandOnDropInMilliseconds).
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   741
            ]
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   742
        ].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   743
    ].
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   744
    dirBrowser shown ifTrue:[
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   745
        dirBrowser repairDamage.
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   746
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   747
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   748
321c1729db5b initial checkin
penk
parents:
diff changeset
   749
expandForDrop:item with:aDropContext
321c1729db5b initial checkin
penk
parents:
diff changeset
   750
321c1729db5b initial checkin
penk
parents:
diff changeset
   751
    aDropContext saveDraw:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   752
        (self doExpand:item) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   753
            self windowGroup processExposeEvents
321c1729db5b initial checkin
penk
parents:
diff changeset
   754
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   755
    ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   756
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   757
321c1729db5b initial checkin
penk
parents:
diff changeset
   758
getDisplayObjects:anArgument
321c1729db5b initial checkin
penk
parents:
diff changeset
   759
321c1729db5b initial checkin
penk
parents:
diff changeset
   760
    | string fnName sel size stream|
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   761
    sel := self selectedItems.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   762
    size := sel size.
321c1729db5b initial checkin
penk
parents:
diff changeset
   763
    size == 0  ifTrue:[^ ''].
321c1729db5b initial checkin
penk
parents:
diff changeset
   764
    stream := WriteStream on:''.
321c1729db5b initial checkin
penk
parents:
diff changeset
   765
    stream nextPutAll:sel first baseName.
321c1729db5b initial checkin
penk
parents:
diff changeset
   766
    size == 1 ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   767
        fnName := 'ui_menuitem.xpm'.
321c1729db5b initial checkin
penk
parents:
diff changeset
   768
    ] ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   769
        fnName := 'ui_submenu_open.xpm'.
321c1729db5b initial checkin
penk
parents:
diff changeset
   770
        stream nextPutAll:' ... '.
321c1729db5b initial checkin
penk
parents:
diff changeset
   771
        stream nextPutAll:sel last baseName.
321c1729db5b initial checkin
penk
parents:
diff changeset
   772
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   773
    string := stream contents.
321c1729db5b initial checkin
penk
parents:
diff changeset
   774
    stream close.
321c1729db5b initial checkin
penk
parents:
diff changeset
   775
321c1729db5b initial checkin
penk
parents:
diff changeset
   776
    fnName := 'ui_menuitem.xpm'.
321c1729db5b initial checkin
penk
parents:
diff changeset
   777
    ^ Array with:(LabelAndIcon icon:(Image fromFile:fnName)
321c1729db5b initial checkin
penk
parents:
diff changeset
   778
                             string:(Text string:string emphasis:#bold)
321c1729db5b initial checkin
penk
parents:
diff changeset
   779
                 )
321c1729db5b initial checkin
penk
parents:
diff changeset
   780
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   781
321c1729db5b initial checkin
penk
parents:
diff changeset
   782
getDropObjects:anArgument
321c1729db5b initial checkin
penk
parents:
diff changeset
   783
321c1729db5b initial checkin
penk
parents:
diff changeset
   784
    | sel ret|
321c1729db5b initial checkin
penk
parents:
diff changeset
   785
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   786
    sel := self selectedFiles.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   787
    sel isEmpty ifTrue:[ ^ self ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   788
    ret := sel collect:[:file| 
321c1729db5b initial checkin
penk
parents:
diff changeset
   789
        DropObject newFile:file
321c1729db5b initial checkin
penk
parents:
diff changeset
   790
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   791
    ^ ret
321c1729db5b initial checkin
penk
parents:
diff changeset
   792
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   793
321c1729db5b initial checkin
penk
parents:
diff changeset
   794
getLineNumberFor:aDropContext
321c1729db5b initial checkin
penk
parents:
diff changeset
   795
    | yVisible|
321c1729db5b initial checkin
penk
parents:
diff changeset
   796
321c1729db5b initial checkin
penk
parents:
diff changeset
   797
    yVisible := (aDropContext targetPoint y).
321c1729db5b initial checkin
penk
parents:
diff changeset
   798
    ^ dirBrowser yVisibleToLineNr:yVisible.
321c1729db5b initial checkin
penk
parents:
diff changeset
   799
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   800
321c1729db5b initial checkin
penk
parents:
diff changeset
   801
removeExpandItemTimedBlock
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
   802
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   803
    expandItemTimedBlock notNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   804
        Processor removeTimedBlock:expandItemTimedBlock.
321c1729db5b initial checkin
penk
parents:
diff changeset
   805
        expandItemTimedBlock := nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   806
    ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   807
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   808
321c1729db5b initial checkin
penk
parents:
diff changeset
   809
!DirectoryTreeBrowser methodsFor:'event handling'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   810
321c1729db5b initial checkin
penk
parents:
diff changeset
   811
processEvent:anEvent
321c1729db5b initial checkin
penk
parents:
diff changeset
   812
    "filter keyboard events.
321c1729db5b initial checkin
penk
parents:
diff changeset
   813
     Return true, if I have eaten the event"
321c1729db5b initial checkin
penk
parents:
diff changeset
   814
4009
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   815
    |evView key rawKey|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   816
321c1729db5b initial checkin
penk
parents:
diff changeset
   817
    anEvent isKeyPressEvent ifTrue:[
4009
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   818
        evView := anEvent targetView.
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   819
        evView isNil ifTrue:[ ^ false].
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   820
        evView == dirBrowser ifFalse:[ ^ false].
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   821
        key    := anEvent key.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   822
        rawKey := anEvent rawKey.
321c1729db5b initial checkin
penk
parents:
diff changeset
   823
3906
8a76cb4f5884 next stage
penk
parents: 3892
diff changeset
   824
4009
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   825
        (key == #CursorLeft) ifTrue:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   826
            "go to last selection in selection history"
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   827
            (self rootSelected and:[(self fileList at:1) isExpanded not]) ifTrue:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   828
                self doGoDirectoryUp.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   829
                ^ true
4009
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   830
            ] ifFalse:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   831
                ^ false
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   832
            ]
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   833
        ].
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   834
        (key == #FocusPrevious) ifTrue:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   835
            "go to last selection in selection history"
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   836
            self doBack.
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   837
            ^ true
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   838
        ].
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   839
        (key == #FocusNext) ifTrue:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   840
            "go to next selection in selection history"
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   841
            self doForward.
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   842
            ^ true
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   843
        ].
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   844
        (key == #Replace) ifTrue:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   845
            self treeViewFileRename.
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   846
            ^ true
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   847
        ].
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   848
        (key == #Delete) ifTrue:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   849
            self doDelete.
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   850
            ^ true
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   851
        ].
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   852
        (key == #Cut) ifTrue:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   853
            self doCut.
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   854
            ^ true
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   855
        ].
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   856
        (key == #Paste) ifTrue:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   857
            self pasteFiles.
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   858
            ^ true
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   859
        ].
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   860
        (key == #Copy) ifTrue:[
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   861
            self doCopy.
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   862
            ^ true
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
   863
        ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   864
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   865
    ^ false
321c1729db5b initial checkin
penk
parents:
diff changeset
   866
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   867
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   868
!DirectoryTreeBrowser methodsFor:'file actions'!
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   869
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   870
doCopy
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   871
    "copy current selected files/directories
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   872
    "
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   873
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   874
    self copyFilesToClipBoard:self selectedItems.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   875
!
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   876
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   877
doCut
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   878
    "cut current selected files/directories
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   879
    "
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   880
    self cutFilesToClipBoard:self selectedItems.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   881
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   882
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   883
doDelete
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   884
    "delete current selected files/directories
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   885
    "
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   886
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   887
    self deleteFiles:self selectedFiles.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   888
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   889
321c1729db5b initial checkin
penk
parents:
diff changeset
   890
!DirectoryTreeBrowser methodsFor:'queries'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   891
321c1729db5b initial checkin
penk
parents:
diff changeset
   892
masterIsFileBrowser
321c1729db5b initial checkin
penk
parents:
diff changeset
   893
321c1729db5b initial checkin
penk
parents:
diff changeset
   894
    ^ self masterApplication class = FileBrowserV2
321c1729db5b initial checkin
penk
parents:
diff changeset
   895
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   896
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   897
selectedFilesIncludesNonRootDirectory
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   898
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   899
    | directories|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   900
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   901
    directories := self selectedDirectories.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   902
    directories isEmpty ifTrue:[^ false].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   903
    directories do:[:aDir|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   904
        (aDir asString) ~= (self rootHolder value) ifTrue:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   905
            ^ true
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   906
        ]
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   907
    ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   908
    ^ false
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   909
! !
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   910
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   911
!DirectoryTreeBrowser methodsFor:'selection'!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   912
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   913
firstSelectedDirectory
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   914
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   915
    | selection dirs dirIndices|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   916
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   917
    selection := self selectedItems.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   918
    selection isEmpty ifTrue:[ ^ nil ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   919
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   920
    dirs := selection collect:[:item| item isDirectory].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   921
    dirs isEmpty ifTrue:[^ nil].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   922
    dirIndices := selection collect:[:item | 
4008
ea273bf34f63 *** empty log message ***
penk
parents: 4003
diff changeset
   923
        self fileList identityIndexOf:item.
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   924
    ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   925
    ^ (self fileList at:(dirIndices min)) fileName.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   926
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   927
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   928
rootSelected
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   929
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   930
    | selectedItems |
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   931
    selectedItems := self selectedItems.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   932
    selectedItems isEmpty ifTrue:[^ false].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   933
    ^ selectedItems includesIdentical:self fileList root
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   934
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   935
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   936
selectFiles:aColOfFileOrDirectory
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   937
    "selects a file; if the file is not included in my
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   938
     root directory, the root will be changed
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   939
    "
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   940
    |items directory item newRoot|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   941
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   942
    aColOfFileOrDirectory isEmpty ifTrue:[ self selectItems:#()].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   943
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   944
    items := OrderedCollection new.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   945
    aColOfFileOrDirectory do:[:file|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   946
        file exists ifTrue:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   947
            item := self fileList findLastForFile:file.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   948
            item isNil ifTrue:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   949
                newRoot := self getCommonForCurrentFiles.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   950
                newRoot := self getDirWithoutFileName:newRoot.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   951
                self rootHolder value:newRoot.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   952
                item := self fileList root.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   953
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   954
                file isDirectory ifTrue:[ directory := file ]
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   955
                                 ifFalse:[ directory := file directory ]
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   956
                                  .
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   957
                directory == file ifFalse:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   958
                    item := item detect:[:el| el fileName = file ] ifNone:item.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   959
                ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   960
            ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   961
            "/ set a new root directory
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   962
            items add:item.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   963
        ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   964
    ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   965
    self selectItems:items
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   966
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   967
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   968
selectItems:aColOfItems
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   969
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   970
    |currentSelection newSelection|
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   971
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   972
    currentSelection := self selectedItems.
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   973
    self multipleSelect ifTrue:[
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   974
        currentSelection notNil ifTrue:[
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   975
            aColOfItems size == currentSelection size ifTrue:[
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   976
                (aColOfItems findFirst:[:item | (currentSelection includesIdentical:item) not ]) ~~ 0 ifFalse:[
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   977
                    ^ self
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   978
                ].
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   979
            ]
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   980
        ].
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   981
        newSelection := aColOfItems.
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   982
    ] ifFalse:[
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   983
        newSelection := aColOfItems isEmpty ifTrue:[nil] ifFalse:[aColOfItems first].
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   984
        newSelection == currentSelection ifTrue:[
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   985
            ^ self
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   986
        ]
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   987
    ].
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   988
            
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   989
    aColOfItems notEmpty ifTrue:[
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   990
        aColOfItems first makeVisible.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   991
    ].
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   992
    self updateToExternFileHolderLock doLocked:[
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
   993
        self treeSelectionHolder value:newSelection.
3989
7eec3cb5bce6 selectedFiles method name changed
penk
parents: 3986
diff changeset
   994
    ].
3982
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   995
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   996
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   997
selectedDirectories
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   998
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
   999
    | selItems |
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1000
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1001
    selItems := self selectedDirectoryItems.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1002
    ^ selItems collect:[: el | el fileName ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1003
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1004
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1005
selectedDirectoryItems
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1006
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1007
    | sel |
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1008
    sel := self selectedItems.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1009
    ^ sel select:[: el | el isDirectory ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1010
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1011
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1012
selectedFilenameDirectories
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1013
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1014
    | selectedItems setOfDirectories|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1015
    selectedItems := self selectedItems.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1016
    setOfDirectories := Set new.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1017
    selectedItems do:[:item|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1018
        | filename|
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1019
        filename := self getDirWithoutFileName:(item fileName).
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1020
        setOfDirectories add:filename.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1021
    ].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1022
    ^ setOfDirectories.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1023
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1024
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1025
selectedFiles
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1026
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1027
    ^ self selectedItems collect:[:item| item fileName].
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1028
!
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1029
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1030
selectedItems
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1031
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1032
    | selection |
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1033
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1034
    selection := self treeSelectionHolder value.
fc30449d705d *** empty log message ***
penk
parents: 3969
diff changeset
  1035
    selection isNil ifTrue:[ ^ #() ].
4002
a403f257ff60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
  1036
    multipleSelect ifTrue:[^ selection ].
a403f257ff60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
  1037
    ^ Array with:selection. "Wrap single value into Array"
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1038
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1039
321c1729db5b initial checkin
penk
parents:
diff changeset
  1040
!DirectoryTreeBrowser methodsFor:'startup & release'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1041
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1042
initialize
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1043
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1044
    inDropMode := false.
3961
cc887842b5ca next stage
penk
parents: 3958
diff changeset
  1045
    ^ super initialize.
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1046
!
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1047
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1048
makeDependent
321c1729db5b initial checkin
penk
parents:
diff changeset
  1049
4008
ea273bf34f63 *** empty log message ***
penk
parents: 4003
diff changeset
  1050
    super makeDependent.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1051
    self currentFileNameHolder addDependent:self.
4071
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1052
    self rootHolder addDependent:self.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1053
    self viewFilesInDirectoryTree addDependent:self.
4011
73fa35b1963b *** empty log message ***
penk
parents: 4010
diff changeset
  1054
    self filterBlockHolder addDependent:self.
3964
8697bad1c903 next stage for history
penk
parents: 3961
diff changeset
  1055
    self sortBlockHolder addDependent:self.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1056
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1057
321c1729db5b initial checkin
penk
parents:
diff changeset
  1058
postBuildAsSubcanvasWith:aBuilder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1059
321c1729db5b initial checkin
penk
parents:
diff changeset
  1060
    super postBuildAsSubcanvasWith:aBuilder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1061
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1062
321c1729db5b initial checkin
penk
parents:
diff changeset
  1063
postBuildDirBrowser:aWidget
321c1729db5b initial checkin
penk
parents:
diff changeset
  1064
321c1729db5b initial checkin
penk
parents:
diff changeset
  1065
    dirBrowser := aWidget scrolledView.
3968
a2734775a2f4 *** empty log message ***
penk
parents: 3964
diff changeset
  1066
    dirBrowser hasConstantHeight:true.
a2734775a2f4 *** empty log message ***
penk
parents: 3964
diff changeset
  1067
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1068
    dirBrowser openEditorAction:[:ln :aGC| |field item filename newFileString rename newFilename|
3957
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1069
        self allowFileOperations value ifTrue:[
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1070
            item  := self fileList at:ln.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1071
3957
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1072
            item label isString ifFalse:[
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1073
                field := nil
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1074
            ] ifTrue:[
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1075
                field := EditField new.
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1076
                field level:0.
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1077
                field acceptOnReturn:true.
4009
ed1a4c82901c *** empty log message ***
penk
parents: 4008
diff changeset
  1078
                field acceptOnLeave:false.
3957
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1079
                field acceptAction:[:x| 
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1080
                    filename := item fileName.
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1081
                    newFileString := x at:1.
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1082
                    filename baseName = newFileString ifFalse:[ 
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1083
                        (self renameFile:filename to:newFileString update:false) ifTrue:[ 
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1084
                            newFilename := filename directory construct:newFileString.
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1085
                            item fileName:newFilename.
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1086
                            self updateAndSelect:(OrderedCollection with:newFilename).
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1087
                        ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1088
                    ].
3957
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1089
                    aGC closeEditor.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1090
                ].
3957
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1091
                field font:(aGC font).
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1092
                field contents:(item label).
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1093
            ].
3957
e93370f11c10 open filename in fileentryfield on enter
penk
parents: 3956
diff changeset
  1094
            field
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1095
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1096
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1097
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1098
321c1729db5b initial checkin
penk
parents:
diff changeset
  1099
postBuildWith:aBuilder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1100
321c1729db5b initial checkin
penk
parents:
diff changeset
  1101
    super postBuildWith:aBuilder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1102
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1103
4071
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1104
postOpen
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1105
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1106
    self rootHolderChanged.
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1107
    self abstractCurrentFileNameHolderChanged.
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1108
    self currentFileNameHolderChanged.
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1109
    self windowGroup addPreEventHook:self.
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1110
!
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1111
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1112
postOpenAsSubcanvasWith:aBuilder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1113
4071
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1114
    super postOpenAsSubcanvasWith:aBuilder.
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1115
    self postOpen.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1116
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1117
321c1729db5b initial checkin
penk
parents:
diff changeset
  1118
postOpenWith:aBuilder
4071
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1119
    "only invoked if the application not started from a master"
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1120
4071
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1121
    super postOpenWith:aBuilder.
f923c8257818 *** empty log message ***
penk
parents: 4021
diff changeset
  1122
    self postOpen.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1123
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1124
321c1729db5b initial checkin
penk
parents:
diff changeset
  1125
preBuildWith:aBuilder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1126
321c1729db5b initial checkin
penk
parents:
diff changeset
  1127
    self masterApplication isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1128
        self masterApplication:nil.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1129
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1130
    ^ super preBuildWith:aBuilder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1131
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1132
321c1729db5b initial checkin
penk
parents:
diff changeset
  1133
release
321c1729db5b initial checkin
penk
parents:
diff changeset
  1134
321c1729db5b initial checkin
penk
parents:
diff changeset
  1135
    self fileList stopMonitoringTask.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1136
    ^ super release.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1137
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1138
321c1729db5b initial checkin
penk
parents:
diff changeset
  1139
!DirectoryTreeBrowser::DirTreeBrowserHFL methodsFor:'accessing'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1140
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1141
draggedItem
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1142
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1143
    ^ draggedItem
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1144
!
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1145
3952
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1146
draggedItem:anItemOrNil
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1147
c04d4781a37e next stage
penk
parents: 3942
diff changeset
  1148
    draggedItem := anItemOrNil.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1149
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1150
321c1729db5b initial checkin
penk
parents:
diff changeset
  1151
!DirectoryTreeBrowser::DirTreeBrowserHFL methodsFor:'protocol'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1152
3969
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1153
grayDirectoryIcon
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1154
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1155
    grayDirectoryIcon isNil ifTrue:[
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1156
        grayDirectoryIcon := (FileBrowser iconForKeyMatching:#directoryOpenGray).
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1157
    ].
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1158
    ^ grayDirectoryIcon
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1159
!
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1160
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1161
iconFor:anItem
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1162
    "returns the icon for an item
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1163
    "
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1164
321c1729db5b initial checkin
penk
parents:
diff changeset
  1165
    draggedItem == anItem ifTrue:[
3969
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1166
        ^ self grayDirectoryIcon.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1167
    ].
3969
ed8ba91e959c icon for drop changes changed
penk
parents: 3968
diff changeset
  1168
    ^ super iconFor:anItem.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1169
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1170
321c1729db5b initial checkin
penk
parents:
diff changeset
  1171
!DirectoryTreeBrowser class methodsFor:'documentation'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1172
321c1729db5b initial checkin
penk
parents:
diff changeset
  1173
version
4080
c32f68f51f47 translation to german
penk
parents: 4071
diff changeset
  1174
    ^ '$Header: /cvs/stx/stx/libtool/DirectoryTreeBrowser.st,v 1.31 2002-10-28 12:37:06 penk Exp $'
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1175
! !