FindFileApplication.st
author Claus Gittinger <cg@exept.de>
Wed, 08 Oct 2003 17:34:27 +0200
changeset 5252 453aee873a3d
parent 5231 d74730347ed8
child 5279 165a7b841a86
permissions -rw-r--r--
not ifTrue -> ifFalse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5140
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
     1
"
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
     2
 COPYRIGHT (c) 2002 by eXept Software AG
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
     3
              All Rights Reserved
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
     4
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
     5
 This software is furnished under a license and may be used
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
     6
 only in accordance with the terms of that license and with the
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
     8
 be provided or otherwise made available to, or used by, any
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
     9
 other person.  No title to or ownership of the software is
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    10
 hereby transferred.
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    11
"
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    12
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    13
"{ Package: 'stx:libtool' }"
321c1729db5b initial checkin
penk
parents:
diff changeset
    14
321c1729db5b initial checkin
penk
parents:
diff changeset
    15
AbstractFileApplicationNoteBookComponent subclass:#FindFileApplication
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
    16
	instanceVariableNames:'searchDirectories searchDirectoryHolder notSearchForSameContents
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
    17
		namePatternHolder ignoreCaseInName contentsPatternHolder
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
    18
		ignoreCaseInContents notContentsPatternHolder
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
    19
		ignoreCaseInNotContents findFileView searchResultTable resultList
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
    20
		enableStop enableSearch stopSignal accessLock searchTask expanded
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
    21
		searchRecursively selectionHolder hasListEntries
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
    22
		targetApplication useLocate'
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    23
	classVariableNames:''
321c1729db5b initial checkin
penk
parents:
diff changeset
    24
	poolDictionaries:''
321c1729db5b initial checkin
penk
parents:
diff changeset
    25
	category:'Interface-Tools-File'
321c1729db5b initial checkin
penk
parents:
diff changeset
    26
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    27
5140
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    28
!FindFileApplication class methodsFor:'documentation'!
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    29
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    30
copyright
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    31
"
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    32
 COPYRIGHT (c) 2002 by eXept Software AG
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    33
              All Rights Reserved
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    34
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    35
 This software is furnished under a license and may be used
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    36
 only in accordance with the terms of that license and with the
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    37
 inclusion of the above copyright notice.   This software may not
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    38
 be provided or otherwise made available to, or used by, any
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    39
 other person.  No title to or ownership of the software is
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    40
 hereby transferred.
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    41
"
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5010
diff changeset
    42
! !
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    43
321c1729db5b initial checkin
penk
parents:
diff changeset
    44
!FindFileApplication class methodsFor:'instance creation'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    45
321c1729db5b initial checkin
penk
parents:
diff changeset
    46
open
321c1729db5b initial checkin
penk
parents:
diff changeset
    47
321c1729db5b initial checkin
penk
parents:
diff changeset
    48
    ^ self openOnFileName:(Filename currentDirectory asAbsoluteFilename)
321c1729db5b initial checkin
penk
parents:
diff changeset
    49
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    50
321c1729db5b initial checkin
penk
parents:
diff changeset
    51
openOnFileName:aFileName
321c1729db5b initial checkin
penk
parents:
diff changeset
    52
321c1729db5b initial checkin
penk
parents:
diff changeset
    53
    | instance builder|
321c1729db5b initial checkin
penk
parents:
diff changeset
    54
321c1729db5b initial checkin
penk
parents:
diff changeset
    55
    builder := super open.
321c1729db5b initial checkin
penk
parents:
diff changeset
    56
    instance := builder application.
3983
dd593a7482fa *** empty log message ***
penk
parents: 3937
diff changeset
    57
    instance item:(DirectoryContentsBrowser itemClass fileName:aFileName).
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    58
    ^ builder
321c1729db5b initial checkin
penk
parents:
diff changeset
    59
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    60
321c1729db5b initial checkin
penk
parents:
diff changeset
    61
openOnFileName:aFileName for:aTargetApplication
321c1729db5b initial checkin
penk
parents:
diff changeset
    62
321c1729db5b initial checkin
penk
parents:
diff changeset
    63
    | instance builder|
321c1729db5b initial checkin
penk
parents:
diff changeset
    64
321c1729db5b initial checkin
penk
parents:
diff changeset
    65
    builder := super open.
321c1729db5b initial checkin
penk
parents:
diff changeset
    66
    instance := builder application.
3983
dd593a7482fa *** empty log message ***
penk
parents: 3937
diff changeset
    67
    instance item:(DirectoryContentsBrowser itemClass fileName:aFileName).
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
    68
    instance targetApplication:aTargetApplication.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    69
    ^ builder
321c1729db5b initial checkin
penk
parents:
diff changeset
    70
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
    71
321c1729db5b initial checkin
penk
parents:
diff changeset
    72
!FindFileApplication class methodsFor:'defaults'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    73
321c1729db5b initial checkin
penk
parents:
diff changeset
    74
tabStringFor:aApplicationType
321c1729db5b initial checkin
penk
parents:
diff changeset
    75
321c1729db5b initial checkin
penk
parents:
diff changeset
    76
    ^ 'Find file in:'
321c1729db5b initial checkin
penk
parents:
diff changeset
    77
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
    78
321c1729db5b initial checkin
penk
parents:
diff changeset
    79
!FindFileApplication class methodsFor:'interface specs'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    80
321c1729db5b initial checkin
penk
parents:
diff changeset
    81
windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
    82
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
    83
     by the UIPainter of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
    84
321c1729db5b initial checkin
penk
parents:
diff changeset
    85
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
    86
     the UIPainter may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
    87
321c1729db5b initial checkin
penk
parents:
diff changeset
    88
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
    89
     UIPainter new openOnClass:FindFileApplication andSelector:#windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
    90
     FindFileApplication new openInterface:#windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
    91
     FindFileApplication open
321c1729db5b initial checkin
penk
parents:
diff changeset
    92
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
    93
321c1729db5b initial checkin
penk
parents:
diff changeset
    94
    <resource: #canvas>
321c1729db5b initial checkin
penk
parents:
diff changeset
    95
321c1729db5b initial checkin
penk
parents:
diff changeset
    96
    ^ 
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
    97
     #(FullSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
    98
        name: windowSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
    99
        window: 
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   100
       (WindowSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   101
          label: 'File Search'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   102
          name: 'File Search'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   103
          min: (Point 377 131)
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   104
          max: (Point 1280 1024)
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   105
          bounds: (Rectangle 10 46 675 378)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   106
        )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   107
        component: 
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   108
       (SpecCollection
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   109
          collection: (
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   110
           (MenuPanelSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   111
              name: 'ToolBar1'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   112
              layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0)
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   113
              level: 0
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   114
              menu: searchMenu
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   115
              textDefault: true
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   116
            )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   117
           (ViewSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   118
              name: 'Box1'
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   119
              layout: (LayoutFrame 0 0.0 32 0 0 1.0 132 0)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   120
              component: 
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   121
             (SpecCollection
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   122
                collection: (
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   123
                 (LabelSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   124
                    label: 'Directory:'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   125
                    name: 'DirectoryLabel'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   126
                    layout: (LayoutFrame 4 0 7 0 136 0 24 0)
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   127
                    translateLabel: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   128
                    adjust: left
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   129
                  )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   130
                 (FilenameInputFieldSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   131
                    name: 'DirectoryEntryField'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   132
                    layout: (LayoutFrame 140 0 4 0 -246 1 24 0)
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   133
                    model: searchDirectoryHolder
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   134
                    immediateAccept: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   135
                    acceptOnPointerLeave: false
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   136
                  )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   137
                 (CheckBoxSpec
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   138
                    label: 'Use ''locate'' Cmd'
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   139
                    name: 'UseLocateCheckBox'
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   140
                    layout: (LayoutFrame -236 1 5 0 -105 1 28 0)
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   141
                    visibilityChannel: canUseLocate
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   142
                    tabable: true
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   143
                    model: useLocate
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   144
                    translateLabel: true
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   145
                  )
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   146
                 (CheckBoxSpec
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   147
                    label: 'Recursively'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   148
                    name: 'RecursiveSearchCheckBox'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   149
                    layout: (LayoutFrame -97 1 5 0 0 1 28 0)
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   150
                    tabable: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   151
                    model: searchRecursively
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   152
                    translateLabel: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   153
                  )
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   154
                 (LabelSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   155
                    label: 'Search files named:'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   156
                    name: 'FileNameLabel'
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   157
                    layout: (LayoutFrame 4 0 30 0 136 0 47 0)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   158
                    translateLabel: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   159
                    adjust: left
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   160
                  )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   161
                 (InputFieldSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   162
                    name: 'FileNameEntryField'
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   163
                    layout: (LayoutFrame 140 0 28 0 -246 1 48 0)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   164
                    tabable: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   165
                    model: namePatternHolder
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   166
                    immediateAccept: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   167
                    acceptOnLeave: false
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   168
                    acceptOnPointerLeave: false
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   169
                  )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   170
                 (CheckBoxSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   171
                    label: 'Directories'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   172
                    name: 'SearchDirectoriesCheckBox'
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   173
                    layout: (LayoutFrame -236 1 29 0 -105 1 49 0)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   174
                    tabable: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   175
                    model: searchDirectories
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   176
                    translateLabel: true
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   177
                  )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   178
                 (CheckBoxSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   179
                    label: 'Ignore case'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   180
                    name: 'IgnoreCaseInNameCheckBox'
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   181
                    layout: (LayoutFrame -97 1 29 0 0 1 49 0)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   182
                    tabable: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   183
                    model: ignoreCaseInName
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   184
                    translateLabel: true
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   185
                  )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   186
                 (LabelSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   187
                    label: 'Containing the string:'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   188
                    name: 'ContentsLabel'
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   189
                    layout: (LayoutFrame 4 0 55 0 136 0 72 0)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   190
                    translateLabel: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   191
                    adjust: left
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   192
                  )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   193
                 (InputFieldSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   194
                    name: 'ContentsEntryField'
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   195
                    layout: (LayoutFrame 140 0 52 0 -115 1 72 0)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   196
                    enableChannel: notSearchForSameContents
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   197
                    tabable: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   198
                    model: contentsPatternHolder
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   199
                    immediateAccept: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   200
                    acceptOnPointerLeave: false
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   201
                  )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   202
                 (CheckBoxSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   203
                    label: 'Ignore case'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   204
                    name: 'IgnoreCaseInContentsCheckBox'
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   205
                    layout: (LayoutFrame -97 1 52 0 0 1 75 0)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   206
                    enableChannel: notSearchForSameContents
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   207
                    tabable: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   208
                    model: ignoreCaseInContents
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   209
                    translateLabel: true
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   210
                  )
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   211
                 (LabelSpec
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   212
                    label: 'Not Containing:'
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   213
                    name: 'NotContentsLabel'
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   214
                    layout: (LayoutFrame 4 0 79 0 136 0 96 0)
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   215
                    translateLabel: true
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   216
                    adjust: left
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   217
                  )
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   218
                 (InputFieldSpec
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   219
                    name: 'NotContentsEntryField'
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   220
                    layout: (LayoutFrame 140 0 76 0 -115 1 96 0)
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   221
                    enableChannel: notSearchForSameContents
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   222
                    tabable: true
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   223
                    model: notContentsPatternHolder
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   224
                    immediateAccept: true
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   225
                    acceptOnPointerLeave: false
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   226
                  )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   227
                 (CheckBoxSpec
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   228
                    label: 'Ignore case'
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   229
                    name: 'IgnoreCaseInNotContentsCheckBox'
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   230
                    layout: (LayoutFrame -97 1 76 0 0 1 99 0)
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   231
                    enableChannel: notSearchForSameContents
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   232
                    tabable: true
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   233
                    model: ignoreCaseInNotContents
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   234
                    translateLabel: true
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   235
                  )
321c1729db5b initial checkin
penk
parents:
diff changeset
   236
                 )
321c1729db5b initial checkin
penk
parents:
diff changeset
   237
               
321c1729db5b initial checkin
penk
parents:
diff changeset
   238
              )
321c1729db5b initial checkin
penk
parents:
diff changeset
   239
            )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   240
           (SequenceViewSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   241
              name: 'List1'
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   242
              layout: (LayoutFrame 0 0.0 132 0 0 1.0 0 1)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   243
              model: selectionHolder
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   244
              menu: menu
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   245
              hasHorizontalScrollBar: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   246
              hasVerticalScrollBar: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   247
              isMultiSelect: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   248
              doubleClickSelector: fileDoubleClick:
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   249
              useIndex: true
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   250
              sequenceList: resultList
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   251
            )
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   252
           (ProgressIndicatorSpec
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   253
              name: 'ProgressIndicator1'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   254
              layout: (LayoutFrame 125 0 11 0 231 0 21 0)
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   255
              visibilityChannel: enableStop
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   256
              backgroundColor: (Color 0.0 66.9993 66.9993)
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   257
              showPercentage: false
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   258
              isActivityIndicator: true
4168
8b7555e00ee3 progressIndicator added
penk
parents: 4145
diff changeset
   259
            )
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   260
           )
321c1729db5b initial checkin
penk
parents:
diff changeset
   261
         
321c1729db5b initial checkin
penk
parents:
diff changeset
   262
        )
321c1729db5b initial checkin
penk
parents:
diff changeset
   263
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   264
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   265
321c1729db5b initial checkin
penk
parents:
diff changeset
   266
!FindFileApplication class methodsFor:'menu specs'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   267
321c1729db5b initial checkin
penk
parents:
diff changeset
   268
menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   269
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   270
     by the MenuEditor of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   271
321c1729db5b initial checkin
penk
parents:
diff changeset
   272
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   273
     the MenuEditor may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   274
321c1729db5b initial checkin
penk
parents:
diff changeset
   275
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   276
     MenuEditor new openOnClass:FindFileApplication andSelector:#menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   277
     (Menu new fromLiteralArrayEncoding:(FindFileApplication menu)) startUp
321c1729db5b initial checkin
penk
parents:
diff changeset
   278
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   279
321c1729db5b initial checkin
penk
parents:
diff changeset
   280
    <resource: #menu>
321c1729db5b initial checkin
penk
parents:
diff changeset
   281
321c1729db5b initial checkin
penk
parents:
diff changeset
   282
    ^ 
321c1729db5b initial checkin
penk
parents:
diff changeset
   283
     #(#Menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   284
        #(
321c1729db5b initial checkin
penk
parents:
diff changeset
   285
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   286
            #label: 'Select in Browser'
321c1729db5b initial checkin
penk
parents:
diff changeset
   287
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   288
            #isVisible: #isEmbeddedApplication
321c1729db5b initial checkin
penk
parents:
diff changeset
   289
            #value: #selectInBrowser
321c1729db5b initial checkin
penk
parents:
diff changeset
   290
            #enabled: #hasOneFileSelected
321c1729db5b initial checkin
penk
parents:
diff changeset
   291
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   292
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   293
            #label: 'Copy Selected Files'
321c1729db5b initial checkin
penk
parents:
diff changeset
   294
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   295
            #value: #copySelectedFiles
321c1729db5b initial checkin
penk
parents:
diff changeset
   296
            #enabled: #hasSelectionInResultList
321c1729db5b initial checkin
penk
parents:
diff changeset
   297
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   298
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   299
            #label: 'Open in New File Browser'
321c1729db5b initial checkin
penk
parents:
diff changeset
   300
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   301
            #value: #openInNewBrowser
321c1729db5b initial checkin
penk
parents:
diff changeset
   302
            #enabled: #hasOneFileSelected
321c1729db5b initial checkin
penk
parents:
diff changeset
   303
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   304
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   305
            #label: 'Remove selected Files'
321c1729db5b initial checkin
penk
parents:
diff changeset
   306
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   307
            #value: #removeFromList
321c1729db5b initial checkin
penk
parents:
diff changeset
   308
            #enabled: #hasSelection
321c1729db5b initial checkin
penk
parents:
diff changeset
   309
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   310
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   311
            #label: 'Remove all Files'
321c1729db5b initial checkin
penk
parents:
diff changeset
   312
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   313
            #value: #removeAllFromList
321c1729db5b initial checkin
penk
parents:
diff changeset
   314
            #enabled: #hasListEntries
321c1729db5b initial checkin
penk
parents:
diff changeset
   315
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   316
         )
321c1729db5b initial checkin
penk
parents:
diff changeset
   317
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   318
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   319
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   320
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   321
321c1729db5b initial checkin
penk
parents:
diff changeset
   322
searchMenu
321c1729db5b initial checkin
penk
parents:
diff changeset
   323
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   324
     by the MenuEditor of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   325
321c1729db5b initial checkin
penk
parents:
diff changeset
   326
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   327
     the MenuEditor may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   328
321c1729db5b initial checkin
penk
parents:
diff changeset
   329
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   330
     MenuEditor new openOnClass:FindFileApplication andSelector:#searchMenu
321c1729db5b initial checkin
penk
parents:
diff changeset
   331
     (Menu new fromLiteralArrayEncoding:(FindFileApplication searchMenu)) startUp
321c1729db5b initial checkin
penk
parents:
diff changeset
   332
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   333
321c1729db5b initial checkin
penk
parents:
diff changeset
   334
    <resource: #menu>
321c1729db5b initial checkin
penk
parents:
diff changeset
   335
321c1729db5b initial checkin
penk
parents:
diff changeset
   336
    ^ 
321c1729db5b initial checkin
penk
parents:
diff changeset
   337
     #(#Menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   338
        #(
321c1729db5b initial checkin
penk
parents:
diff changeset
   339
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   340
            #label: 'Search'
321c1729db5b initial checkin
penk
parents:
diff changeset
   341
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   342
            #isButton: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   343
            #value: #doSearch
321c1729db5b initial checkin
penk
parents:
diff changeset
   344
            #labelImage: #(#ResourceRetriever #ToolbarIconLibrary #search20x20Icon)
321c1729db5b initial checkin
penk
parents:
diff changeset
   345
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   346
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   347
            #label: 'Stop'
321c1729db5b initial checkin
penk
parents:
diff changeset
   348
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   349
            #isButton: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   350
            #value: #stop
321c1729db5b initial checkin
penk
parents:
diff changeset
   351
            #enabled: #enableStop
321c1729db5b initial checkin
penk
parents:
diff changeset
   352
            #labelImage: #(#ResourceRetriever #ToolbarIconLibrary #stop22x22Icon)
321c1729db5b initial checkin
penk
parents:
diff changeset
   353
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   354
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   355
            #label: 'Clean Up'
321c1729db5b initial checkin
penk
parents:
diff changeset
   356
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   357
            #isButton: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   358
            #value: #removeAllFromList
321c1729db5b initial checkin
penk
parents:
diff changeset
   359
            #enabled: #hasListEntries
321c1729db5b initial checkin
penk
parents:
diff changeset
   360
            #labelImage: #(#ResourceRetriever #Icon #deleteIcon)
321c1729db5b initial checkin
penk
parents:
diff changeset
   361
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   362
         #(#MenuItem
321c1729db5b initial checkin
penk
parents:
diff changeset
   363
            #label: 'Close'
321c1729db5b initial checkin
penk
parents:
diff changeset
   364
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   365
            #isButton: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   366
            #startGroup: #right
321c1729db5b initial checkin
penk
parents:
diff changeset
   367
            #value: #doClose
321c1729db5b initial checkin
penk
parents:
diff changeset
   368
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon)
321c1729db5b initial checkin
penk
parents:
diff changeset
   369
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   370
         )
321c1729db5b initial checkin
penk
parents:
diff changeset
   371
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   372
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   373
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   374
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   375
321c1729db5b initial checkin
penk
parents:
diff changeset
   376
!FindFileApplication class methodsFor:'tableColumns specs'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   377
321c1729db5b initial checkin
penk
parents:
diff changeset
   378
searchResultTable
321c1729db5b initial checkin
penk
parents:
diff changeset
   379
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   380
     by the DataSetBuilder of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   381
321c1729db5b initial checkin
penk
parents:
diff changeset
   382
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   383
     the DataSetBuilder may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   384
321c1729db5b initial checkin
penk
parents:
diff changeset
   385
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   386
     DataSetBuilder new openOnClass:FindFileApplication andSelector:#searchResultTable
321c1729db5b initial checkin
penk
parents:
diff changeset
   387
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   388
321c1729db5b initial checkin
penk
parents:
diff changeset
   389
    <resource: #tableColumns>
321c1729db5b initial checkin
penk
parents:
diff changeset
   390
321c1729db5b initial checkin
penk
parents:
diff changeset
   391
    ^#(
321c1729db5b initial checkin
penk
parents:
diff changeset
   392
      #(#DataSetColumnSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   393
         #label: 'Filename'
321c1729db5b initial checkin
penk
parents:
diff changeset
   394
         #id: 'FileName'
321c1729db5b initial checkin
penk
parents:
diff changeset
   395
         #labelButtonType: #Button
321c1729db5b initial checkin
penk
parents:
diff changeset
   396
         #model: #fileName
321c1729db5b initial checkin
penk
parents:
diff changeset
   397
         #showRowSeparator: false
321c1729db5b initial checkin
penk
parents:
diff changeset
   398
         #showColSeparator: false
321c1729db5b initial checkin
penk
parents:
diff changeset
   399
       )
321c1729db5b initial checkin
penk
parents:
diff changeset
   400
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   401
    
321c1729db5b initial checkin
penk
parents:
diff changeset
   402
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   403
321c1729db5b initial checkin
penk
parents:
diff changeset
   404
!FindFileApplication methodsFor:'accessing'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   405
321c1729db5b initial checkin
penk
parents:
diff changeset
   406
accessLock
321c1729db5b initial checkin
penk
parents:
diff changeset
   407
    "return the value of the instance variable 'accessLock' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   408
321c1729db5b initial checkin
penk
parents:
diff changeset
   409
    accessLock isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   410
        accessLock := Semaphore forMutualExclusion name:'accessLock'.
321c1729db5b initial checkin
penk
parents:
diff changeset
   411
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   412
    ^ accessLock
321c1729db5b initial checkin
penk
parents:
diff changeset
   413
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   414
321c1729db5b initial checkin
penk
parents:
diff changeset
   415
stopSignal
321c1729db5b initial checkin
penk
parents:
diff changeset
   416
321c1729db5b initial checkin
penk
parents:
diff changeset
   417
    stopSignal isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   418
        stopSignal := Signal new.
321c1729db5b initial checkin
penk
parents:
diff changeset
   419
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   420
    ^ stopSignal
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   421
!
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   422
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   423
targetApplication:something
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   424
    "set the value of the instance variable 'targetApplication' (automatically generated)"
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   425
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   426
    targetApplication := something.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   427
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   428
321c1729db5b initial checkin
penk
parents:
diff changeset
   429
!FindFileApplication methodsFor:'actions'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   430
321c1729db5b initial checkin
penk
parents:
diff changeset
   431
changeInformationTo:aString
321c1729db5b initial checkin
penk
parents:
diff changeset
   432
321c1729db5b initial checkin
penk
parents:
diff changeset
   433
    self changeInformationTo:aString toTab:false
321c1729db5b initial checkin
penk
parents:
diff changeset
   434
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   435
321c1729db5b initial checkin
penk
parents:
diff changeset
   436
changeInformationTo:aString toTab:aBoolean
321c1729db5b initial checkin
penk
parents:
diff changeset
   437
    masterApplication isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   438
        findFileView label:aString
321c1729db5b initial checkin
penk
parents:
diff changeset
   439
    ] ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   440
        aBoolean ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   441
            masterApplication tabStringChangeTo:aString for:self
321c1729db5b initial checkin
penk
parents:
diff changeset
   442
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   443
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   444
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   445
321c1729db5b initial checkin
penk
parents:
diff changeset
   446
copySelectedFiles
321c1729db5b initial checkin
penk
parents:
diff changeset
   447
    |sel list stream|
321c1729db5b initial checkin
penk
parents:
diff changeset
   448
321c1729db5b initial checkin
penk
parents:
diff changeset
   449
    sel := self selectionHolder value.
321c1729db5b initial checkin
penk
parents:
diff changeset
   450
    list := self resultList.
321c1729db5b initial checkin
penk
parents:
diff changeset
   451
    (sel notNil and:[sel notEmpty]) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   452
        stream := WriteStream on:''.
321c1729db5b initial checkin
penk
parents:
diff changeset
   453
        sel do:[: key |
321c1729db5b initial checkin
penk
parents:
diff changeset
   454
            stream nextPutAll:(list at:key).
321c1729db5b initial checkin
penk
parents:
diff changeset
   455
            stream cr.
321c1729db5b initial checkin
penk
parents:
diff changeset
   456
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   457
        self window setTextSelection:stream contents.
321c1729db5b initial checkin
penk
parents:
diff changeset
   458
        stream close.
321c1729db5b initial checkin
penk
parents:
diff changeset
   459
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   460
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   461
321c1729db5b initial checkin
penk
parents:
diff changeset
   462
doSearch
321c1729db5b initial checkin
penk
parents:
diff changeset
   463
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   464
    | namePattern namePatterns contentsPattern notContentsPattern dir|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   465
321c1729db5b initial checkin
penk
parents:
diff changeset
   466
"/    self changeExtentToSeeSearchResult.
321c1729db5b initial checkin
penk
parents:
diff changeset
   467
321c1729db5b initial checkin
penk
parents:
diff changeset
   468
    dir := self searchDirectoryHolder value.
321c1729db5b initial checkin
penk
parents:
diff changeset
   469
    dir isNil ifTrue:[
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   470
        Dialog warn:'Missing directory name'.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   471
        ^ self.
321c1729db5b initial checkin
penk
parents:
diff changeset
   472
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   473
    dir asFilename exists not ifTrue:[
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   474
        Dialog warn:('No such directory: %1' bindWith:dir asString allBold).
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   475
        ^ self.
321c1729db5b initial checkin
penk
parents:
diff changeset
   476
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   477
    
321c1729db5b initial checkin
penk
parents:
diff changeset
   478
    searchTask notNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   479
        (Dialog 
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   480
            confirm:(resources string:'There is already another find-file task running !!') withCRs
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   481
            yesLabel:(resources at:'Stop other Task and Proceed')
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   482
            noLabel:(resources at:'Cancel'))
321c1729db5b initial checkin
penk
parents:
diff changeset
   483
        ifFalse:[^ self].
321c1729db5b initial checkin
penk
parents:
diff changeset
   484
        self stop.
321c1729db5b initial checkin
penk
parents:
diff changeset
   485
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   486
321c1729db5b initial checkin
penk
parents:
diff changeset
   487
    namePattern := self namePatternHolder value.
321c1729db5b initial checkin
penk
parents:
diff changeset
   488
    namePattern size == 0 ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   489
        namePatterns := nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   490
    ] ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   491
        ignoreCaseInName value ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   492
            namePattern := namePattern asLowercase
321c1729db5b initial checkin
penk
parents:
diff changeset
   493
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   494
        namePatterns := namePattern asCollectionOfSubstringsSeparatedBy:$;
321c1729db5b initial checkin
penk
parents:
diff changeset
   495
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   496
    contentsPattern := self contentsPatternHolder value.
321c1729db5b initial checkin
penk
parents:
diff changeset
   497
    contentsPattern size == 0 ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   498
        contentsPattern := nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   499
    ] ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   500
        self ignoreCaseInContents value ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   501
            contentsPattern := contentsPattern asLowercase
321c1729db5b initial checkin
penk
parents:
diff changeset
   502
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   503
    ].
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   504
    notContentsPattern := self notContentsPatternHolder value.
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   505
    notContentsPattern size == 0 ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   506
        notContentsPattern := nil
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   507
    ] ifFalse:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   508
        self ignoreCaseInNotContents value ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   509
            notContentsPattern := notContentsPattern asLowercase
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   510
        ]
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   511
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   512
    searchTask := Process for:[
5224
93c284d6fe4b locale t var declaration outside of thread doesnt work for compiled
penk
parents: 5176
diff changeset
   513
        |message t|
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   514
4168
8b7555e00ee3 progressIndicator added
penk
parents: 4145
diff changeset
   515
        [    
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   516
            (self stopSignal) catch:[
4168
8b7555e00ee3 progressIndicator added
penk
parents: 4145
diff changeset
   517
                self enableStop value:true.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   518
                self resultList removeAll.
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   519
                self changeInformationTo:'Find File ' , '- searching ' toTab:true.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   520
                self notify:'searching...'.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   521
                t := Time millisecondsToRun:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   522
                    self 
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   523
                        doFindFileNamed:namePatterns
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   524
                        directories:(self searchDirectories value)
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   525
                        ignoreCase:(self ignoreCaseInName value)
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   526
                        containingString:contentsPattern
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   527
                        ignoreCaseInContents:(self ignoreCaseInContents value)
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   528
                        notContainingString:notContentsPattern
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   529
                        ignoreCaseInNotContents:(self ignoreCaseInNotContents value)
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   530
                        sameContentsAsFile:nil 
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   531
                        sameContentsAs:nil 
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   532
                        in:(self searchDirectoryHolder value).
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   533
                ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   534
                t > 100 ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   535
                    t := ((t / 1000) asFixedPoint:2) printString , ' s'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   536
                ] ifFalse:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   537
                    t := t printString , ' ms'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   538
                ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   539
                message := 'Found %1 file%2 in %3' bindWith:(resultList size) with:(resultList size == 1 ifTrue:'' ifFalse:'s') with:t.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   540
                self enableStop value:false.
321c1729db5b initial checkin
penk
parents:
diff changeset
   541
                self enableSearch value:true.
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   542
                self changeInformationTo:'Find File ' , '- done.' toTab:true.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   543
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   544
        ] valueNowOrOnUnwindDo:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   545
            searchTask := nil.
321c1729db5b initial checkin
penk
parents:
diff changeset
   546
            self enableStop value:false.
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   547
            self notify:message.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   548
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   549
    ] priority:(Processor systemBackgroundPriority).
321c1729db5b initial checkin
penk
parents:
diff changeset
   550
321c1729db5b initial checkin
penk
parents:
diff changeset
   551
    searchTask name:('FindFile[', self searchDirectoryHolder value asFilename baseName, ']').
321c1729db5b initial checkin
penk
parents:
diff changeset
   552
    searchTask resume.
321c1729db5b initial checkin
penk
parents:
diff changeset
   553
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   554
321c1729db5b initial checkin
penk
parents:
diff changeset
   555
openInNewBrowser
321c1729db5b initial checkin
penk
parents:
diff changeset
   556
    |sel|
321c1729db5b initial checkin
penk
parents:
diff changeset
   557
321c1729db5b initial checkin
penk
parents:
diff changeset
   558
    sel := self selectionHolder value.
321c1729db5b initial checkin
penk
parents:
diff changeset
   559
    (sel notNil and:[sel notEmpty]) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   560
        FileBrowserV2 openOn:(self resultList at:sel first) asFilename
321c1729db5b initial checkin
penk
parents:
diff changeset
   561
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   562
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   563
321c1729db5b initial checkin
penk
parents:
diff changeset
   564
removeAllFromList
321c1729db5b initial checkin
penk
parents:
diff changeset
   565
321c1729db5b initial checkin
penk
parents:
diff changeset
   566
    self resultList removeAll.
321c1729db5b initial checkin
penk
parents:
diff changeset
   567
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   568
321c1729db5b initial checkin
penk
parents:
diff changeset
   569
removeFromList
321c1729db5b initial checkin
penk
parents:
diff changeset
   570
    |sel list|
321c1729db5b initial checkin
penk
parents:
diff changeset
   571
321c1729db5b initial checkin
penk
parents:
diff changeset
   572
    sel := self selectionHolder value.
321c1729db5b initial checkin
penk
parents:
diff changeset
   573
    list := self resultList.
321c1729db5b initial checkin
penk
parents:
diff changeset
   574
    (sel notNil and:[sel notEmpty]) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   575
        sel reverseDo:[: key |
321c1729db5b initial checkin
penk
parents:
diff changeset
   576
            list removeAtIndex:key
321c1729db5b initial checkin
penk
parents:
diff changeset
   577
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   578
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   579
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   580
321c1729db5b initial checkin
penk
parents:
diff changeset
   581
selectInBrowser
321c1729db5b initial checkin
penk
parents:
diff changeset
   582
    |sel entry application|
321c1729db5b initial checkin
penk
parents:
diff changeset
   583
321c1729db5b initial checkin
penk
parents:
diff changeset
   584
    sel := self selectionHolder value.
321c1729db5b initial checkin
penk
parents:
diff changeset
   585
    (sel notNil and:[sel notEmpty]) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   586
        entry := self resultList at:sel first.
5252
453aee873a3d not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 5231
diff changeset
   587
        entry asFilename exists ifFalse:[ ^ self].
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   588
        application := targetApplication ? self masterApplication.
4182
99ed9aed9fa7 select of not valid files
Michael Beyl <mb@exept.de>
parents: 4168
diff changeset
   589
        application notNil ifTrue:[
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   590
            application gotoFile:(entry asFilename).
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   591
        ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   592
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   593
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   594
321c1729db5b initial checkin
penk
parents:
diff changeset
   595
stop
321c1729db5b initial checkin
penk
parents:
diff changeset
   596
321c1729db5b initial checkin
penk
parents:
diff changeset
   597
    searchTask notNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   598
        self accessLock critical:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   599
            searchTask interruptWith:[stopSignal raiseRequest].
321c1729db5b initial checkin
penk
parents:
diff changeset
   600
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   601
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   602
    self enableStop value:false.
321c1729db5b initial checkin
penk
parents:
diff changeset
   603
    self enableSearch value:true.
321c1729db5b initial checkin
penk
parents:
diff changeset
   604
    self changeInformationTo:'Find File ' , '- search stopped' toTab:true.
321c1729db5b initial checkin
penk
parents:
diff changeset
   605
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   606
321c1729db5b initial checkin
penk
parents:
diff changeset
   607
stopSearchTask
321c1729db5b initial checkin
penk
parents:
diff changeset
   608
    |task|
321c1729db5b initial checkin
penk
parents:
diff changeset
   609
321c1729db5b initial checkin
penk
parents:
diff changeset
   610
    (task := searchTask) notNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   611
        searchTask := nil.
321c1729db5b initial checkin
penk
parents:
diff changeset
   612
321c1729db5b initial checkin
penk
parents:
diff changeset
   613
        Object errorSignal handle:[:ex|
321c1729db5b initial checkin
penk
parents:
diff changeset
   614
            Dialog warn:ex description.
321c1729db5b initial checkin
penk
parents:
diff changeset
   615
        ]do:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   616
            task isDead ifFalse:[
3937
80d958725879 terminateWithAllSUbprocesses -> xxxInGroup
Claus Gittinger <cg@exept.de>
parents: 3892
diff changeset
   617
                task terminateWithAllSubprocessesInGroup.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   618
                task waitUntilTerminated.
321c1729db5b initial checkin
penk
parents:
diff changeset
   619
            ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   620
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   621
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   622
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   623
321c1729db5b initial checkin
penk
parents:
diff changeset
   624
!FindFileApplication methodsFor:'aspects'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   625
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   626
canUseLocate
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   627
    "locate command is much faster, but:
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   628
        - only if searching recursively,
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   629
        - no case ignore
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   630
        - no contents matching
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   631
    "
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   632
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   633
    ^ OperatingSystem isUNIXlike and:[ OperatingSystem canExecuteCommand:'locate' ]
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   634
!
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   635
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   636
contentsPatternHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
   637
321c1729db5b initial checkin
penk
parents:
diff changeset
   638
    contentsPatternHolder isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   639
        contentsPatternHolder := nil asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   640
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   641
    ^ contentsPatternHolder.
321c1729db5b initial checkin
penk
parents:
diff changeset
   642
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   643
321c1729db5b initial checkin
penk
parents:
diff changeset
   644
enableSearch
321c1729db5b initial checkin
penk
parents:
diff changeset
   645
321c1729db5b initial checkin
penk
parents:
diff changeset
   646
    enableSearch isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   647
        enableSearch := true asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   648
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   649
    ^ enableSearch.
321c1729db5b initial checkin
penk
parents:
diff changeset
   650
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   651
321c1729db5b initial checkin
penk
parents:
diff changeset
   652
enableStop
321c1729db5b initial checkin
penk
parents:
diff changeset
   653
321c1729db5b initial checkin
penk
parents:
diff changeset
   654
    enableStop isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   655
        enableStop := true asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   656
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   657
    ^ enableStop.
321c1729db5b initial checkin
penk
parents:
diff changeset
   658
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   659
321c1729db5b initial checkin
penk
parents:
diff changeset
   660
hasListEntries
321c1729db5b initial checkin
penk
parents:
diff changeset
   661
321c1729db5b initial checkin
penk
parents:
diff changeset
   662
    hasListEntries isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   663
        hasListEntries := false asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   664
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   665
    ^ hasListEntries.
321c1729db5b initial checkin
penk
parents:
diff changeset
   666
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   667
321c1729db5b initial checkin
penk
parents:
diff changeset
   668
ignoreCaseInContents
321c1729db5b initial checkin
penk
parents:
diff changeset
   669
    ignoreCaseInContents isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   670
        ignoreCaseInContents := false asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   671
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   672
    ^ ignoreCaseInContents.
321c1729db5b initial checkin
penk
parents:
diff changeset
   673
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   674
321c1729db5b initial checkin
penk
parents:
diff changeset
   675
ignoreCaseInName
321c1729db5b initial checkin
penk
parents:
diff changeset
   676
321c1729db5b initial checkin
penk
parents:
diff changeset
   677
    ignoreCaseInName isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   678
        ignoreCaseInName := false asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   679
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   680
    ^ ignoreCaseInName.
321c1729db5b initial checkin
penk
parents:
diff changeset
   681
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   682
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   683
ignoreCaseInNotContents
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   684
    ignoreCaseInNotContents isNil ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   685
        ignoreCaseInNotContents := false asValue.
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   686
    ].
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   687
    ^ ignoreCaseInNotContents.
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   688
!
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   689
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   690
namePatternHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
   691
321c1729db5b initial checkin
penk
parents:
diff changeset
   692
    namePatternHolder isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   693
        namePatternHolder := '*' asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   694
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   695
    ^ namePatternHolder.
321c1729db5b initial checkin
penk
parents:
diff changeset
   696
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   697
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   698
notContentsPatternHolder
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   699
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   700
    notContentsPatternHolder isNil ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   701
        notContentsPatternHolder := nil asValue.
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   702
    ].
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   703
    ^ notContentsPatternHolder.
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   704
!
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   705
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   706
notSearchForSameContents
321c1729db5b initial checkin
penk
parents:
diff changeset
   707
321c1729db5b initial checkin
penk
parents:
diff changeset
   708
    notSearchForSameContents isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   709
        notSearchForSameContents := true asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   710
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   711
    ^ notSearchForSameContents.
321c1729db5b initial checkin
penk
parents:
diff changeset
   712
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   713
321c1729db5b initial checkin
penk
parents:
diff changeset
   714
resultList
321c1729db5b initial checkin
penk
parents:
diff changeset
   715
321c1729db5b initial checkin
penk
parents:
diff changeset
   716
    resultList isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   717
        resultList := List new.
321c1729db5b initial checkin
penk
parents:
diff changeset
   718
        resultList addDependent:self.
321c1729db5b initial checkin
penk
parents:
diff changeset
   719
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   720
    ^ resultList.
321c1729db5b initial checkin
penk
parents:
diff changeset
   721
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   722
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   723
searchDirectories
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   724
    searchDirectories isNil ifTrue:[
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   725
        searchDirectories := false asValue.
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   726
    ].
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   727
    ^ searchDirectories.
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   728
!
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
   729
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   730
searchDirectoryHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
   731
321c1729db5b initial checkin
penk
parents:
diff changeset
   732
    searchDirectoryHolder isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   733
        searchDirectoryHolder := ValueHolder new.
321c1729db5b initial checkin
penk
parents:
diff changeset
   734
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   735
    ^ searchDirectoryHolder.
321c1729db5b initial checkin
penk
parents:
diff changeset
   736
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   737
321c1729db5b initial checkin
penk
parents:
diff changeset
   738
searchRecursively
321c1729db5b initial checkin
penk
parents:
diff changeset
   739
321c1729db5b initial checkin
penk
parents:
diff changeset
   740
    searchRecursively isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   741
        searchRecursively := true asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   742
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   743
    ^ searchRecursively.
321c1729db5b initial checkin
penk
parents:
diff changeset
   744
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   745
321c1729db5b initial checkin
penk
parents:
diff changeset
   746
searchResultTable
321c1729db5b initial checkin
penk
parents:
diff changeset
   747
321c1729db5b initial checkin
penk
parents:
diff changeset
   748
    searchResultTable isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   749
        searchResultTable := self class searchResultTable asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
   750
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   751
    ^ searchResultTable.
321c1729db5b initial checkin
penk
parents:
diff changeset
   752
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   753
321c1729db5b initial checkin
penk
parents:
diff changeset
   754
selectionHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
   755
321c1729db5b initial checkin
penk
parents:
diff changeset
   756
    selectionHolder isNil ifTrue:[
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   757
        selectionHolder := ValueHolder new.
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   758
        selectionHolder addDependent:self.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   759
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   760
    ^ selectionHolder
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   761
!
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   762
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   763
useLocate
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   764
    useLocate isNil ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   765
        useLocate := false asValue.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   766
    ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   767
    ^ useLocate.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   768
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   769
321c1729db5b initial checkin
penk
parents:
diff changeset
   770
!FindFileApplication methodsFor:'change & update'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   771
321c1729db5b initial checkin
penk
parents:
diff changeset
   772
update:something with:aParameter from:changedObject
321c1729db5b initial checkin
penk
parents:
diff changeset
   773
    changedObject == self resultList ifTrue:[
4798
5db46dcc8a43 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4797
diff changeset
   774
        self hasListEntries value:(changedObject notEmpty).
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   775
        ^ self
321c1729db5b initial checkin
penk
parents:
diff changeset
   776
    ].
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   777
    changedObject == self selectionHolder ifTrue:[
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   778
        self selectInBrowser.
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   779
        ^ self
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   780
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   781
    super update:something with:aParameter from:changedObject
321c1729db5b initial checkin
penk
parents:
diff changeset
   782
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   783
321c1729db5b initial checkin
penk
parents:
diff changeset
   784
!FindFileApplication methodsFor:'event handling'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   785
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   786
fileDoubleClick:entries
4145
08d6561f7639 on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents: 4101
diff changeset
   787
    |file app openedAppl contentsPattern|
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   788
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   789
    file := self resultList at:entries first.
4182
99ed9aed9fa7 select of not valid files
Michael Beyl <mb@exept.de>
parents: 4168
diff changeset
   790
    file asFilename exists not ifTrue:[^ self].
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   791
    app := targetApplication ? self masterApplication.
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   792
    app notNil ifTrue:[
4145
08d6561f7639 on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents: 4101
diff changeset
   793
        openedAppl := app openApplForFile:file.
08d6561f7639 on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents: 4101
diff changeset
   794
        openedAppl isTextEditor ifTrue:[
08d6561f7639 on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents: 4101
diff changeset
   795
            contentsPattern := self contentsPatternHolder value.
08d6561f7639 on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents: 4101
diff changeset
   796
            (contentsPattern notNil and:[ contentsPattern notEmpty and:[contentsPattern ~= '*']]) ifTrue:[
08d6561f7639 on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents: 4101
diff changeset
   797
                openedAppl searchForPattern:contentsPattern ignoreCase:(self ignoreCaseInContents value).
08d6561f7639 on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents: 4101
diff changeset
   798
            ]        
08d6561f7639 on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents: 4101
diff changeset
   799
        ].
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   800
    ] ifFalse:[
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   801
        self openInNewBrowser.
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   802
    ]
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   803
!
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   804
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   805
processEvent:anEvent
321c1729db5b initial checkin
penk
parents:
diff changeset
   806
    "filter keyboard events.
321c1729db5b initial checkin
penk
parents:
diff changeset
   807
     Return true, if I have eaten the event"
321c1729db5b initial checkin
penk
parents:
diff changeset
   808
321c1729db5b initial checkin
penk
parents:
diff changeset
   809
    |focusView key rawKey|
321c1729db5b initial checkin
penk
parents:
diff changeset
   810
321c1729db5b initial checkin
penk
parents:
diff changeset
   811
    anEvent isKeyPressEvent ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   812
        focusView := anEvent targetView.
321c1729db5b initial checkin
penk
parents:
diff changeset
   813
        key := anEvent key.
321c1729db5b initial checkin
penk
parents:
diff changeset
   814
        rawKey := anEvent rawKey.
321c1729db5b initial checkin
penk
parents:
diff changeset
   815
321c1729db5b initial checkin
penk
parents:
diff changeset
   816
        (focusView isSameOrComponentOf:self window) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   817
            (key == #Return) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   818
                (focusView name ~= 'selectionInListView') ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   819
                    self doSearch.
321c1729db5b initial checkin
penk
parents:
diff changeset
   820
                ] ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   821
                    self hasOneFileSelected ifTrue:[
4101
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   822
                        self fileDoubleClick:(self selectionHolder value)
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   823
"/                        self isEmbeddedApplication ifTrue:[
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   824
"/                            self selectInBrowser.
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   825
"/                        ] ifFalse:[
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   826
"/                            self openInNewBrowser.
cc9cdc23b789 select & doubleClick
Claus Gittinger <cg@exept.de>
parents: 3983
diff changeset
   827
"/                        ]
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   828
                    ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   829
                ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   830
                ^ true
321c1729db5b initial checkin
penk
parents:
diff changeset
   831
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   832
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
   833
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   834
    ^ false
321c1729db5b initial checkin
penk
parents:
diff changeset
   835
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   836
321c1729db5b initial checkin
penk
parents:
diff changeset
   837
!FindFileApplication methodsFor:'private'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   838
321c1729db5b initial checkin
penk
parents:
diff changeset
   839
changeExtentToSeeSearchResult
321c1729db5b initial checkin
penk
parents:
diff changeset
   840
    
321c1729db5b initial checkin
penk
parents:
diff changeset
   841
    | extent window|
321c1729db5b initial checkin
penk
parents:
diff changeset
   842
321c1729db5b initial checkin
penk
parents:
diff changeset
   843
    expanded isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   844
        window := self builder window.
321c1729db5b initial checkin
penk
parents:
diff changeset
   845
        window ifNotNil:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   846
            window := window topView.
321c1729db5b initial checkin
penk
parents:
diff changeset
   847
            extent := window extent.
321c1729db5b initial checkin
penk
parents:
diff changeset
   848
            window extent:((extent x) @ (extent y + 300)).
321c1729db5b initial checkin
penk
parents:
diff changeset
   849
            expanded := true.
321c1729db5b initial checkin
penk
parents:
diff changeset
   850
            window containerChangedSize.
321c1729db5b initial checkin
penk
parents:
diff changeset
   851
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   852
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   853
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   854
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   855
!FindFileApplication methodsFor:'private - searching'!
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   856
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   857
doFindFileNamed:namePatterns directories:searchDirectories ignoreCase:ignCaseInName 
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   858
    containingString:contentsStringArg ignoreCaseInContents:ignCaseInContents 
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   859
    notContainingString:notContentsStringArg ignoreCaseInNotContents:ignCaseInNotContents 
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   860
    sameContentsAsFile:filenameToCompareContentsOrNil sameContentsAs:bytesToCompareContentsOrNil in:aDirectory
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   861
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   862
    |dir subDirs nameMatches lines contentsToCompare list directoryContents inStream
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   863
     doesFileMatch contentsString notContentsString check checkNot|
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   864
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   865
    contentsString := contentsStringArg.
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   866
    ignCaseInContents ifTrue:[ contentsString := contentsString asLowercase ].
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   867
    notContentsString := notContentsStringArg.
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   868
    ignCaseInNotContents ifTrue:[ notContentsString := notContentsString asLowercase ].    
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   869
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   870
    dir := aDirectory asFilename.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   871
    self changeInformationTo:'Find File ' , '- searching .' , ((dir name) copyFrom:(self searchDirectoryHolder value asString size + 1)) toTab:false.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   872
321c1729db5b initial checkin
penk
parents:
diff changeset
   873
    list := self resultList.
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   874
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   875
    doesFileMatch := 
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   876
        [:f |
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   877
            |contentsMatches|
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   878
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   879
            filenameToCompareContentsOrNil notNil ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   880
                "/ contents compare ...
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   881
                contentsMatches := false.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   882
                f pathName ~= filenameToCompareContentsOrNil pathName ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   883
                    f fileSize == filenameToCompareContentsOrNil fileSize ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   884
                        contentsToCompare isNil ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   885
                            filenameToCompareContentsOrNil fileSize < (512*1024) ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   886
                                contentsToCompare := filenameToCompareContentsOrNil binaryContentsOfEntireFile
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   887
                            ]
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   888
                        ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   889
                        contentsToCompare isNil ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   890
                            "/ too large - compare block-wise ...
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   891
                            contentsMatches := (filenameToCompareContentsOrNil sameContentsAs:f).
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   892
                        ] ifFalse:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   893
                            contentsMatches := contentsToCompare = (f binaryContentsOfEntireFile).
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   894
                        ]
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   895
                    ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   896
                ] ifFalse:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   897
                    f isSymbolicLink ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   898
                        list add: (f name , ' is a symbolic link to ' , f pathName).
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   899
                    ]
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   900
                ]
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   901
            ] ifFalse:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   902
                "/ string search ...
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   903
                contentsMatches := true.
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   904
                (contentsString notNil or:[notContentsString notNil]) ifTrue:[
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   905
                    (f exists and:[f isReadable]) ifFalse:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   906
                        list add: (('*** ' , f pathName , ' skipped - unreadable or bad symbolic link ***') asText colorizeAllWith:(Color red darkened)).
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   907
                    ] ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   908
                        f fileSize > (4024*1024) ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   909
                            list add: (('*** ' , f pathName , ' skipped - too large ***') asText colorizeAllWith:(Color red darkened)).
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   910
                        ] ifFalse:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   911
                            Stream lineTooLongErrorSignal handle:[:ex |
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   912
                                |cont|
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   913
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   914
                                "/ this typically happens, when a binary file is read linewise ...
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   915
                                cont := f readStream binary contentsOfEntireFile asString.
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   916
                                check notNil ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   917
                                    checkNot isNil ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   918
                                        contentsMatches := check value:cont
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   919
                                    ] ifFalse:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   920
                                        contentsMatches := (check value:cont) and:[(checkNot value:cont) not].
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   921
                                    ]
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   922
                                ] ifFalse:[
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   923
                                    contentsMatches := (checkNot value:cont) not.
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   924
                                ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   925
                            ] do:[    
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   926
                                contentsString notNil ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   927
                                    ignCaseInContents ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   928
                                        check := [:l | l asLowercase includesString:contentsString]
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   929
                                    ] ifFalse:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   930
                                        check := [:l | l includesString:contentsString]
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   931
                                    ].
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   932
                                ].
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   933
                                notContentsString notNil ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   934
                                    ignCaseInNotContents ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   935
                                        checkNot := [:l | l asLowercase includesString:notContentsString]
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   936
                                    ] ifFalse:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   937
                                        checkNot := [:l | l includesString:notContentsString]
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   938
                                    ].
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   939
                                ].
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   940
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   941
                                lines := f contents ? #().
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   942
                                check notNil ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   943
                                    checkNot isNil ifTrue:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   944
                                        contentsMatches := (lines contains:check).
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   945
                                    ] ifFalse:[
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   946
                                        contentsMatches := (lines contains:check) and:[(lines contains:checkNot) not]
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   947
                                    ]
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   948
                                ] ifFalse:[
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
   949
                                    contentsMatches := (lines contains:checkNot) not.
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   950
                                ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   951
                            ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   952
                        ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   953
                    ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   954
                ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   955
            ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   956
            contentsMatches
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   957
        ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   958
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   959
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   960
    (self canUseLocate 
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   961
    and:[self useLocate value
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   962
    and:[searchDirectories not]])
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   963
    ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   964
        [
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   965
            |cmd line f|
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   966
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   967
            cmd := 'locate '.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   968
            ignCaseInName ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   969
                cmd := cmd , '--ignore-case'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   970
            ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   971
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   972
            cmd := cmd , ((namePatterns collect:[:nm | dir asFilename asAbsoluteFilename constructString:nm])
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   973
                            asStringCollection asStringWith:Character space).
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   974
            inStream := PipeStream readingFrom:cmd inDirectory:dir.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   975
            [inStream atEnd] whileFalse:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   976
                line := inStream nextLine.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   977
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   978
                f := line asFilename.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   979
                (doesFileMatch value:f) ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   980
                    list add:line.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   981
                ]
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   982
            ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   983
        ] ensure:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   984
            inStream notNil ifTrue:[inStream close].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   985
        ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   986
        ^ self.
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   987
    ].
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   988
    
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   989
    bytesToCompareContentsOrNil notNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   990
        contentsToCompare := bytesToCompareContentsOrNil
321c1729db5b initial checkin
penk
parents:
diff changeset
   991
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   992
321c1729db5b initial checkin
penk
parents:
diff changeset
   993
    subDirs := OrderedCollection new.
321c1729db5b initial checkin
penk
parents:
diff changeset
   994
4638
79734f7bdfc4 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 4518
diff changeset
   995
    [
79734f7bdfc4 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 4518
diff changeset
   996
        directoryContents := dir directoryContents.
79734f7bdfc4 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 4518
diff changeset
   997
    ] on:FileStream openErrorSignal do:[:ex|
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   998
        list add:((ex parameter pathName , ' -> ' , ex description) asText colorizeAllWith:Color red darkened).
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   999
"/        self warn:('Cannot access %1\(%2)'
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
  1000
"/                        bindWith:ex parameter printString
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
  1001
"/                        with:ex description) withCRs.
4638
79734f7bdfc4 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 4518
diff changeset
  1002
        ^ self
79734f7bdfc4 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 4518
diff changeset
  1003
    ].
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
  1004
4638
79734f7bdfc4 Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 4518
diff changeset
  1005
    directoryContents sort do:[:fn |
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
  1006
        |f isDirectory|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1007
321c1729db5b initial checkin
penk
parents:
diff changeset
  1008
        f := dir construct:fn.
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
  1009
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
  1010
        isDirectory := f isDirectory.
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
  1011
        isDirectory ifTrue:[
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1012
            f isSymbolicLink ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1013
                subDirs add:f
321c1729db5b initial checkin
penk
parents:
diff changeset
  1014
            ]
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
  1015
        ].
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
  1016
        (searchDirectories or:[isDirectory not]) ifTrue:[
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1017
            (nameMatches := namePatterns isNil) ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1018
                ignCaseInName ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1019
                    nameMatches := namePatterns contains:[:aPattern | aPattern match:(fn asLowercase)]
321c1729db5b initial checkin
penk
parents:
diff changeset
  1020
                ] ifFalse:[
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
  1021
                    nameMatches := namePatterns contains:[:aPattern | aPattern match:fn]
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1022
                ]
321c1729db5b initial checkin
penk
parents:
diff changeset
  1023
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1024
            nameMatches ifTrue:[
5176
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
  1025
                (isDirectory or:[ doesFileMatch value:f ])
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
  1026
                ifTrue:[
b76af7e92feb option to use locate for faster search
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
  1027
                    list add:(f asString).
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1028
                ]
321c1729db5b initial checkin
penk
parents:
diff changeset
  1029
            ]
321c1729db5b initial checkin
penk
parents:
diff changeset
  1030
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
  1031
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1032
321c1729db5b initial checkin
penk
parents:
diff changeset
  1033
    self searchRecursively value ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1034
        subDirs do:[:dir |
321c1729db5b initial checkin
penk
parents:
diff changeset
  1035
            self
321c1729db5b initial checkin
penk
parents:
diff changeset
  1036
                doFindFileNamed:namePatterns 
4518
85b13890d7b1 allow to search for directories
Claus Gittinger <cg@exept.de>
parents: 4336
diff changeset
  1037
                directories:searchDirectories
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1038
                ignoreCase:ignCaseInName 
5231
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
  1039
                containingString:contentsString ignoreCaseInContents:ignCaseInContents 
d74730347ed8 added option to search for file NOT containing a string
Claus Gittinger <cg@exept.de>
parents: 5224
diff changeset
  1040
                notContainingString:notContentsString ignoreCaseInNotContents:ignCaseInNotContents 
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1041
                sameContentsAsFile:filenameToCompareContentsOrNil 
321c1729db5b initial checkin
penk
parents:
diff changeset
  1042
                sameContentsAs:contentsToCompare
321c1729db5b initial checkin
penk
parents:
diff changeset
  1043
                in:dir
321c1729db5b initial checkin
penk
parents:
diff changeset
  1044
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1045
    ]
321c1729db5b initial checkin
penk
parents:
diff changeset
  1046
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1047
321c1729db5b initial checkin
penk
parents:
diff changeset
  1048
!FindFileApplication methodsFor:'queries'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1049
321c1729db5b initial checkin
penk
parents:
diff changeset
  1050
getTabStringEnd
321c1729db5b initial checkin
penk
parents:
diff changeset
  1051
321c1729db5b initial checkin
penk
parents:
diff changeset
  1052
" get the tab string from the application list on the class side "
321c1729db5b initial checkin
penk
parents:
diff changeset
  1053
321c1729db5b initial checkin
penk
parents:
diff changeset
  1054
    ^ self fileName directory asString
321c1729db5b initial checkin
penk
parents:
diff changeset
  1055
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1056
321c1729db5b initial checkin
penk
parents:
diff changeset
  1057
hasOneFileSelected
321c1729db5b initial checkin
penk
parents:
diff changeset
  1058
    | sel |
321c1729db5b initial checkin
penk
parents:
diff changeset
  1059
    sel := self selectionHolder value.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1060
    ^  (sel notNil and:[sel notEmpty and:[sel size = 1]])
321c1729db5b initial checkin
penk
parents:
diff changeset
  1061
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1062
321c1729db5b initial checkin
penk
parents:
diff changeset
  1063
hasSelectionInResultList
321c1729db5b initial checkin
penk
parents:
diff changeset
  1064
    | sel |
321c1729db5b initial checkin
penk
parents:
diff changeset
  1065
    sel := self selectionHolder value.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1066
    ^  (sel notNil and:[sel notEmpty])
321c1729db5b initial checkin
penk
parents:
diff changeset
  1067
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1068
321c1729db5b initial checkin
penk
parents:
diff changeset
  1069
!FindFileApplication methodsFor:'startup & release'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1070
5010
27aa6fa93dcd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
  1071
item:anItem
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1072
4797
6e16a84c6bb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4638
diff changeset
  1073
    |file newPattern|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1074
5010
27aa6fa93dcd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
  1075
    super item:anItem.
4797
6e16a84c6bb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4638
diff changeset
  1076
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1077
    file := self fileName.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1078
    self searchDirectoryHolder value:(self getDirWithoutFileName:file).
4797
6e16a84c6bb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4638
diff changeset
  1079
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1080
    file isDirectory ifTrue:[
4797
6e16a84c6bb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4638
diff changeset
  1081
        newPattern := '*'.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1082
    ] ifFalse:[
5010
27aa6fa93dcd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
  1083
        newPattern := '*.', anItem suffix.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1084
    ].
4797
6e16a84c6bb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4638
diff changeset
  1085
    self namePatternHolder value:newPattern.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1086
    self enableStop value:false.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1087
    self enableSearch value:true.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1088
    ^ true.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1089
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1090
321c1729db5b initial checkin
penk
parents:
diff changeset
  1091
postOpenWith:aBuilder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1092
321c1729db5b initial checkin
penk
parents:
diff changeset
  1093
    self masterApplication isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1094
        self masterApplication:nil.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1095
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1096
    findFileView := aBuilder window.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1097
    self windowGroup addPreEventHook:self.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1098
    ^ super postOpenWith:aBuilder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1099
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1100
321c1729db5b initial checkin
penk
parents:
diff changeset
  1101
release
321c1729db5b initial checkin
penk
parents:
diff changeset
  1102
321c1729db5b initial checkin
penk
parents:
diff changeset
  1103
    self stopSearchTask.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1104
    ^ super release
321c1729db5b initial checkin
penk
parents:
diff changeset
  1105
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1106
321c1729db5b initial checkin
penk
parents:
diff changeset
  1107
!FindFileApplication class methodsFor:'documentation'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1108
321c1729db5b initial checkin
penk
parents:
diff changeset
  1109
version
5252
453aee873a3d not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 5231
diff changeset
  1110
    ^ '$Header: /cvs/stx/stx/libtool/FindFileApplication.st,v 1.18 2003-10-08 15:34:27 cg Exp $'
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1111
! !