FileSelectionList.st
author Claus Gittinger <cg@exept.de>
Wed, 07 Jan 2004 16:43:33 +0100
changeset 2833 1544bb56f6bf
parent 2832 23ad57a4ad76
child 2913 bdf4fb09cfc0
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
     1
"
c47dbae39a71 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
62
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
     3
	      All Rights Reserved
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
     4
c47dbae39a71 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
c47dbae39a71 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
c47dbae39a71 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
c47dbae39a71 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
c47dbae39a71 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
c47dbae39a71 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
c47dbae39a71 Initial revision
claus
parents:
diff changeset
    11
"
c47dbae39a71 Initial revision
claus
parents:
diff changeset
    12
2226
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
    13
"{ Package: 'stx:libwidg' }"
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
    14
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
    15
SelectionInListView subclass:#FileSelectionList
287
82691623dd4c update fixes
ca
parents: 285
diff changeset
    16
	instanceVariableNames:'pattern directory timeStamp directoryId directoryName
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
    17
		directoryContents directoryFileTypes realAction matchBlock
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
    18
		stayInDirectory ignoreParentDirectory markDirectories
472
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
    19
		ignoreDirectories directoryChangeCheckBlock quickDirectoryChange
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
    20
		directoryChangeAction directorySelectAction fileSelectAction
2377
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
    21
		ignoreFiles directoryHolder directoryStack ignoreCaseInPattern'
282
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
    22
	classVariableNames:''
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
    23
	poolDictionaries:''
1771
c1bccfce48cd category change
Claus Gittinger <cg@exept.de>
parents: 1690
diff changeset
    24
	category:'Views-Lists'
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
    25
!
c47dbae39a71 Initial revision
claus
parents:
diff changeset
    26
1272
c22a8fbe90ed #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
    27
!FileSelectionList class methodsFor:'documentation'!
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
    28
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    29
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    30
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    31
 COPYRIGHT (c) 1993 by Claus Gittinger
62
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
    32
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    33
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    34
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    35
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    36
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    37
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    38
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    39
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    40
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    41
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    42
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
    43
documentation
c47dbae39a71 Initial revision
claus
parents:
diff changeset
    44
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    45
    this class implements file selection lists - its basically a
1272
c22a8fbe90ed #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
    46
    selection-in-list-view, but adds some right-arrows to directories.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    47
    (and will soon remember the previous position when changing directories).
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
    48
    You can specify an optional filename-pattern (such as '*.st') and an
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
    49
    optional matchBlock (such as: [:name | name startsWith:'A']).
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
    50
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
    51
    Only files (plus directories) matching the pattern (if present) and
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
    52
    for which the matchBlock returns true (if present), are shown.
21
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
    53
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    54
    Except for file-browser like applications, FileSelectionLists are almost 
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    55
    exclusively used with FileSelectionBoxes (see examples there).
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    56
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
    57
    [Instance variables:]
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    58
            pattern                 the matchpattern
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    59
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    60
            directory               the current directory
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    61
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    62
            timeStamp               the time, when directoryContents was last taken
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    63
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    64
            directoryId             the directories id (inode-nr) when it was taken
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    65
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    66
            directoryName           the path when it was taken
62
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
    67
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    68
            directoryContents       (cached) contents of current directory
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    69
2833
1544bb56f6bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
    70
            directoryFileTypes      (cached) isDirectory-boolean per entry
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    71
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    72
            fileTypes               file types as shown in list (i.e only matching ones)
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    73
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    74
            matchBlock              if non-nil: block evaluated per full filename;
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    75
                                    only files for which matchBlock returns true are shown.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    76
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    77
            realAction              (internal) the action to perform when a file is selected
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
    78
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    79
            quickDirectoryChange    if true, directories can be changed with a single click
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    80
                                    if false (the default), they need a double click.
843
20890b1098ce Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 720
diff changeset
    81
                                    Makes sense if a directory is what we are interested in,
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    82
                                    for files its better to leave it as false.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    83
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    84
            stayInDirectory         if true, no directoryChanges are allowed.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    85
                                    Makes sense to limit the user to choose among certain files.    
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    86
                                    The default is false.
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
    87
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    88
            ignoreParentDirectory   if true, the parent directory is not shown.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    89
                                    Makes sense to limit the user to files below the initial
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    90
                                    directory. Default is false.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    91
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    92
            ignoreDirectories       if true, no directories are shown at all.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    93
                                    Makes sense to limit the user to choose among regular files.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    94
                                    Default is false.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
    95
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
    96
            ignoreFiles             if true, no regular files are shown at all.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
    97
                                    Makes sense to limit the user to choose among directories files.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
    98
                                    Default is false.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
    99
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   100
            directoryChangeCheckBlock 
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   101
                                    if nonNil, directoryChanges are only allowed if this block
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   102
                                    returns true. It is evaluated with one argument, the pathName.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   103
                                    Defaults to nil (i.e. no checks).
62
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
   104
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   105
            directorySelectAction 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   106
                                    if nonNil, a directory-select evaluate this block.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   107
                                    Possible hook for others (used with Boxes)
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   108
                                    Defaults to nil.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   109
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   110
            fileSelectAction 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   111
                                    if nonNil, file-select evaluate this block.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   112
                                    Possible hook for others (used with Boxes)
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   113
                                    Defaults to nil.
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   114
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   115
    [author:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   116
        Claus Gittinger
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   117
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   118
    [see also:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   119
        DialogBox
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   120
        EnterBox2 YesNoBox
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   121
        ListSelectionBox FileSelectionBox FileSaveBox 
62
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
   122
"
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
   123
!
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   124
62
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
   125
examples 
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
   126
"
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   127
    FileSelectionLists are typically used in FileSelectionBoxes,
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   128
    or file-browser-like applications.
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   129
    Thus, the following examples are a bit untypical.
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   130
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   131
    example (plain file-list):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   132
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   133
        |list|
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   134
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   135
        list := FileSelectionList new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   136
        list open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   137
                                                                        [exEnd]
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   138
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   139
1331
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   140
    setting a directory holder:
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   141
                                                                        [exBegin]
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   142
        |holder list|
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   143
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   144
        holder := '/etc' asValue.
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   145
        list := FileSelectionList new.
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   146
        list directoryHolder:holder.
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   147
        list open.
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   148
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   149
        (EditField on:holder) open.
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   150
                                                                        [exEnd]
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   151
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   152
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   153
    scrolled & some action:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   154
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   155
        |top v list|
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   156
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   157
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   158
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   159
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   160
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   161
        list := v scrolledView.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   162
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   163
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   164
                                                                        [exEnd]
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   165
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   166
    ignore the parentDirectory:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   167
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   168
        |top v list|
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   169
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   170
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   171
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   172
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   173
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   174
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   175
        list ignoreParentDirectory:true.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   176
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   177
                                                                        [exEnd]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   178
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   179
    ignore all directories (i.e. regular files only):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   180
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   181
        |top v list|
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   182
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   183
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   184
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   185
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   186
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   187
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   188
        list ignoreDirectories:true.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   189
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   190
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   191
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   192
    ignore all regular files (i.e. directories only):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   193
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   194
        |top v list|
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   195
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   196
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   197
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   198
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   199
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   200
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   201
        list ignoreFiles:true.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   202
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   203
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   204
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   205
    dont show the directory arrow-mark:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   206
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   207
        |top v list|
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   208
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   209
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   210
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   211
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   212
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   213
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   214
        list markDirectories:false.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   215
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   216
                                                                        [exEnd]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   217
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   218
    adds a pattern, only showing .st files and directories:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   219
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   220
        |top v list|
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   221
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   222
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   223
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   224
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   225
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   226
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   227
        list pattern:'*.st'.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   228
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   229
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   230
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   231
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   232
    a more complicated pattern:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   233
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   234
        |top v list|
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   235
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   236
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   237
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   238
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   239
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   240
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   241
        list pattern:'[A-D]*.st'.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   242
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   243
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   244
                                                                        [exEnd]
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   245
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   246
    adds a matchblock to show only writable files:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   247
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   248
        |top v list|
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   249
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   250
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   251
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   252
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   253
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   254
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   255
        list matchBlock:[:name | 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   256
                            |fileName|
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   257
                            fileName := name asFilename.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   258
                            fileName isWritable or:[fileName isDirectory]
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   259
                        ].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   260
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   261
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   262
                                                                        [exEnd]
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   263
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   264
    adds a matchblock to suppress directories:
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   265
    (this can be done easier with #ignoreDirectories)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   266
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   267
        |top v list|
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   268
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   269
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   270
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   271
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   272
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   273
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   274
        list matchBlock:[:name | 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   275
                            name asFilename isDirectory not
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   276
                        ].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   277
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   278
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   279
                                                                        [exEnd]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   280
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   281
    the above can be done more convenient:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   282
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   283
        |top v list|
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   284
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   285
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   286
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   287
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   288
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   289
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   290
        list ignoreDirectories:true.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   291
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   292
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   293
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   294
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   295
    adds a matchblock to block parent dirs (i.e. only allow files here & below):
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   296
    (can be done easier with #ignoreParentDirectory)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   297
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   298
        |top v list currentDir|
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   299
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   300
        currentDir := '.' asFilename pathName.
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   301
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   302
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   303
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   304
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   305
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   306
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   307
        list matchBlock:[:name | 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   308
                            ((name endsWith:'/..') and:[list directory pathName = currentDir]) not
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   309
                        ].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   310
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   311
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   312
                                                                        [exEnd]
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   313
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   314
    do not allow changing up AND show all .rc-files only:
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   315
    (but allow going down)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   316
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   317
        |top v list currentDir|
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   318
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   319
        currentDir := '.' asFilename pathName.
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   320
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   321
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   322
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   323
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   324
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   325
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   326
        list pattern:'*.rc'.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   327
        list matchBlock:[:name |  
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   328
                            ((name endsWith:'/..') and:[list directory pathName = currentDir]) not
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   329
                        ].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   330
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   331
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   332
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   333
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   334
    show only .rc-files in current directory:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   335
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   336
        |top v list currentDir|
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   337
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   338
        currentDir := '.' asFilename pathName.
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   339
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   340
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   341
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   342
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   343
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   344
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   345
        list pattern:'*.rc'.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   346
        list matchBlock:[:name | 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   347
                            name asFilename isDirectory not
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   348
                        ].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   349
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   350
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   351
                                                                        [exEnd]
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   352
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   353
    show only h*-files in /etc; dont allow directory changes:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   354
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   355
        |top v list|
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   356
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   357
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   358
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   359
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   360
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   361
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   362
        list directory:'/etc'.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   363
        list pattern:'h*'.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   364
        list matchBlock:[:name | name printNL.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   365
                            name asFilename isDirectory not
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   366
                        ].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   367
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   368
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   369
                                                                        [exEnd]
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   370
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   371
    only allow changing into directories below the current one; i.e. not up;
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   372
    but show it
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   373
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   374
        |top v list here|
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   375
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   376
        top := StandardSystemView new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   377
        top extent:(300 @ 200).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   378
        v := ScrollableView for:FileSelectionList in:top.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   379
        v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   380
        list := v scrolledView.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   381
        list directoryChangeCheckBlock:[:dirPath |
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   382
                        dirPath asFilename pathName
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   383
                            startsWith:Filename currentDirectory pathName].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   384
        list action:[:index | Transcript showCR:'you selected: ' , list selectionValue].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   385
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   386
                                                                        [exEnd]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   387
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   388
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   389
    living in a box:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   390
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   391
        |box listView|
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   392
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   393
        box := Dialog new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   394
        box addTextLabel:'which file ?'.
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   395
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   396
        listView := box 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   397
                        addListBoxOn:nil 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   398
                        class:FileSelectionList
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   399
                        withNumberOfLines:10 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   400
                        hScrollable:false 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   401
                        vScrollable:true.
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   402
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   403
        box addAbortButton; addOkButton.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   404
        box stickAtBottomWithVariableHeight:listView.
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   405
        box open.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   406
        box accepted ifTrue:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   407
            Transcript showCR:listView selectedPathname
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   408
        ]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   409
                                                                        [exEnd]
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   410
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   411
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   412
    living in a box (local files only, no directory change allowed):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   413
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   414
        |box listView|
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   415
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   416
        box := Dialog new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   417
        box addTextLabel:'which file ?'.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   418
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   419
        listView := box 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   420
                        addListBoxOn:nil 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   421
                        class:FileSelectionList
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   422
                        withNumberOfLines:10 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   423
                        hScrollable:false 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   424
                        vScrollable:true.
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   425
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   426
        listView ignoreDirectories:true.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   427
        listView ignoreParentDirectory:true.
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   428
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   429
        box addAbortButton; addOkButton.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   430
        box stickAtBottomWithVariableHeight:listView.
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   431
        box open.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   432
        box accepted ifTrue:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   433
            Transcript showCR:listView selectedPathname
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   434
        ]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   435
                                                                        [exEnd]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   436
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   437
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   438
    living in a box (local files only; immediately show owner in another field):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   439
                                                                        [exBegin]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   440
        |box listView lbl|
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   441
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   442
        box := Dialog new.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   443
        box addTextLabel:'which file ?'.
59
450ce95a72a4 *** empty log message ***
claus
parents: 57
diff changeset
   444
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   445
        listView := box 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   446
                        addListBoxOn:nil 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   447
                        class:FileSelectionList
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   448
                        withNumberOfLines:10 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   449
                        hScrollable:false 
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   450
                        vScrollable:true.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   451
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   452
        lbl := box addTextLabel:''.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   453
        lbl adjust:#left.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   454
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   455
        listView fileSelectAction:[:index |
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   456
            |ownerId owner|
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   457
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   458
            ownerId := listView selectedPathname asFilename info at:#uid.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   459
            ownerId == OperatingSystem getUserID ifTrue:[
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   460
                lbl label:('one of yours').
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   461
            ] ifFalse:[
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   462
                owner := OperatingSystem getUserNameFromID:ownerId.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   463
                lbl label:(owner , '''s property').
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   464
            ]
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   465
        ].
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   466
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   467
        listView directorySelectAction:[:index |
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   468
            |ownerId owner|
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   469
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   470
            ownerId := listView selectedPathname asFilename info at:#uid.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   471
            ownerId == OperatingSystem getUserID ifTrue:[
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   472
                lbl label:('your files there').
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   473
            ] ifFalse:[
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   474
                owner := OperatingSystem getUserNameFromID:ownerId.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   475
                lbl label:(owner , '''s files there').
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   476
            ]    
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   477
        ].
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   478
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   479
        box addAbortButton; addOkButton.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   480
        box stickAtBottomWithFixHeight:lbl.
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   481
        box stickAtBottomWithVariableHeight:listView.
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   482
        box open.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   483
        box accepted ifTrue:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   484
            Transcript showCR:listView selectedPathname
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   485
        ]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   486
                                                                        [exEnd]
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
   487
"
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   488
! !
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   489
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   490
!FileSelectionList methodsFor:'accessing-behavior'!
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   491
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   492
action:aBlock
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   493
    "set the action to be performed on a selection"
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   494
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   495
    realAction := aBlock
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   496
!
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   497
472
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   498
directoryChangeAction:aBlock
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   499
    "set the action to be performed on a directory change"
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   500
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   501
    directoryChangeAction := aBlock
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   502
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   503
    "Created: 5.3.1996 / 02:37:08 / cg"
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   504
!
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   505
338
ca
parents: 330
diff changeset
   506
directoryChangeCheckBlock:aBlock
ca
parents: 330
diff changeset
   507
    "set the directoryChangeCheckBlock - if non-nil, it controls if
ca
parents: 330
diff changeset
   508
     a directory change is legal."
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   509
338
ca
parents: 330
diff changeset
   510
    directoryChangeCheckBlock := aBlock
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   511
!
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   512
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   513
directorySelectAction:aBlock
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   514
    "set the action to be performed when a directory is selected.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   515
     Useful if someone else wants to show additional information
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   516
     (readable/owner ...) somewhere."
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   517
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   518
    directorySelectAction := aBlock
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   519
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   520
    "Created: 18.4.1996 / 18:45:13 / cg"
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   521
!
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   522
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   523
fileSelectAction:aBlock
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   524
    "set the action to be performed when a file is selected.
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   525
     Useful if someone else wants to show additional information
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   526
     (readable/owner ...) somewhere."
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   527
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   528
    fileSelectAction := aBlock
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   529
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   530
    "Created: 18.4.1996 / 18:45:24 / cg"
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   531
!
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   532
2377
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   533
ignoreCaseInPattern:aBoolean
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   534
    "set/clear the flag which controls if the pattern match is caseless.
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   535
     if it changes, update the list.
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   536
     The default is true for systems, where filenames are caseless (i.e. msdos-based)."
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   537
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   538
    ignoreCaseInPattern ~= aBoolean ifTrue:[
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   539
        ignoreCaseInPattern := aBoolean.
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   540
        realized ifTrue:[
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   541
            self updateList
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   542
        ].
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   543
    ].
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   544
!
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   545
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   546
ignoreDirectories:aBoolean
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   547
    "set/clear the flag which controls if directories are ignored
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   548
     (i.e. hidden). The default is false (i.e. dirs are shown)"
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   549
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   550
    ignoreDirectories := aBoolean
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   551
!
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   552
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   553
ignoreFiles:aBoolean
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   554
    "set/clear the flag which controls if plain files are ignored
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   555
     (i.e. hidden). The default is false (i.e. they are shown)"
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   556
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   557
    ignoreFiles := aBoolean
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   558
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   559
    "Created: 18.4.1996 / 18:48:43 / cg"
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   560
    "Modified: 18.4.1996 / 18:49:23 / cg"
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   561
!
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   562
338
ca
parents: 330
diff changeset
   563
ignoreParentDirectory:aBoolean
ca
parents: 330
diff changeset
   564
    "set/clear the flag which controls if the parent directory (..)
ca
parents: 330
diff changeset
   565
     is shown in the list. The default is false (i.e. show it)"
ca
parents: 330
diff changeset
   566
ca
parents: 330
diff changeset
   567
    ignoreParentDirectory := aBoolean
ca
parents: 330
diff changeset
   568
!
ca
parents: 330
diff changeset
   569
282
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   570
markDirectories:aBoolean
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   571
    "turn on/off marking of directories with an arrow.
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   572
     The default is on"
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   573
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   574
     markDirectories := aBoolean
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   575
!
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   576
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   577
matchBlock:aBlock
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   578
    "set the matchBlock - if non-nil, it controls which
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   579
     names are shown in the list."
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   580
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   581
    matchBlock := aBlock
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   582
!
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   583
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   584
pattern:aPattern
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   585
    "set the pattern - if it changes, update the list."
21
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
   586
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   587
    pattern ~= aPattern ifTrue:[
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   588
	pattern := aPattern.
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   589
	realized ifTrue:[
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   590
	    self updateList
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   591
	].
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   592
    ].
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   593
!
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   594
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   595
quickDirectoryChange:aBoolean
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   596
    "set/clear quick change (i.e. chdir with single click).
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   597
     The default is false (i.e. double click is required)"
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   598
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   599
    quickDirectoryChange := aBoolean
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   600
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   601
    "Created: 4.3.1996 / 17:37:58 / cg"
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   602
!
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   603
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   604
stayInDirectory:aBoolean
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   605
    "set/clear the flag which controls if selecting a directory
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   606
     should locally change (if false) or be handled just like
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   607
     the selection of a file (if true).
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   608
     The default is false (i.e. change and do not tell via action)"
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   609
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   610
    stayInDirectory := aBoolean
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   611
! !
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   612
1331
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   613
!FileSelectionList methodsFor:'accessing-channels'!
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   614
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   615
directoryHolder:aValueHolder
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   616
    directoryHolder := aValueHolder.
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   617
    directoryHolder onChangeSend:#directoryHolderChange to:self.
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   618
    self directoryHolderChange
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   619
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   620
    "Modified: 20.9.1997 / 13:16:58 / cg"
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   621
! !
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   622
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   623
!FileSelectionList methodsFor:'accessing-contents'!
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   624
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   625
directory
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   626
    "return the shown directory"
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   627
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   628
    ^ directory
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   629
!
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   630
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   631
directory:nameOrDirectory
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   632
    "set the lists contents to the filenames in the directory.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   633
     This does not validate the change with any directoryChangeBlock."
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   634
1445
2c717104c3fb dont allow setting wrong directories
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   635
    |oldPath f|
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   636
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   637
    nameOrDirectory isNil ifTrue:[
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   638
        directory := nil.
1331
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   639
        directoryHolder notNil ifTrue:[directoryHolder value:directory].
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   640
        ^ self updateList
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   641
    ].
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   642
    directory notNil ifTrue:[
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   643
        oldPath := directory pathName.
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   644
    ].
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   645
    directory := nameOrDirectory asFilename.
1445
2c717104c3fb dont allow setting wrong directories
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   646
    (directory exists 
2c717104c3fb dont allow setting wrong directories
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   647
    and:[directory isDirectory]) ifFalse:[
2c717104c3fb dont allow setting wrong directories
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   648
        directory := Filename currentDirectory
2c717104c3fb dont allow setting wrong directories
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   649
    ].
1331
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   650
    directoryHolder notNil ifTrue:[directoryHolder value:directory].
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   651
    realized ifTrue:[
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   652
        (directory pathName = oldPath) ifFalse:[
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   653
            self updateList
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   654
        ]
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   655
    ]
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   656
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   657
    "Modified: 18.9.1997 / 23:42:27 / stefan"
1331
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   658
    "Modified: 20.9.1997 / 13:29:02 / cg"
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   659
!
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   660
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   661
selectedPathname
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   662
    "if there is a selection, return its full pathname.
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   663
     Of there is no selection, return nil."
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   664
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   665
    |sel|
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   666
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   667
    sel := self selectionValue.
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   668
    sel isNil ifTrue:[^ nil].
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   669
    ^ directory constructString:sel.
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   670
1318
f9091a617af2 filename stuff
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   671
    "Modified: 7.9.1997 / 23:49:01 / cg"
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   672
    "Modified: 18.9.1997 / 23:49:16 / stefan"
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   673
! !
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   674
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   675
!FileSelectionList methodsFor:'drawing'!
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   676
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   677
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   678
    "redefined to look for directory in every line"
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   679
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   680
    |l|
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   681
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   682
    "first, draw chunk of lines"
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   683
    super redrawFromVisibleLine:startVisLineNr to:endVisLineNr.
282
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   684
    markDirectories ifFalse:[^ self].
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   685
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   686
    "then draw marks"
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   687
    startVisLineNr to:endVisLineNr do:[:visLineNr |
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   688
        l := self visibleLineToListLine:visLineNr.
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   689
        l notNil ifTrue:[
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   690
            (directoryFileTypes at:l) ifTrue:[
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   691
                self drawRightArrowInVisibleLine:visLineNr
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   692
            ]
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   693
        ]
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   694
    ]
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   695
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   696
    "Modified: / 22.9.1998 / 12:32:24 / cg"
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   697
!
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   698
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   699
redrawVisibleLine:visLineNr
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   700
    "if the line is one for a directory, draw a right arrow"
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   701
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   702
    |l|
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   703
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   704
    super redrawVisibleLine:visLineNr.
282
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   705
    markDirectories ifFalse:[^ self].
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   706
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   707
    l := self visibleLineToListLine:visLineNr.
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   708
    l notNil ifTrue:[
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   709
        (directoryFileTypes at:l) ifTrue:[
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   710
            self drawRightArrowInVisibleLine:visLineNr
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   711
        ]
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   712
    ]
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   713
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   714
    "Modified: / 22.9.1998 / 12:32:34 / cg"
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   715
! !
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   716
329
dc3de413de73 redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   717
!FileSelectionList methodsFor:'events'!
dc3de413de73 redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   718
1331
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   719
directoryHolderChange
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   720
    self directory:directoryHolder value.
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   721
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   722
    "Created: 20.9.1997 / 13:12:45 / cg"
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   723
!
5661f0647ca0 added a valueHolder for the directory.
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   724
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   725
doubleClicked
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   726
    self selectionIsDirectory ifTrue:[
2817
7c82a9535b96 not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 2634
diff changeset
   727
        stayInDirectory ifFalse:[
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   728
            quickDirectoryChange ifFalse:[
472
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   729
                directoryChangeAction notNil ifTrue:[
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   730
                    directoryChangeAction value:self selection
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   731
                ] ifFalse:[
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   732
                    self changeDirectory
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   733
                ]
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   734
            ]
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   735
        ].
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   736
        ^ self
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   737
    ].
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   738
    super doubleClicked
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   739
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   740
    "Created: 4.3.1996 / 17:39:58 / cg"
472
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   741
    "Modified: 5.3.1996 / 02:38:06 / cg"
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   742
!
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   743
2226
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   744
keyPress:key x:x y:y
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   745
    key == #CursorLeft ifTrue:[
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   746
        self changeToParentDirectory.
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   747
        ^ self
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   748
    ].
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   749
    (key == #CursorRight) ifTrue:[
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   750
        self changeToPreviousDirectory.
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   751
        ^ self
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   752
    ].
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   753
    super keyPress:key x:x y:y
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   754
!
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   755
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   756
selectionChanged
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   757
    "if the selection changed, check for it being a directory
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   758
     and possibly go there. If its not a directory, perform the realAction."
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   759
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   760
    self selection isCollection ifFalse:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   761
        self selectionIsDirectory ifTrue:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   762
            (stayInDirectory not and:[quickDirectoryChange]) ifTrue:[
472
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   763
                directoryChangeAction notNil ifTrue:[
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   764
                    directoryChangeAction value:self selection
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   765
                ] ifFalse:[
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   766
                    self changeDirectory
17f795e6ecba added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
   767
                ]
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   768
            ] ifFalse:[
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   769
                directorySelectAction notNil ifTrue:[
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   770
                    directorySelectAction value:self selection
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   771
                ]
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   772
            ]
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   773
        ] ifFalse:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   774
            realAction notNil ifTrue:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   775
                realAction value:self selection
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   776
            ].
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   777
            fileSelectAction notNil ifTrue:[
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   778
                fileSelectAction value:self selection
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   779
            ]
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   780
        ]
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   781
    ]
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   782
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   783
    "Modified: 18.4.1996 / 18:44:30 / cg"
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   784
!
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   785
329
dc3de413de73 redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   786
sizeChanged:how
dc3de413de73 redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   787
    "redraw marks if any"
dc3de413de73 redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   788
dc3de413de73 redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   789
    super sizeChanged:how.
338
ca
parents: 330
diff changeset
   790
    (shown and:[markDirectories]) ifTrue:[
720
2fb021555f9d use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   791
        self invalidate
330
56fcae58bcb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   792
    ]
720
2fb021555f9d use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   793
2fb021555f9d use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   794
    "Modified: 29.5.1996 / 16:15:12 / cg"
329
dc3de413de73 redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   795
! !
dc3de413de73 redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   796
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   797
!FileSelectionList methodsFor:'initialization'!
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   798
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   799
initialize
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   800
    directory := Filename currentDirectory.
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   801
    stayInDirectory := ignoreParentDirectory := ignoreDirectories := false.
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   802
    ignoreFiles := quickDirectoryChange := false.
282
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
   803
    markDirectories := true.
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   804
    super initialize.
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   805
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   806
    pattern := '*'.
2377
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
   807
    ignoreCaseInPattern := Filename isCaseSensitive not.
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   808
    self initializeAction.
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   809
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   810
    "nontypical use ..."
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   811
    "
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   812
     FileSelectionList new open
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   813
     (FileSelectionList new directory:'/etc') open
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   814
     (ScrollableView for:FileSelectionList) open
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   815
     (HVScrollableView for:FileSelectionList) open
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   816
    "
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   817
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   818
    "Modified: 18.4.1996 / 18:49:19 / cg"
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   819
    "Modified: 18.9.1997 / 18:52:03 / stefan"
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   820
!
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   821
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   822
initializeAction
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   823
    "setup action as: selections in list get forwarded to enterfield if not 
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   824
     a directory; otherwise directory is changed"
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   825
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   826
    actionBlock := [:lineNr | self selectionChanged].
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   827
"/    doubleClickActionBlock := [:lineNr | self selectionChanged].
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   828
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   829
    "Modified: 4.3.1996 / 17:39:08 / cg"
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   830
!
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   831
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   832
reinitialize
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   833
    directory := Filename currentDirectory.
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   834
    super reinitialize
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   835
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   836
    "Modified: 18.9.1997 / 18:52:16 / stefan"
21
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
   837
! !
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
   838
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
   839
!FileSelectionList methodsFor:'private'!
c47dbae39a71 Initial revision
claus
parents:
diff changeset
   840
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   841
changeDirectory
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   842
    "change directory to the selected one"
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   843
2226
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   844
    |entry|
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   845
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   846
    entry := self selectionValue.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   847
    (entry isNil or:[entry isEmpty]) ifTrue:[ ^ false].
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   848
2226
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   849
    (self changeDirectoryTo:entry) ifFalse:[^ false].
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   850
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   851
    directoryStack := nil.
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   852
!
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   853
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   854
changeDirectoryTo:newDirectory
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   855
    "change directory; check if allowed; return true if change was ok"
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   856
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   857
    |entry ok newDir warnMessage oldDir|
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   858
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   859
    entry := newDirectory.
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   860
    (entry endsWith:' ...') ifTrue:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   861
        entry := entry copyWithoutLast:4.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   862
    ].
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   863
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   864
    ok := false.
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   865
    oldDir := directory baseName.
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   866
    newDir := directory construct:entry.
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   867
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   868
    (directoryChangeCheckBlock isNil
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   869
    or:[directoryChangeCheckBlock value:newDir]) ifTrue:[
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   870
        newDir isReadable ifFalse:[
2634
278d196cbaa4 *** empty log message ***
ca
parents: 2377
diff changeset
   871
            warnMessage := 'No permission to read directory %1 !!'
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   872
        ] ifTrue:[
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
   873
            newDir isExecutable ifFalse:[
2634
278d196cbaa4 *** empty log message ***
ca
parents: 2377
diff changeset
   874
                warnMessage := 'No permission to enter directory %1 !!'
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   875
            ] ifTrue:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   876
                ok := true.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   877
            ]
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   878
        ].
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   879
    ].
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   880
    ok ifFalse:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   881
        warnMessage notNil ifTrue:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   882
            self warn:(resources string:warnMessage with:entry).
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   883
        ].
684
015c23130d7b selection: / setSelection:
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   884
        self setSelection:nil
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   885
    ] ifTrue:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   886
        self directory:newDir.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   887
        entry = '..' ifTrue:[
690
d579f684aa7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   888
            self setSelectElement:oldDir 
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   889
        ].
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   890
    ].
2226
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   891
    ^ ok
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   892
!
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   893
2226
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   894
changeToParentDirectory
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   895
    "change to the parent directory"
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   896
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   897
    |current parent|
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   898
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   899
    current := self directory asFilename.
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   900
    parent := current directory.
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   901
    parent = current ifTrue:[^ false].
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   902
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   903
    (self changeDirectoryTo:'..') ifFalse:[^ false].
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   904
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   905
    directoryStack isNil ifTrue:[
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   906
        directoryStack := OrderedCollection new.
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   907
    ].
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   908
    directoryStack addFirst:current pathName
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   909
!
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   910
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   911
changeToPreviousDirectory
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   912
    "change to the previous directory"
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   913
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   914
    |current previous|
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   915
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   916
    directoryStack size == 0 ifTrue:[^ false].
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   917
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   918
    previous := directoryStack removeFirst.
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   919
bf23595862d9 cursorLeft & cursorRight handling like in fileBrowser
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
   920
    (self changeDirectoryTo:(previous asFilename baseName)) ifFalse:[^ false].
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   921
!
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   922
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   923
selectionIsDirectory
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   924
    "return true, if the current selection is a directory"
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   925
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   926
    |entry|
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   927
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   928
    entry := self selectionValue.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   929
    (entry isNil or:[entry isEmpty]) ifTrue:[ ^ false].
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   930
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   931
    (entry endsWith:' ...') ifTrue:[
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   932
        entry := entry copyWithoutLast:4.
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   933
    ].
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   934
    ^ (directory construct:entry) isDirectory
467
ecf956d44135 now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   935
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   936
    "Created: / 4.3.1996 / 17:43:26 / cg"
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   937
    "Modified: / 18.9.1997 / 23:37:05 / stefan"
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   938
    "Modified: / 22.9.1998 / 12:30:21 / cg"
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   939
!
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   940
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   941
updateList
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   942
    "set the lists contents to the filenames in the directory"
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   943
2833
1544bb56f6bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
   944
    |newList newTypes obsolete 
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   945
     matching dir ignoreCase|
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   946
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   947
    directory isNil ifTrue:[
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   948
        self list:nil.
350
e3512322cb87 allow multiple patterns sep'd by semi
ca
parents: 338
diff changeset
   949
        ^ self
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   950
    ].
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   951
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   952
    self withCursor:(Cursor read) do:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   953
        "
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   954
         if the directory-id changed, MUST update.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   955
         (can happen after a restart, when a file is no longer
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   956
          there, has moved or is NFS-mounted differently)
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   957
        "
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   958
        obsolete := directoryId ~~ directory id
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   959
                    or:[directoryName ~= directory pathName
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   960
                    or:[timeStamp notNil
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   961
                        and:[directory modificationTime > timeStamp]]].
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   962
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   963
        obsolete ifTrue:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   964
            timeStamp := directory modificationTime.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   965
            directoryId := directory id.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   966
            directoryName := directory pathName.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   967
            directoryContents := (directory fullDirectoryContents ? #()) sort.
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   968
        ].
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   969
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   970
        newList := OrderedCollection new.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   971
        newTypes := OrderedCollection new.
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   972
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   973
        ignoreCase := ignoreCaseInPattern ? (Filename isCaseSensitive not).
2093
ac231f0404d9 care for case-insensitive systems in pattern-match (windows)
Claus Gittinger <cg@exept.de>
parents: 1924
diff changeset
   974
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   975
        dir := directory pathName asFilename.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   976
        directoryContents do:[:name |
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   977
            |type fn fullName isDirectory ignore|
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   978
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   979
            fn := dir construct:name.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   980
            fullName := dir constructString:name.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   981
            isDirectory := fn isDirectory.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   982
            ignore := true.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   983
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   984
            (matchBlock isNil or:[matchBlock value:fullName]) ifTrue:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   985
                isDirectory ifTrue:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   986
                    ignoreDirectories ifFalse:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   987
                        name = '..' ifTrue:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   988
                            ignoreParentDirectory ifFalse:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   989
                                ignore := false.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   990
                            ]
350
e3512322cb87 allow multiple patterns sep'd by semi
ca
parents: 338
diff changeset
   991
                        ] ifFalse:[
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   992
                            name = '.' ifTrue:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   993
                                "ignore"
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   994
                            ] ifFalse:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   995
                                ignore := false.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   996
                            ]
350
e3512322cb87 allow multiple patterns sep'd by semi
ca
parents: 338
diff changeset
   997
                        ]
e3512322cb87 allow multiple patterns sep'd by semi
ca
parents: 338
diff changeset
   998
                    ]
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   999
                ] ifFalse:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1000
                    ignoreFiles ifFalse:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1001
                        matching := true.
350
e3512322cb87 allow multiple patterns sep'd by semi
ca
parents: 338
diff changeset
  1002
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1003
                        (pattern size > 0) ifTrue:[ 
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1004
                            pattern ~= '*' ifTrue:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1005
                                matching := pattern compoundMatch:name ignoreCase:ignoreCase
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1006
                            ]
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1007
                        ].
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1008
                                        
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1009
                        matching ifTrue:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1010
                            ignore := false.
350
e3512322cb87 allow multiple patterns sep'd by semi
ca
parents: 338
diff changeset
  1011
                        ]
e3512322cb87 allow multiple patterns sep'd by semi
ca
parents: 338
diff changeset
  1012
                    ]
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1013
                ].
350
e3512322cb87 allow multiple patterns sep'd by semi
ca
parents: 338
diff changeset
  1014
            ].
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1015
            ignore ifFalse:[
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1016
                newList add:name.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1017
                newTypes add:isDirectory.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1018
            ].
350
e3512322cb87 allow multiple patterns sep'd by semi
ca
parents: 338
diff changeset
  1019
        ].
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1020
        directoryFileTypes := newTypes.
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1021
        self list:newList.
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
  1022
    ].
547
6c9aaf7a84e7 commentary; examples, added ignoreFiles / fileSelectAction & directorySelectAction
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  1023
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
  1024
    "Modified: / 18.9.1997 / 23:43:52 / stefan"
2093
ac231f0404d9 care for case-insensitive systems in pattern-match (windows)
Claus Gittinger <cg@exept.de>
parents: 1924
diff changeset
  1025
    "Modified: / 16.12.1999 / 01:23:41 / cg"
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
  1026
!
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
  1027
2377
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1028
updateListWithoutScrolling
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1029
    "set the lists contents to the filenames in the directory"
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1030
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1031
    |sav|
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1032
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1033
    sav := scrollWhenUpdating.
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1034
    scrollWhenUpdating := nil.
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1035
    self updateList.
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1036
    scrollWhenUpdating := sav
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1037
!
977c3d87e61f added optional ignoreCase in matchPattern.
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  1038
21
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
  1039
visibleLineNeedsSpecialCare:visLineNr
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
  1040
    |l|
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
  1041
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
  1042
    l := self visibleLineToListLine:visLineNr.
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
  1043
    l notNil ifTrue:[
2832
23ad57a4ad76 index bug fixed
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
  1044
        (directoryFileTypes at:l) ifTrue:[^ true].
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
  1045
        ^ super visibleLineNeedsSpecialCare:visLineNr
21
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
  1046
    ].
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
  1047
    ^ false
1687
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
  1048
bf72059725a1 fixes & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
  1049
    "Modified: / 22.9.1998 / 12:32:48 / cg"
21
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
  1050
!
9ef599238fea *** empty log message ***
claus
parents: 11
diff changeset
  1051
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1052
widthForScrollBetween:firstLine and:lastLine
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1053
    "return the width in pixels for a scroll between firstLine and lastLine
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1054
     - return full width here since there might be directory marks"
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1055
193
6ccc226ce3a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1056
    ^ (width - margin - margin)
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1057
! !
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1058
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1059
!FileSelectionList methodsFor:'realization'!
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1060
1276
75aa3838f308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
  1061
realize
1272
c22a8fbe90ed #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  1062
    "check if directory is still valid (using timestamp and inode numbers)
c22a8fbe90ed #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  1063
     - reread if not"
c22a8fbe90ed #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  1064
1276
75aa3838f308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
  1065
    super realize.
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1066
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1067
    (timeStamp isNil 
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
  1068
     or:[(directory modificationTime > timeStamp) 
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1069
     or:[(directoryId isNil)
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1070
     or:[directoryId ~~ directory id]]]) ifTrue:[
1272
c22a8fbe90ed #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  1071
        directoryId := nil.
c22a8fbe90ed #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  1072
        self updateList
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1073
    ].
1272
c22a8fbe90ed #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  1074
1276
75aa3838f308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
  1075
    "Created: 24.7.1997 / 18:24:36 / cg"
1330
21a3d397233e Use Filename instead of obsolete FileDirectory.
Stefan Vogel <sv@exept.de>
parents: 1318
diff changeset
  1076
    "Modified: 18.9.1997 / 23:36:10 / stefan"
11
c47dbae39a71 Initial revision
claus
parents:
diff changeset
  1077
! !
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
  1078
1272
c22a8fbe90ed #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  1079
!FileSelectionList class methodsFor:'documentation'!
282
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
  1080
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
  1081
version
2833
1544bb56f6bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  1082
    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.52 2004-01-07 15:43:33 cg Exp $'
282
8e0e072c1981 allow suppress of arrow-drawing directories
ca
parents: 193
diff changeset
  1083
! !