AbstractDirectoryBrowser.st
author Claus Gittinger <cg@exept.de>
Wed, 12 Dec 2018 16:34:48 +0100
changeset 18542 5cea6d8f32ff
parent 18281 906957435fec
child 18750 6be368350a8f
permissions -rw-r--r--
InspectorView icons
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
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
updateToExternFileHolderLock
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    updateToExternFileHolderLock isNil ifTrue:[
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
        updateToExternFileHolderLock := self class newLock.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    ].
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
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
18270
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    70
!AbstractDirectoryBrowser methodsFor:'actions'!
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    71
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    72
findFilesMatching:aGLOBPattern
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    73
    |matching|
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    74
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    75
    matching := OrderedCollection new.
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    76
    self directory recursiveDirectoryContentsAsFilenamesDo:[:each |
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    77
        (aGLOBPattern match:each baseName) ifTrue:[
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    78
            matching add:each
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    79
        ].    
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    80
    ].
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    81
    ^ matching
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    82
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    83
    "Created: / 17-07-2018 / 12:53:32 / Claus Gittinger"
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    84
! !
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
    85
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
!AbstractDirectoryBrowser methodsFor:'drag & drop'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
7402
a0d38bb3a02e code cleanup
Claus Gittinger <cg@exept.de>
parents: 6590
diff changeset
    88
canDrop:aDropContext
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    ^ inDropMode and:[canDropItem]
7402
a0d38bb3a02e code cleanup
Claus Gittinger <cg@exept.de>
parents: 6590
diff changeset
    90
a0d38bb3a02e code cleanup
Claus Gittinger <cg@exept.de>
parents: 6590
diff changeset
    91
    "Modified: / 13-10-2006 / 11:35:09 / cg"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
4745
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
    94
doDrop:aContext 
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
    95
    |col destinationPath receiver didDrop|
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
    96
4754
e8ff80bb18ea oops - dropLeave has a side effect.
Claus Gittinger <cg@exept.de>
parents: 4745
diff changeset
    97
    destinationPath := self dropDestinationPath.
e8ff80bb18ea oops - dropLeave has a side effect.
Claus Gittinger <cg@exept.de>
parents: 4745
diff changeset
    98
4745
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
    99
    self dropLeave:aContext.
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   100
7586
fdeb89d217b2 changed #doDrop:
Claus Gittinger <cg@exept.de>
parents: 7420
diff changeset
   101
    destinationPath isNil ifTrue:[^ self].
4745
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   102
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   103
    aContext dropSource argument == #archivApplication ifTrue:[
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   104
        receiver := aContext dropSource receiver.
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   105
        receiver extractSelectedFilesTo:destinationPath askForExtractOptions:true.
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   106
        ^ self
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   107
    ].
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   108
9362
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   109
    self withWaitCursorDo:[
17866
6a5f75df356b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17754
diff changeset
   110
        col := aContext dropObjects collect:#theObject.
9362
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   111
        didDrop := self copyOrMoveFiles:col to:destinationPath.
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   112
        didDrop ifFalse:[
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   113
            aContext clearHasDroppedFlagToSuppressFeedBack
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   114
        ].           
5168543f412b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9328
diff changeset
   115
    ]
4745
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   116
!
8082c278087d drop handling
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
   117
5335
c676d4fdd3f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
   118
dropDestinationPath
c676d4fdd3f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
   119
    self subclassResponsibility
c676d4fdd3f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
   120
!
c676d4fdd3f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
   121
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
dropEnter:aContext
6377
5c3a4c5d70cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6286
diff changeset
   123
    |dropObjects|
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    self dropTargetItemChangedTo:nil in:aContext.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    inDropMode := false.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
"/    self directory isNil ifTrue:[^ self].
6377
5c3a4c5d70cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6286
diff changeset
   129
    dropObjects := aContext dropObjects.
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
17754
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   131
    dropObjects do:[:eachDropObject| 
15042
f002aba0f9c9 class: AbstractDirectoryBrowser
Claus Gittinger <cg@exept.de>
parents: 12873
diff changeset
   132
        |checkObject|
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
17754
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   134
        eachDropObject isFileObject ifFalse:[^ self].
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
17754
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   136
        checkObject := eachDropObject theObject.
6250
5b0673ccff1c refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents: 5967
diff changeset
   137
        checkObject isFilename ifFalse:[^ self].
5b0673ccff1c refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents: 5967
diff changeset
   138
        (aContext dropSource argument == #archivApplication) ifFalse:[
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
            checkObject isSpecialFile ifTrue:[^ self].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
            checkObject isReadable ifFalse:[^ self].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
        ].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    ].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    inDropMode := true.
17754
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   144
ccb938c027f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17578
diff changeset
   145
    "Modified (format): / 15-11-2017 / 11:10:16 / cg"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
dropLeave:aDropContext 
9328
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   149
    "called, when leaving the widget"
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   150
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    inDropMode ifFalse:[ ^ self ].
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:aDropContext.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    self removeExpandItemTimedBlock.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    inDropMode := false.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
5330
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   158
dropTargetItemChangedTo:anItem in:aContext
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   159
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   160
    self subclassResponsibility
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   161
!
db3c33306631 drag and drop scrolling
penk
parents: 5139
diff changeset
   162
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
getDropObjects:anArgument
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    ^ self selectedFiles collect:[:file| DropObject newFile:file].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
getLineNumberFor:aDropContext
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    | yVisible|
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
18214
e7e8fd9c292f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 18142
diff changeset
   171
    yVisible := (aDropContext targetPointInDeviceCoordinates y).
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
    ^ browser yVisibleToRowNr:yVisible.
18214
e7e8fd9c292f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 18142
diff changeset
   173
e7e8fd9c292f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 18142
diff changeset
   174
    "Modified: / 15-06-2018 / 02:32:03 / Claus Gittinger"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
4802
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   177
pushUserEvent:selector withArgument:argument
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   178
    self window sensor 
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   179
        pushUserEvent:selector 
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   180
        for:self 
681d6bada0bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   181
        withArgument:argument
5796
f8f1be919ad4 *** empty log message ***
penk
parents: 5444
diff changeset
   182
!
f8f1be919ad4 *** empty log message ***
penk
parents: 5444
diff changeset
   183
f8f1be919ad4 *** empty log message ***
penk
parents: 5444
diff changeset
   184
removeExpandItemTimedBlock
f8f1be919ad4 *** empty log message ***
penk
parents: 5444
diff changeset
   185
    "left blank"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
!AbstractDirectoryBrowser methodsFor:'file actions'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
doCopy
6286
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   191
    "copy the selected files/directories to the clipBoard"
4712
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 copyFilesToClipBoard:(self selectedFiles).
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
doCut
6286
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   197
    "cut the selected files/directories to the clipBoard"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    self cutFilesToClipBoard:(self selectedFiles).
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
doDelete
6286
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   203
    "delete the selected files/directories"
5967
ff5e8356fcb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
   204
4742
972a9d30ec47 enumerate copies of the selection in delete & rename
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
   205
    self deleteFiles:(self selectedFiles copy).
6286
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   206
!
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   207
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   208
doErase
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   209
    "erase the selected files"
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   210
fac153824f35 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6250
diff changeset
   211
    self eraseFiles:(self selectedFiles copy).
18270
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   212
!
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   213
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   214
findAndSelectFilesMatching:aGLOBPattern
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   215
    self selectFiles:(self findFilesMatching:aGLOBPattern).
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   216
07b44c3ea287 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 18214
diff changeset
   217
    "Created: / 17-07-2018 / 12:48:23 / Claus Gittinger"
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
!AbstractDirectoryBrowser methodsFor:'selection'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
selectedFiles
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
17866
6a5f75df356b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17754
diff changeset
   224
    ^ self selectedItems collect:#fileName.
16946
3684b30ce53e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 16912
diff changeset
   225
!
3684b30ce53e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 16912
diff changeset
   226
3684b30ce53e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 16912
diff changeset
   227
selectedItems
3684b30ce53e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 16912
diff changeset
   228
    self subclassResponsibility
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
!AbstractDirectoryBrowser methodsFor:'startup & release'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
initialize
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
    inDropMode := false.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
    ^ super initialize.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   239
postOpenAsSubcanvasWith:aBuilder
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   240
    "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
   241
     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
   242
18142
d367ddfbb627 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17866
diff changeset
   243
    "/ cg: used to be unconditionally true here;
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   244
    "/ but then, when a FileDialog (which is not an AbstractFileBrowser) is opened,
16912
e57a97280a14 #OTHER by mawalch
mawalch
parents: 15042
diff changeset
   245
    "/ 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
   246
    "/ especially the enableDirectoryUp is false.
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   247
    "/ 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
   248
    "/ (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
   249
    "/ 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
   250
    self postOpenFromMaster:(self masterApplication class includesBehavior:AbstractFileBrowser).
18142
d367ddfbb627 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17866
diff changeset
   251
d367ddfbb627 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17866
diff changeset
   252
    "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
   253
!
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   254
5444
02b2cd0dfd69 open treebrowser with empty window bug
penk
parents: 5442
diff changeset
   255
postOpenFromMaster:fromMaster 
5442
4e025f6f8ed7 building not complete in open from master
penk
parents: 5335
diff changeset
   256
    self subclassResponsibility
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   259
postOpenWith:aBuilder
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   260
    "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
   261
     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
   262
17578
8417ebf871c2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 17289
diff changeset
   263
    super postOpenWith:aBuilder.
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   264
    self postOpenFromMaster:false.
17578
8417ebf871c2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 17289
diff changeset
   265
8417ebf871c2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 17289
diff changeset
   266
    "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
   267
!
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   268
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
preBuildWith:aBuilder
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    self masterApplication isNil ifTrue:[
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
        self masterApplication:nil.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
    ].
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
    ^ super preBuildWith:aBuilder.
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
! !
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
!AbstractDirectoryBrowser class methodsFor:'documentation'!
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
version
16912
e57a97280a14 #OTHER by mawalch
mawalch
parents: 15042
diff changeset
   280
    ^ '$Header$'
9328
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   281
!
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   282
1adad8b2c2b7 comment/format
Claus Gittinger <cg@exept.de>
parents: 7586
diff changeset
   283
version_CVS
16912
e57a97280a14 #OTHER by mawalch
mawalch
parents: 15042
diff changeset
   284
    ^ '$Header$'
4712
da798b51457b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
! !
12873
0bf1fc08cfd1 oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents: 9362
diff changeset
   286