AbstractDirectoryBrowser.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Jan 2020 21:02:47 +0100
changeset 19422 c6ca1c3e0fd7
parent 19266 9c289c27acf7
permissions -rw-r--r--
#REFACTORING by exept class: MultiViewToolApplication added: #askForFile:default:forSave:thenDo: changed: #askForFile:default:thenDo: #askForFile:thenDo: #menuSaveAllAs #menuSaveAs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5139
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
     1
"
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
     2
 COPYRIGHT (c) 2003 by eXept Software AG
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
     3
              All Rights Reserved
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
     4
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
     5
 This software is furnished under a license and may be used
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
     6
 only in accordance with the terms of that license and with the
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
     8
 be provided or otherwise made available to, or used by, any
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
     9
 other person.  No title to or ownership of the software is
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    10
 hereby transferred.
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    11
"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libtool' }"
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
16912
e57a97280a14 #OTHER by mawalch
mawalch
parents: 15042
diff changeset
    14
"{ NameSpace: Smalltalk }"
e57a97280a14 #OTHER by mawalch
mawalch
parents: 15042
diff changeset
    15
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
AbstractFileBrowser subclass:#AbstractDirectoryBrowser
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'inDropMode canDropItem browser updateToExternFileHolderLock'
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Interface-Tools-File'
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!AbstractDirectoryBrowser class methodsFor:'documentation'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
5139
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    25
copyright
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    26
"
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    27
 COPYRIGHT (c) 2003 by eXept Software AG
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    28
              All Rights Reserved
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    29
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    30
 This software is furnished under a license and may be used
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    31
 only in accordance with the terms of that license and with the
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    33
 be provided or otherwise made available to, or used by, any
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    34
 other person.  No title to or ownership of the software is
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    35
 hereby transferred.
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    36
"
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    37
!
4cef12eebbb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4802
diff changeset
    38
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    Abstract class containing the common code from DirectoryTreeBrowser and
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    DirectoryContentsBrowser applications.
5967
ff5e8356fcb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
    43
ff5e8356fcb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
    44
    [Author:]
ff5e8356fcb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
    45
        Christian Penk
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
"
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
17289
c695c8f3853e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 16946
diff changeset
    49
!AbstractDirectoryBrowser class methodsFor:'queries'!
c695c8f3853e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 16946
diff changeset
    50
c695c8f3853e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 16946
diff changeset
    51
isAbstract
c695c8f3853e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 16946
diff changeset
    52
    ^ self == AbstractDirectoryBrowser
c695c8f3853e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 16946
diff changeset
    53
! !
c695c8f3853e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 16946
diff changeset
    54
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
!AbstractDirectoryBrowser methodsFor:'accessing'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
18281
906957435fec #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 18270
diff changeset
    57
directory
906957435fec #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 18270
diff changeset
    58
    ^ self subclassResponsibility
906957435fec #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 18270
diff changeset
    59
906957435fec #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 18270
diff changeset
    60
    "Created: / 23-07-2018 / 12:49:38 / Stefan Vogel"
906957435fec #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 18270
diff changeset
    61
!
906957435fec #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 18270
diff changeset
    62
19011
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
    63
fileList
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
    64
    self subclassResponsibility
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
    65
!
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
    66
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
updateToExternFileHolderLock
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    updateToExternFileHolderLock isNil ifTrue:[
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
        updateToExternFileHolderLock := self class newLock.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    ].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    ^ updateToExternFileHolderLock
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
18270
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    74
!AbstractDirectoryBrowser methodsFor:'actions'!
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    75
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    76
findFilesMatching:aGLOBPattern
18750
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    77
    "search files which match aGLOBPattern.
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    78
     If a folder is selected, the search starts there;
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    79
     otherwise in the top folder"
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    80
     
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    81
    |selItem searchDir|
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    82
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    83
    (selItem := self theSingleSelectedItemOrNil) notNil ifTrue:[
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    84
        selItem isDirectory ifTrue:[
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    85
            searchDir := selItem pathName
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    86
        ] ifFalse:[
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    87
            searchDir := selItem pathName asFilename directory
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    88
        ].    
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    89
    ] ifFalse:[   
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    90
        searchDir := self directory 
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    91
    ].  
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    92
    ^ self findFilesMatching:aGLOBPattern in:searchDir
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    93
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    94
    "Created: / 17-07-2018 / 12:53:32 / Claus Gittinger"
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    95
    "Modified: / 02-05-2019 / 20:41:57 / Claus Gittinger"
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    96
!
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    97
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    98
findFilesMatching:aGLOBPattern in:searchDir
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
    99
    "search files which match aGLOBPattern."
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   100
     
18270
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   101
    |matching|
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   102
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   103
    matching := OrderedCollection new.
18750
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   104
    searchDir asFilename recursiveDirectoryContentsAsFilenamesDo:[:each |
18270
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   105
        (aGLOBPattern match:each baseName) ifTrue:[
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   106
            matching add:each
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   107
        ].    
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   108
    ].
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   109
    ^ matching
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   110
18750
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   111
    "Created: / 02-05-2019 / 18:58:30 / Claus Gittinger"
18270
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   112
! !
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   113
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
!AbstractDirectoryBrowser methodsFor:'drag & drop'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
7402
a0d38bb3a02e code cleanup
Claus Gittinger <cg@exept.de>
parents: 6590
diff changeset
   116
canDrop:aDropContext
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    ^ inDropMode and:[canDropItem]
7402
a0d38bb3a02e code cleanup
Claus Gittinger <cg@exept.de>
parents: 6590
diff changeset
   118
a0d38bb3a02e code cleanup
Claus Gittinger <cg@exept.de>
parents: 6590
diff changeset
   119
    "Modified: / 13-10-2006 / 11:35:09 / cg"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
4745
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   122
doDrop:aContext 
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   123
    |col destinationPath receiver didDrop|
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   124
4754
e8ff80bb18ea oops - dropLeave has a side effect.
Claus Gittinger <cg@exept.de>
parents: 4745
diff changeset
   125
    destinationPath := self dropDestinationPath.
e8ff80bb18ea oops - dropLeave has a side effect.
Claus Gittinger <cg@exept.de>
parents: 4745
diff changeset
   126
4745
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   127
    self dropLeave:aContext.
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   128
7586
fdeb89d217b2 changed #doDrop:
Claus Gittinger <cg@exept.de>
parents: 7420
diff changeset
   129
    destinationPath isNil ifTrue:[^ self].
4745
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   130
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   131
    aContext dropSource argument == #archivApplication ifTrue:[
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   132
        receiver := aContext dropSource receiver.
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   133
        receiver extractSelectedFilesTo:destinationPath askForExtractOptions:true.
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   134
        ^ self
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   135
    ].
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   136
9362
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   137
    self withWaitCursorDo:[
17866
6a5f75df356b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17754
diff changeset
   138
        col := aContext dropObjects collect:#theObject.
9362
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   139
        didDrop := self copyOrMoveFiles:col to:destinationPath.
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   140
        didDrop ifFalse:[
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   141
            aContext clearHasDroppedFlagToSuppressFeedBack
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   142
        ].           
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   143
    ]
4745
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   144
!
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   145
5335
c676d4fdd3f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
   146
dropDestinationPath
c676d4fdd3f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
   147
    self subclassResponsibility
c676d4fdd3f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
   148
!
c676d4fdd3f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
   149
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
dropEnter:aContext
6377
5c3a4c5d70cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6286
diff changeset
   151
    |dropObjects|
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    self dropTargetItemChangedTo:nil in:aContext.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    inDropMode := false.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
"/    self directory isNil ifTrue:[^ self].
6377
5c3a4c5d70cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6286
diff changeset
   157
    dropObjects := aContext dropObjects.
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
17754
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   159
    dropObjects do:[:eachDropObject| 
15042
f002aba0f9c9 class: AbstractDirectoryBrowser
Claus Gittinger <cg@exept.de>
parents: 12873
diff changeset
   160
        |checkObject|
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
17754
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   162
        eachDropObject isFileObject ifFalse:[^ self].
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
17754
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   164
        checkObject := eachDropObject theObject.
6250
5b0673ccff1c refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents: 5967
diff changeset
   165
        checkObject isFilename ifFalse:[^ self].
5b0673ccff1c refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents: 5967
diff changeset
   166
        (aContext dropSource argument == #archivApplication) ifFalse:[
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
            checkObject isSpecialFile ifTrue:[^ self].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
            checkObject isReadable ifFalse:[^ self].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
        ].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    ].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    inDropMode := true.
17754
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   172
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   173
    "Modified (format): / 15-11-2017 / 11:10:16 / cg"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
dropLeave:aDropContext 
9328
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   177
    "called, when leaving the widget"
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   178
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    inDropMode ifFalse:[ ^ self ].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    self dropTargetItemChangedTo:nil in:aDropContext.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    self removeExpandItemTimedBlock.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    inDropMode := false.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
5330
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   186
dropTargetItemChangedTo:anItem in:aContext
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   187
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   188
    self subclassResponsibility
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   189
!
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   190
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
getDropObjects:anArgument
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    ^ self selectedFiles collect:[:file| DropObject newFile:file].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
getLineNumberFor:aDropContext
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
    | yVisible|
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
18214
e7e8fd9c292f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 18142
diff changeset
   199
    yVisible := (aDropContext targetPointInDeviceCoordinates y).
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
    ^ browser yVisibleToRowNr:yVisible.
18214
e7e8fd9c292f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 18142
diff changeset
   201
e7e8fd9c292f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 18142
diff changeset
   202
    "Modified: / 15-06-2018 / 02:32:03 / Claus Gittinger"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
4802
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   205
pushUserEvent:selector withArgument:argument
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   206
    self window sensor 
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   207
        pushUserEvent:selector 
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   208
        for:self 
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   209
        withArgument:argument
5796
f8f1be919ad4 *** empty log message ***
penk
parents: 5444
diff changeset
   210
!
f8f1be919ad4 *** empty log message ***
penk
parents: 5444
diff changeset
   211
f8f1be919ad4 *** empty log message ***
penk
parents: 5444
diff changeset
   212
removeExpandItemTimedBlock
f8f1be919ad4 *** empty log message ***
penk
parents: 5444
diff changeset
   213
    "left blank"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
!AbstractDirectoryBrowser methodsFor:'file actions'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
doCopy
6286
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   219
    "copy the selected files/directories to the clipBoard"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    self copyFilesToClipBoard:(self selectedFiles).
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
doCut
6286
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   225
    "cut the selected files/directories to the clipBoard"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
    self cutFilesToClipBoard:(self selectedFiles).
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
doDelete
6286
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   231
    "delete the selected files/directories"
5967
ff5e8356fcb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
   232
4742
972a9d30ec47 enumerate copies of the selection in delete & rename
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
   233
    self deleteFiles:(self selectedFiles copy).
6286
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   234
!
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   235
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   236
doErase
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   237
    "erase the selected files"
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   238
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   239
    self eraseFiles:(self selectedFiles copy).
18270
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   240
!
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   241
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   242
findAndSelectFilesMatching:aGLOBPattern
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   243
    self selectFiles:(self findFilesMatching:aGLOBPattern).
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   244
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   245
    "Created: / 17-07-2018 / 12:48:23 / Claus Gittinger"
18750
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   246
!
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   247
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   248
findAndSelectNextFileMatching:aGLOBPattern
19011
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   249
    self 
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   250
        findAndSelectNextFileMatching:aGLOBPattern 
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   251
        under:(self theSingleSelectedItemOrNil ? self fileList root)
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   252
        searchInfoInto:nil
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   253
!
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   254
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   255
findAndSelectNextFileMatching:aGLOBPattern under:topDirectoryItem
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   256
    self findAndSelectNextFileMatching:aGLOBPattern under:topDirectoryItem searchInfoInto:nil
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   257
!
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   258
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   259
findAndSelectNextFileMatching:aGLOBPattern under:topDirectoryItem searchInfoInto:aBlockOrNil
18750
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   260
    |fileOrNil|
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   261
19011
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   262
    fileOrNil := self findNextFileMatching:aGLOBPattern startingAt:topDirectoryItem searchInfoInto:aBlockOrNil.
18750
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   263
    self selectFiles:(fileOrNil isNil 
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   264
                        ifTrue:[#()]
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   265
                        ifFalse:[{ fileOrNil }])
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   266
6be368350a8f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 18281
diff changeset
   267
    "Created: / 02-05-2019 / 20:43:41 / Claus Gittinger"
19011
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   268
!
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   269
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   270
findNextFileMatching:aGLOBPattern startingAt:anItemOrNil
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   271
    "search files which match aGLOBPattern in the tree."
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   272
     
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   273
    ^ self findNextFileMatching:aGLOBPattern startingAt:anItemOrNil searchInfoInto:nil
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   274
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   275
    "Created: / 02-05-2019 / 20:39:58 / Claus Gittinger"
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   276
!
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   277
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   278
findNextFileMatching:aGLOBPattern startingAt:anItemOrNil searchInfoInto:aBlockOrNil
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   279
    "search files which match aGLOBPattern in the tree.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   280
     If not nil, aBlockOrNil is called whenever a new folder is searched (for visual feeedback)"
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   281
     
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   282
    |searchFolder searchIndex stack|
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   283
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   284
    stack := OrderedCollection new.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   285
    anItemOrNil isRootItem ifFalse:[
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   286
        |i|
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   287
        
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   288
        i := anItemOrNil.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   289
        [i isRootItem] whileFalse:[
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   290
            stack addFirst:(i parent -> (i parent children indexOf:i)).
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   291
            i := i parent.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   292
        ].    
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   293
    ].
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   294
    
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   295
    anItemOrNil isDirectory ifTrue:[
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   296
        searchFolder := anItemOrNil.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   297
        searchIndex := 0.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   298
    ] ifFalse:[
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   299
        searchFolder := anItemOrNil parent.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   300
        searchIndex := anItemOrNil parent children indexOf:anItemOrNil.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   301
    ].
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   302
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   303
    stack add:(searchFolder -> searchIndex).
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   304
    
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   305
    [stack notEmpty] whileTrue:[
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   306
        |work children|
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   307
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   308
        work := stack removeLast.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   309
        searchFolder := work key.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   310
        searchIndex := work value.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   311
19266
9c289c27acf7 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 19011
diff changeset
   312
        "/ (searchFolder pathName startsWith:'/Appl') ifTrue:[self halt].
19011
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   313
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   314
        aBlockOrNil notNil ifTrue:[aBlockOrNil value:searchFolder pathName].
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   315
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   316
        children := searchFolder children.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   317
        searchIndex+1 to:(children size) doWithExit:[:childIndex :exit|
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   318
            |child fn|
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   319
            
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   320
            child := children at:childIndex.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   321
            Transcript showCR:'search %1' with:child pathName.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   322
            fn := child fileName.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   323
            fn isSymbolicLink ifFalse:[
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   324
                fn isDirectory ifFalse:[
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   325
                    (aGLOBPattern match:fn baseName) ifTrue:[
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   326
                        ^ fn pathName asFilename
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   327
                    ].
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   328
                ] ifTrue:[
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   329
                    "/ deeper, but remember to proceed here
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   330
                    stack add:(searchFolder -> childIndex).
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   331
                    stack add:(child -> 0).
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   332
                    exit value:nil.
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   333
                ]
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   334
            ]
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   335
        ].
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   336
    ].  
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   337
    ^ nil
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   338
eb958cb66cfc #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 18752
diff changeset
   339
    "Created: / 02-05-2019 / 20:39:58 / Claus Gittinger"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
!AbstractDirectoryBrowser methodsFor:'selection'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
selectedFiles
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
17866
6a5f75df356b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17754
diff changeset
   346
    ^ self selectedItems collect:#fileName.
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
!AbstractDirectoryBrowser methodsFor:'startup & release'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
initialize
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
    inDropMode := false.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
    ^ super initialize.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   357
postOpenAsSubcanvasWith:aBuilder
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   358
    "this is sent after the applications window is opened inside another application.
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   359
     Can be redefined in subclasses for actions after showing the canvas view."
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   360
18142
d367ddfbb627 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17866
diff changeset
   361
    "/ cg: used to be unconditionally true here;
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   362
    "/ but then, when a FileDialog (which is not an AbstractFileBrowser) is opened,
16912
e57a97280a14 #OTHER by mawalch
mawalch
parents: 15042
diff changeset
   363
    "/ the commonPostBuild will not properly update its enable channels;
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   364
    "/ especially the enableDirectoryUp is false.
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   365
    "/ This whole FileBrowser is so complicated that it became almost unusable.
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   366
    "/ (too much inheritance and knowledge - DirTree and DirContents should each only do
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   367
    "/ what it should and not depend on shared functionality from their superclass)
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   368
    self postOpenFromMaster:(self masterApplication class includesBehavior:AbstractFileBrowser).
18142
d367ddfbb627 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17866
diff changeset
   369
d367ddfbb627 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17866
diff changeset
   370
    "Modified (comment): / 22-05-2018 / 18:48:22 / Claus Gittinger"
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   371
!
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   372
5444
02b2cd0dfd69 open treebrowser with empty window bug
penk
parents: 5442
diff changeset
   373
postOpenFromMaster:fromMaster 
5442
4e025f6f8ed7 building not complete in open from master
penk
parents: 5335
diff changeset
   374
    self subclassResponsibility
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   377
postOpenWith:aBuilder
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   378
    "this is sent after the applications main window is opened.
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   379
     Can be redefined in subclasses for actions after opening the view."
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   380
17578
8417ebf871c2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 17289
diff changeset
   381
    super postOpenWith:aBuilder.
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   382
    self postOpenFromMaster:false.
17578
8417ebf871c2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 17289
diff changeset
   383
8417ebf871c2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 17289
diff changeset
   384
    "Modified: / 16-07-2017 / 12:19:48 / cg"
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   385
!
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   386
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
preBuildWith:aBuilder
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
    self masterApplication isNil ifTrue:[
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
        self masterApplication:nil.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
    ].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
    ^ super preBuildWith:aBuilder.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
!AbstractDirectoryBrowser class methodsFor:'documentation'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
version
16912
e57a97280a14 #OTHER by mawalch
mawalch
parents: 15042
diff changeset
   398
    ^ '$Header$'
9328
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   399
!
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   400
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   401
version_CVS
16912
e57a97280a14 #OTHER by mawalch
mawalch
parents: 15042
diff changeset
   402
    ^ '$Header$'
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
! !
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   404