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