FileBrowser.st
author Claus Gittinger <cg@exept.de>
Sat, 19 Apr 1997 15:23:34 +0200
changeset 1156 f3df28086973
parent 1154 c02ebe91ba11
child 1157 667a57034e40
permissions -rw-r--r--
dont do a full update when removing files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     1
"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
     3
              All Rights Reserved
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     4
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    10
 hereby transferred.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    11
"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    12
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    13
StandardSystemView subclass:#FileBrowser
1010
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
    14
	instanceVariableNames:'labelView filterField fileListView subView currentDirectory
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
    15
		fileList checkBlock checkDelta timeOfLastCheck showLongList
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
    16
		showDotFiles myName killButton compressTabs lockUpdate
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
    17
		previousDirectory currentFileName timeOfFileRead tabSpec
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
    18
		commandView commandIndex fileEncoding tabRulerView scrollView
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
    19
		icons listUpdateProcess'
1010
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
    20
	classVariableNames:'DirectoryHistory DirectoryHistoryWhere HistorySize DefaultIcon
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
    21
		CommandHistory CommandHistorySize Icons DefaultCommandPerSuffix'
1010
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
    22
	poolDictionaries:''
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
    23
	category:'Interface-Browsers'
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    24
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    25
763
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
    26
!FileBrowser class methodsFor:'documentation'!
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    27
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    28
copyright
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    29
"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    30
 COPYRIGHT (c) 1991 by Claus Gittinger
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
    31
              All Rights Reserved
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    32
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    33
 This software is furnished under a license and may be used
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    34
 only in accordance with the terms of that license and with the
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    36
 be provided or otherwise made available to, or used by, any
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    37
 other person.  No title to or ownership of the software is
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    38
 hereby transferred.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    39
"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    40
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    41
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    42
documentation
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    43
"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    44
    this used to be a very simple demo application,
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    45
    but migrated into a quite nice tool, includes all kinds of 
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    46
    warning and information boxes, background processes for directory-
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    47
    reading and internationalized strings. A good example for beginners,
100
claus
parents: 98
diff changeset
    48
    on how to do things .... (and maybe how not to do things ;-, since some
claus
parents: 98
diff changeset
    49
    stuff is historic and was implemented at times when better mechanisms
claus
parents: 98
diff changeset
    50
    were not available)
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    51
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    52
    See additional information in 'doc/misc/fbrowser.doc'.
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
    53
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    54
    WARNING: files edited with FileBrowser will have leading spaces (multiple-8)
508
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    55
             being replaced by tabs. If tabs are to be preserved at other
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    56
             positions (for example, sendmail-config files) they will be
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    57
             corrupt after being written.
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    58
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    59
    [instance variables]:
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    60
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    61
        checkDelta      <Integer>       number of seconds of check interval
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    62
                                        (looks ever so often if shown directory
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    63
                                         has changed). You may make this number
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    64
                                        higher, if your network-times are
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    65
                                        incorrect and thus, the filebrowser
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    66
                                        checks too often.
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    67
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    68
        compressTabs    <Boolean>       if true, leading spaces will be
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    69
                                        replaced by tabs when saving text
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    70
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    71
    some of the defaults (long/short list etc.) can be set by the resource file;
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    72
    see FileBrowser>>initialize for more details..
508
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    73
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    74
    [author:]
8d2ab732fca5 documentation
Claus Gittinger <cg@exept.de>
parents: 495
diff changeset
    75
        Claus Gittinger
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    76
"
203
de8d39d459fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 172
diff changeset
    77
! !
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    78
763
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
    79
!FileBrowser class methodsFor:'instance creation'!
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    80
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    81
openOn:aDirectoryPath
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    82
    "start a new FileBrowser in a pathname"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    83
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    84
    ^ (self new currentDirectory:aDirectoryPath) open
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    85
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    86
    "
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    87
     FileBrowser openOn:'aDirectoryPath'
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    88
     FileBrowser openOn:'/etc'
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    89
     FileBrowser openOn:'..'
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    90
     FileBrowser openOn:'.'
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    91
    "
93
claus
parents: 85
diff changeset
    92
!
claus
parents: 85
diff changeset
    93
claus
parents: 85
diff changeset
    94
openOnFileNamed:aFilename
claus
parents: 85
diff changeset
    95
    "start a new FileBrowser on a file"
claus
parents: 85
diff changeset
    96
claus
parents: 85
diff changeset
    97
    |f browser|
claus
parents: 85
diff changeset
    98
claus
parents: 85
diff changeset
    99
    f := aFilename asFilename.
1124
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   100
    f isDirectory ifTrue:[
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   101
        ^ self openOn:aFilename
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   102
    ].
93
claus
parents: 85
diff changeset
   103
    browser := self new.
claus
parents: 85
diff changeset
   104
    browser currentDirectory:f directoryName.
claus
parents: 85
diff changeset
   105
    browser showFile:f baseName.
claus
parents: 85
diff changeset
   106
    ^ browser open
claus
parents: 85
diff changeset
   107
claus
parents: 85
diff changeset
   108
    "
claus
parents: 85
diff changeset
   109
     FileBrowser openOnFileNamed:'Makefile'
claus
parents: 85
diff changeset
   110
     FileBrowser openOnFileNamed:'../Makefile'
claus
parents: 85
diff changeset
   111
     FileBrowser openOnFileNamed:'/tmp/foo'
claus
parents: 85
diff changeset
   112
    "
1124
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   113
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   114
    "Modified: 6.4.1997 / 14:57:12 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   115
! !
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   116
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   117
!FileBrowser class methodsFor:'class initialization'!
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   118
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   119
initialize
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   120
    Icons := IdentityDictionary new.
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   121
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   122
    #(
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   123
        #directory      'tiny_yellow_dir.xpm'
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   124
        #directoryLink  'tiny_yellow_dir_link.xpm'
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   125
        #file           'tiny_file_plain.xpm'
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   126
        #fileLink       'tiny_file_link.xpm'
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   127
        #imageFile      'tiny_file_pix.xpm'
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   128
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   129
     ) pairWiseDo:[:key :nm |
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   130
        
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   131
        Icons at:key put:(Image fromFile:'bitmaps/xpmBitmaps/document_images/' , nm).
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   132
    ]
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   133
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   134
    "
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   135
     self initialize
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   136
    "
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   137
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   138
    "Modified: 18.4.1997 / 15:09:53 / cg"
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   139
! !
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   140
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   141
!FileBrowser class methodsFor:'command history'!
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   142
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   143
addToCommandHistory:aCommandString for:aFilename
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   144
    |cmd suffix|
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   145
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   146
    (aCommandString notNil and:[aCommandString notEmpty]) ifTrue:[
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   147
        CommandHistory notNil ifTrue:[
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   148
            CommandHistory addFirst:aCommandString.
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   149
            CommandHistory size > CommandHistorySize ifTrue:[
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   150
                CommandHistory removeLast
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   151
            ]
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   152
        ].
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   153
        aFilename notNil ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   154
            cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   155
            DefaultCommandPerSuffix isNil ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   156
                DefaultCommandPerSuffix := Dictionary new.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   157
            ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   158
            suffix := aFilename asFilename suffix.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   159
            suffix notNil ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   160
                DefaultCommandPerSuffix at:suffix put:cmd.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   161
            ]
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   162
        ]
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   163
    ]
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   164
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   165
    "Created: 14.11.1996 / 14:58:13 / cg"
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   166
! !
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   167
763
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
   168
!FileBrowser class methodsFor:'defaults'!
73
e332d9c71624 *** empty log message ***
claus
parents: 67
diff changeset
   169
e332d9c71624 *** empty log message ***
claus
parents: 67
diff changeset
   170
defaultIcon
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   171
    "return the file browsers default window icon"
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   172
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   173
    <resource: #style (#ICON #ICON_FILE)>
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   174
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   175
    |nm i|
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   176
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   177
    (i := DefaultIcon) isNil ifTrue:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   178
        i := self classResources at:'ICON' default:nil.
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   179
        i isNil ifTrue:[
1084
bf64c6b08604 icon from resources
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
   180
            nm := ClassResources at:'ICON_FILE' default:'FBrowser.xbm'.
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   181
            i := Image fromFile:nm resolution:100.
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   182
            i isNil ifTrue:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   183
                i := Image fromFile:('bitmaps/' , nm) resolution:100.
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   184
                i isNil ifTrue:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   185
                    i := StandardSystemView defaultIcon
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   186
                ]
1084
bf64c6b08604 icon from resources
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
   187
            ]
bf64c6b08604 icon from resources
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
   188
        ].
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   189
        i notNil ifTrue:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   190
            DefaultIcon := i := i on:Display
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   191
        ]
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   192
    ].
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   193
    ^ i
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   194
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   195
    "Modified: 19.3.1997 / 20:48:34 / ca"
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   196
    "Modified: 18.4.1997 / 15:16:29 / cg"
73
e332d9c71624 *** empty log message ***
claus
parents: 67
diff changeset
   197
! !
e332d9c71624 *** empty log message ***
claus
parents: 67
diff changeset
   198
1119
032300b7f247 comments
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   199
!FileBrowser methodsFor:'drag & drop'!
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   200
1132
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   201
canDrop:aCollectionOfDropObjects
1119
032300b7f247 comments
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   202
    "I accept fileObjects only"
032300b7f247 comments
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   203
1132
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   204
    aCollectionOfDropObjects do:[:aDropObject |
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   205
        aDropObject isFileObject ifFalse:[
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   206
            aDropObject isTextObject ifFalse:[^ false].
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   207
        ]
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   208
    ].
1132
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   209
    ^ true
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   210
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   211
    "Modified: 11.4.1997 / 12:41:59 / cg"
1118
9fe7905c9768 drop support
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   212
!
9fe7905c9768 drop support
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   213
1132
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   214
drop:aCollectionOfDropObjects at:aPoint
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   215
    "handle drops"
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   216
1132
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   217
    aCollectionOfDropObjects do:[:aDropObject |
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   218
        self dropSingleObject:aDropObject at:aPoint
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   219
    ]
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   220
bd2eda432e1d drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   221
    "Modified: 11.4.1997 / 12:43:36 / cg"
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   222
!
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   223
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   224
dropSingleObject:someObject at:aPoint
1119
032300b7f247 comments
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   225
    "handle drops; if its a directory, change to it.
1124
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   226
     If its a file, change to its directory and select the file.
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   227
     If its text, paste it into the codeView."
1119
032300b7f247 comments
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   228
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   229
    |newDir newFile|
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   230
1124
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   231
    someObject isFileObject ifTrue:[
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   232
        someObject isDirectory ifTrue:[
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   233
            newDir := someObject theObject pathName.
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   234
        ] ifFalse:[
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   235
            newDir := someObject theObject directoryName.
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   236
            newFile := someObject theObject baseName.
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   237
        ].
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   238
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   239
        newDir notNil ifTrue:[
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   240
            newDir ~= currentDirectory pathName ifTrue:[
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   241
                self changeDirectoryTo:newDir.
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   242
            ]
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   243
        ].
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   244
        newFile notNil ifTrue:[
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   245
            newFile ~= currentFileName ifTrue:[
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   246
                fileListView selection:(fileList indexOf:newFile).
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   247
                self doFileGet:false.
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   248
            ]
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   249
        ].
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   250
        ^ self
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   251
    ].
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   252
1124
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   253
    someObject isTextObject ifTrue:[
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   254
        subView paste:someObject theObject.
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   255
        ^ self
1118
9fe7905c9768 drop support
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   256
    ].
1124
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   257
517149e3924d dropped text is pasted
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   258
    "Modified: 6.4.1997 / 14:46:44 / cg"
1119
032300b7f247 comments
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   259
! !
032300b7f247 comments
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   260
032300b7f247 comments
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   261
!FileBrowser methodsFor:'events'!
1118
9fe7905c9768 drop support
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   262
1010
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   263
handlesKeyPress:key inView:view
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   264
    "this method is reached via delegation: are we prepared to handle
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   265
     a keyPress in some other view ?"
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   266
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   267
    <resource: #keyboard (#GotoLine #InspectIt #CmdI #Cmdu #DoIt #Delete #BackSpace #Accept)>
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   268
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   269
    view == fileListView ifTrue:[
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   270
        (key == #Delete 
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   271
        or:[key == #BackSpace
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   272
        or:[key == #Accept
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   273
        or:[key == #CmdI
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   274
        or:[key == #Cmdu
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   275
        or:[key == #InspectIt
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   276
        or:[key == #GotoLine
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   277
        or:[key == #DoIt]]]]]]]) ifTrue:[^ true].
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   278
    ].
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   279
    ^ false
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   280
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   281
    "Created: 28.1.1997 / 14:03:20 / stefan"
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   282
    "Modified: 28.1.1997 / 15:03:30 / stefan"
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   283
!
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   284
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   285
keyPress:key x:x y:y view:view
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   286
    "this method is reached via delegation from the fileListView"
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   287
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   288
    <resource: #keyboard (#GotoLine #InspectIt #CmdI #Cmdu #DoIt #Delete #BackSpace #Accept)>
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   289
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   290
    (key == #Delete or:[key == #BackSpace]) ifTrue:[
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   291
        self fileRemove.
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   292
        ^ self
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   293
    ].
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   294
    (key == #Accept) ifTrue:[
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   295
        self fileFileIn.
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   296
        ^ self
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   297
    ].
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   298
    (key == #GotoLine) ifTrue:[
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   299
        self fileGet.
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   300
        ^ self
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   301
    ].
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   302
    (key == #DoIt) ifTrue:[
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   303
        self fileExecute.
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   304
        ^ self
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   305
    ].
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   306
    (key == #InspectIt) ifTrue:[
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   307
        self fileGetInfo.
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   308
        ^ self
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   309
    ].
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   310
    (key == #CmdI) ifTrue:[
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   311
        self fileGetLongInfo.
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   312
        ^ self
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   313
    ].
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   314
    (key == #Cmdu) ifTrue:[
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   315
        self updateCurrentDirectory.
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   316
        ^ self
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   317
    ].
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   318
    fileListView keyPress:key x:x y:y
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   319
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   320
    "Created: 28.1.1997 / 14:03:56 / stefan"
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   321
    "Modified: 28.1.1997 / 15:03:56 / stefan"
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   322
!
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   323
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   324
mapped 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   325
    super mapped.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   326
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   327
     whant to know about changed history
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   328
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   329
    self updateCurrentDirectory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   330
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   331
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   332
visibilityChange:how
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   333
    |wasVisible|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   334
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   335
    wasVisible := shown.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   336
    super visibilityChange:how.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   337
    (wasVisible not and:[shown]) ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   338
        "
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   339
         start checking again
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   340
        "
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   341
        Processor removeTimedBlock:checkBlock.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   342
        Processor addTimedBlock:checkBlock afterSeconds:checkDelta.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   343
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   344
! !
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   345
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   346
!FileBrowser methodsFor:'fileList user interaction'!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   347
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   348
changeDisplayMode
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   349
    "toggle from long to short listing (and vice-versa)"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   350
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   351
    showLongList := showLongList not.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   352
    self showOrHideTabView.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   353
    self updateCurrentDirectory
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
   354
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   355
    "Modified: 19.4.1997 / 09:50:14 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   356
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   357
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   358
changeDotFileVisibility
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   359
    "turn on/off visibility of files whose name starts with '.'"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   360
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   361
    showDotFiles := showDotFiles not.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   362
    self updateCurrentDirectory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   363
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   364
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   365
fileEncoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   366
    "open a dialog to allow change of the files character encoding.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   367
     Files are converted to internal encoding when read, and converted back
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   368
     to this encoding when saved.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   369
     The default encoding is nil, which means that files are already in
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   370
     the internal encoding (which is iso8859).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   371
     Notice: currently, not too many encodings are supported by the system."
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   372
495
6d6a6b8feb2b ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
   373
    |dialog list descr encodings encodingNames idx|
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   374
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   375
    list := SelectionInList new.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   376
495
6d6a6b8feb2b ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
   377
    descr := CharacterArray supportedExternalEncodings.
6d6a6b8feb2b ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
   378
    encodings := descr at:2.
6d6a6b8feb2b ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
   379
    encodingNames := descr at:1.
6d6a6b8feb2b ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
   380
6d6a6b8feb2b ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
   381
    list list:encodingNames.
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   382
    list selectionIndex:(encodings indexOf:fileEncoding ifAbsent:1).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   383
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   384
    dialog := Dialog new.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   385
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   386
    dialog addTextLabel:(resources string:'ENCODING_MSG') withCRs.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   387
    dialog addVerticalSpace.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   388
    dialog addListBoxOn:list withNumberOfLines:5.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   389
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   390
    dialog addAbortButton; addOkButton.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   391
    dialog open.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   392
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   393
    dialog accepted ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   394
        idx := list selectionIndex.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   395
        fileEncoding := encodings at:idx.
482
6017d64e8e4b added big5 & gb support
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   396
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
   397
        self validateFontEncodingFor:fileEncoding ask:true.
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   398
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   399
822
dec03206e586 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
   400
    "Modified: 31.10.1996 / 16:47:47 / cg"
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   401
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   402
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   403
fileExecute
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   404
    "if text was modified show a queryBox,
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   405
     otherwise pop up execute box immediately"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   406
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   407
    |action sel fileName|
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   408
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   409
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   410
     this replaces everything by the commands output ...
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   411
    "
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   412
    action := [:command | 
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   413
                self class addToCommandHistory:command for:fileName.
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   414
                self doExecuteCommand:command replace:true
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   415
              ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   416
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   417
    (self askIfModified:'contents has not been saved.\\Modifications will be lost when command is executed.'
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   418
              yesButton:'execute') ifFalse:[^ self].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   419
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   420
"/    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   421
"/     this inserts the commands output ...
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   422
"/    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   423
"/    action := [:command| self doExecuteCommand:command replace:false].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   424
"/
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   425
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   426
    sel := fileListView selection.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   427
    sel size == 1 ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   428
        fileName := fileList at:sel first
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   429
    ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
   430
    self askForCommandFor:fileName thenDo:action
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   431
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   432
    "Modified: 14.11.1996 / 14:59:34 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   433
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   434
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   435
fileFileIn
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   436
    "fileIn the selected file(s)"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   437
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   438
    self fileFileInLazy:false 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   439
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   440
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   441
fileFileInLazy
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   442
    "fileIn the selected file(s). Do a quick load (no compilation)"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   443
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   444
    self fileFileInLazy:true 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   445
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   446
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   447
fileFileInLazy:lazy
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   448
    "fileIn the selected file(s)"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   449
333
245f0a972fc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   450
    |aStream here oldPath wasLazy bos|
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   451
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   452
    self selectedFilesDo:[:fileName |
487
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   453
        ((currentDirectory typeOf:fileName) == #regular) ifTrue:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   454
            here := currentDirectory pathName.
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   455
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   456
            ((fileName endsWith:'.o') 
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   457
            or:[(fileName endsWith:'.so')
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   458
            or:[fileName endsWith:'.obj']]) ifTrue:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   459
                Object abortSignal catch:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   460
                    |p|
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   461
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   462
                    p := (here , '/' ,fileName).
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   463
                    "/
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   464
                    "/ look if already loaded ...  then unload first
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   465
                    "/
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   466
                    (ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   467
                        (Dialog confirm:(resources 
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   468
                                            string:'%1 is already loaded; load anyway ?'
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   469
                                            with:p)) ifFalse:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   470
                            ^ self
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   471
                        ].
551
9c94cf577a45 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   472
                        Transcript showCR:'unloading old ' , p , ' ...'.
487
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   473
                        ObjectFileLoader unloadObjectFile:p. 
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   474
                    ].
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   475
551
9c94cf577a45 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   476
                    Transcript showCR:'loading ' , p , ' ...'.
487
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   477
                    ObjectFileLoader loadObjectFile:p.
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   478
                    Class addInfoRecord:('fileIn ' , fileName) 
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   479
                ]
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   480
            ] ifFalse:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   481
                (fileName endsWith:'.cls') ifTrue:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   482
                    aStream := FileStream readonlyFileNamed:fileName in:currentDirectory.
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   483
                    aStream notNil ifTrue:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   484
                        bos := BinaryObjectStorage onOld:aStream.
763
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
   485
                        Class nameSpaceQuerySignal 
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
   486
                            answer:Smalltalk
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
   487
                            do:[
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
   488
                                bos next.
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
   489
                            ].
487
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   490
                        bos close
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   491
                    ]
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   492
                ] ifFalse:[
639
d69caf43cb0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   493
                    ((fileName endsWith:'.class')
d69caf43cb0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   494
                    or:[(fileName endsWith:'.cla')
d69caf43cb0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   495
                    or:[(fileName endsWith:'.CLA')]]) ifTrue:[
487
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   496
                        JavaClassReader notNil ifTrue:[
525
7bc030853c31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 508
diff changeset
   497
                            JavaClassReader loadFile:(currentDirectory pathName , '/' , fileName)
487
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   498
                        ]
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   499
                    ] ifFalse:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   500
                        aStream := FileStream readonlyFileNamed:fileName in:currentDirectory.
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   501
                        aStream notNil ifTrue:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   502
                            [
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   503
                                Class withoutUpdatingChangesDo:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   504
                                    oldPath := Smalltalk systemPath.
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   505
                                    Smalltalk systemPath:(oldPath copy addFirst:here; yourself).
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   506
                                    wasLazy := Compiler compileLazy:lazy.
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   507
                                    aStream fileIn.
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   508
                                ].
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   509
                                Class addInfoRecord:('fileIn ' , fileName) 
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   510
                            ] valueNowOrOnUnwindDo:[
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   511
                                Compiler compileLazy:wasLazy.
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   512
                                Smalltalk systemPath:oldPath.
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   513
                                aStream close
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   514
                            ]
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   515
                        ]
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   516
                    ]
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   517
                ]
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   518
            ]
e96fd6389b15 Java class loading
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   519
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   520
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   521
835
193a21084fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
   522
    "Modified: 5.11.1996 / 22:01:14 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   523
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   524
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   525
fileGet
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   526
    "get contents of selected file into subView.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   527
     If text was modified show a queryBox,
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   528
     otherwise get it immediately"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   529
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   530
    self fileGet:false
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   531
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   532
    "Modified: 19.6.1996 / 09:38:45 / cg"
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   533
!
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   534
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   535
fileGet:viaDoubleClick
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   536
    "get contents of selected file into subView.
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   537
     If text was modified show a queryBox,
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   538
     otherwise get it immediately"
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   539
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   540
    |fileName msg label|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   541
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
   542
    (subView modified not or:[subView contentsWasSaved]) ifTrue:[
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
   543
        self doFileGet:viaDoubleClick.
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
   544
        ^ self
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
   545
    ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   546
    fileName := self getSelectedFileName.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   547
    fileName notNil ifTrue:[
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   548
        (currentDirectory isDirectory:fileName) ifTrue:[
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   549
            msg := 'contents has not been saved.\\Modifications will be lost when directory is changed.'.
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   550
            label := 'change'.
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   551
        ] ifFalse:[
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   552
            msg := 'contents has not been saved.\\Modifications will be lost when new file is read.'.
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   553
            label := 'get'.
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   554
        ].
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   555
        (self ask:(resources at:msg) yesButton:label) ifTrue:[
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   556
            self doFileGet:viaDoubleClick
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   557
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   558
    ]
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   559
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   560
    "Created: 19.6.1996 / 09:38:35 / cg"
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
   561
    "Modified: 2.4.1997 / 23:24:40 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   562
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   563
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   564
fileGetInfo
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   565
    "show short file (stat)-info"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   566
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   567
    self fileGetInfo:false
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   568
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   569
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   570
fileGetInfo:longInfo
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   571
    "get info on selected file - show it in a box"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   572
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   573
    |string|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   574
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   575
    string := self getFileInfoString:longInfo.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   576
    string notNil ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   577
        self information:string
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   578
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   579
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   580
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   581
fileGetLongInfo
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   582
    "show long stat (file)-info"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   583
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   584
    self fileGetInfo:true
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   585
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   586
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   587
fileInsert
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   588
    "insert contents of file at cursor"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   589
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   590
    |fileName|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   591
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   592
    fileName := self getSelectedFileName.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   593
    fileName notNil ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   594
        self showFile:fileName insert:true encoding:fileEncoding
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   595
    ]
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   596
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   597
    "Modified: 22.2.1996 / 14:47:16 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   598
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   599
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   600
fileListMenu
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   601
    "return the menu to show in the fileList"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   602
1040
5835207bcb3e menu resource
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
   603
    <resource: #menu>
5835207bcb3e menu resource
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
   604
1010
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   605
    |labels shorties selectors m sel|
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   606
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   607
    labels := #(
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   608
                 'spawn'                   
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   609
                 '-'                               
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   610
                 'get contents'                    
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   611
                 'insert contents'                    
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   612
                 'show info'             
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   613
                 'show full info'          
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   614
                 'fileIn'                 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   615
                 'quick fileIn (lazy)'                 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   616
                 '-'                               
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   617
                 'update'                 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   618
                 '-'                               
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   619
                 'execute unix command ...'                
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   620
                 'st/x tools'                
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   621
                 '-'                               
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   622
                 'remove'                 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   623
                 'rename ...'                 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   624
                 '-'                               
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   625
                 'display long list'           
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   626
                 'show all files'           
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   627
                 'encoding ...'           
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   628
                 '-'                               
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   629
                 'create directory ...'         
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   630
                 'create file ...'
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   631
               ).             
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   632
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   633
    selectors := #(
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   634
                 fileSpawn
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   635
                 nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   636
                 fileGet
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   637
                 fileInsert
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   638
                 fileGetInfo
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   639
                 fileGetLongInfo
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   640
                 fileFileIn
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   641
                 fileFileInLazy
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   642
                 nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   643
                 updateCurrentDirectory
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   644
                 nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   645
                 fileExecute
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   646
                 stxTools
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   647
                 nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   648
                 fileRemove
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   649
                 fileRename
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   650
                 nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   651
                 changeDisplayMode
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   652
                 changeDotFileVisibility
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   653
                 fileEncoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   654
                 nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   655
                 newDirectory
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   656
                 newFile
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   657
                ).
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   658
1010
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   659
    shorties := #(
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   660
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   661
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   662
                 GotoLine
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   663
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   664
                 InspectIt
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   665
                 CmdI
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   666
                 Accept
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   667
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   668
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   669
                 Cmdu
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   670
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   671
                 DoIt
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   672
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   673
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   674
                 Delete
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   675
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   676
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   677
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   678
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   679
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   680
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   681
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   682
                 nil
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   683
                ).
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   684
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   685
    m := PopUpMenu 
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   686
            labels:(resources array:labels)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   687
            selectors:selectors
1010
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   688
            accelerators:shorties
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   689
            receiver:self.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   690
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   691
    showDotFiles ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   692
        m labelAt:#changeDotFileVisibility put:(resources string:'hide hidden files')
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   693
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   694
    showLongList ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   695
        m labelAt:#changeDisplayMode put:(resources string:'display short list')
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   696
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   697
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   698
    m subMenuAt:#stxTools 
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   699
            put:(PopUpMenu
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   700
                    labels:(resources array:
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   701
                           #(
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   702
                              'Changes browser'
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   703
                              'Editor'
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   704
                              'HTML reader'
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   705
                              'Image inspect'
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   706
                              'show file differences'
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   707
                            ))
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   708
                    selectors:#(
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   709
                              openChangesBrowser
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   710
                              openEditor
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   711
                              openHTMLReader
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   712
                              openImageInspector
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   713
                              openDiffView
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   714
                              )
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   715
                    receiver:self).
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   716
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   717
    ((sel := fileListView selection) isNil or:[sel isEmpty]) ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   718
        m disableAll:#(fileGet fileInsert
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   719
                       fileGetInfo fileGetLongInfo
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   720
                       fileFileIn fileFileInLazy
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   721
                       fileRemove fileRename).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   722
        (m subMenuAt:#stxTools)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   723
            disableAll:#(openChangesBrowser openEditor openHTMLReader openImageInspector)
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   724
    ] ifFalse:[
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   725
        fileListView selection size > 1 ifTrue:[
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   726
            m disableAll:#( fileGet fileInsert fileGetInfo fileGetLongInfo fileRename )
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   727
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   728
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   729
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   730
    ^m
252
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   731
1010
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
   732
    "Modified: 28.1.1997 / 15:04:42 / stefan"
1040
5835207bcb3e menu resource
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
   733
    "Modified: 25.2.1997 / 20:15:06 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   734
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   735
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   736
filePrint
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   737
    |fileName inStream printStream line|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   738
294
a693bd6d7ae6 read cursor while reading
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   739
    self withWaitCursorDo:[
851
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   740
        fileName := self getSelectedFileName.
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   741
        fileName notNil ifTrue:[
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   742
            ((currentDirectory typeOf:fileName) == #regular) ifTrue:[
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   743
                inStream := FileStream readonlyFileNamed:fileName
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   744
                                                      in:currentDirectory.
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   745
                inStream isNil ifFalse:[
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   746
                    printStream := PrinterStream new.
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   747
                    printStream notNil ifTrue:[
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   748
                        [inStream atEnd] whileFalse:[
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   749
                            line := inStream nextLine.
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   750
                            printStream nextPutLine:line.
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   751
                        ].
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   752
                        printStream close
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   753
                    ].
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   754
                    inStream close
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   755
                ]
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   756
            ]
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   757
        ].
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   758
        0 "compiler hint"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   759
    ]
294
a693bd6d7ae6 read cursor while reading
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   760
851
ad362b72df1c use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   761
    "Modified: 9.11.1996 / 00:15:07 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   762
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   763
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   764
fileRemove
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   765
    "remove the selected file(s).
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   766
     Query if user really wants to remove the file.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   767
     - should be enhanced, to look for a ~/.trash directory 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   768
     and move files there if it exists (without asking in this case)."
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   769
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   770
    |sel q|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   771
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   772
    sel := fileListView selection.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   773
    sel notNil ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   774
        sel size > 1 ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   775
            q := resources string:'remove selected files ?'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   776
        ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   777
            q := resources string:'remove ''%1'' ?' with:(fileList at:sel first)
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   778
        ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   779
        (self ask:q yesButton:'remove') ifTrue:[self doRemove]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   780
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   781
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   782
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   783
fileRename
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   784
    "rename the selected file(s)"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   785
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   786
    |queryBox|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   787
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   788
    queryBox := FilenameEnterBox new.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   789
    queryBox okText:(resources at:'rename').
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   790
    self selectedFilesDo:[:oldName |
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   791
        queryBox title:(resources string:'rename ''%1'' to:' with:oldName).
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   792
        queryBox initialText:oldName.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   793
        queryBox action:[:newName | self doRename:oldName to:newName].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   794
        queryBox showAtPointer
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   795
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   796
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   797
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   798
fileSelect:lineNr
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   799
    "selected a file - do nothing here"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   800
    ^ self
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   801
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   802
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   803
fileSpawn
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   804
    "start another FileBrowser on the selected directory or
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   805
     on the same directory if none is selected."
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   806
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   807
    |any|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   808
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   809
    any := false.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   810
    self selectedFilesDo:[:fileName |
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   811
        (currentDirectory isDirectory:fileName) ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   812
            self class openOn:(currentDirectory pathName , '/' , fileName).
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   813
            any := true
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   814
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   815
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   816
    any ifFalse:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   817
        self class openOn:currentDirectory pathName
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   818
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   819
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   820
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   821
newDirectory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   822
    "ask for and create a new directory"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   823
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   824
    |queryBox|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   825
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   826
    queryBox := FilenameEnterBox 
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   827
                    title:(resources at:'create new directory:') withCRs
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   828
                    okText:(resources at:'create')
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   829
                    action:[:newName | self doCreateDirectory:newName].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   830
"/    queryBox initialText:''.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   831
    queryBox showAtPointer
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   832
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   833
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   834
newFile
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   835
    "ask for and create a new file"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   836
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   837
    |sel queryBox|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   838
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   839
    queryBox := FilenameEnterBox 
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   840
                    title:(resources at:'create new file:') withCRs
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   841
                    okText:(resources at:'create')
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   842
                    action:[:newName | self doCreateFile:newName].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   843
    sel := subView selection.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   844
    sel notNil ifTrue:[
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   845
        queryBox initialText:(sel asString)
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   846
"/    ] ifFalse:[
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   847
"/        queryBox initialText:''
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   848
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   849
    queryBox showAtPointer
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   850
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
   851
    "Modified: 21.2.1996 / 01:43:14 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   852
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   853
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   854
openChangesBrowser
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   855
    "open a change browser on the selected file(s)"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   856
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   857
    self openTool:ChangesBrowser
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   858
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   859
252
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   860
openDiffView
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   861
    "open a diff-view"
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   862
488
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   863
    |box name1 name2 text1 text2 d err nm here l1|
252
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   864
961
a3c51ef9baa3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   865
    name1 := ValueHolder newString.
252
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   866
    name2 := self getSelectedFileName asValue.
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   867
    here := currentDirectory pathName.
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   868
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   869
    box := DialogBox new.
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   870
    box addTextLabel:'show difference between:'.
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   871
    box addFilenameInputFieldOn:name1 in:here tabable:true.
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   872
    box addTextLabel:'and:'.
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   873
    box addFilenameInputFieldOn:name2 in:here tabable:true.
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   874
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   875
    box addAbortButton; addOkButton.
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   876
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   877
    box showAtPointer.
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   878
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   879
    box accepted ifTrue:[
488
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   880
        name1 := name1 value.
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   881
        name1 isEmpty ifTrue:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   882
            text1 := subView contents.
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   883
            name1 := nil.
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   884
            l1 := 'browser contents'
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   885
        ] ifFalse:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   886
            (name1 := name1 value asFilename) isAbsolute ifFalse:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   887
                name1 := here asFilename construct:name1
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   888
            ].
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   889
            name1 isReadable ifFalse:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   890
                nm := name1.
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   891
                name1 exists ifFalse:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   892
                    err := '%1 does not exist'.
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   893
                ] ifTrue:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   894
                    err := '%1 is not readable'
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   895
                ].
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   896
            ].
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   897
            l1 := name1 pathName
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   898
        ].
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   899
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   900
        (name2 := name2 value asFilename) isAbsolute ifFalse:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   901
            name2 := here asFilename construct:name2
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   902
        ].
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   903
        err isNil ifTrue:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   904
            name2 isReadable ifFalse:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   905
                nm := name2.
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   906
                name2 exists ifFalse:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   907
                    err := '%1 does not exist'.
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   908
                ] ifTrue:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   909
                    err := '%1 is not readable'
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   910
                ].
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   911
            ].
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   912
        ].
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   913
        err notNil ifTrue:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   914
            self warn:(resources string:err with:nm pathName).
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   915
            ^ self
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   916
        ].
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   917
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   918
        self withWaitCursorDo:[
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   919
            name1 notNil ifTrue:[
667
9fc53023512e use #contents instead of #contentsOfEntireFile
Claus Gittinger <cg@exept.de>
parents: 639
diff changeset
   920
                text1 := name1 contents.
488
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   921
            ].
667
9fc53023512e use #contents instead of #contentsOfEntireFile
Claus Gittinger <cg@exept.de>
parents: 639
diff changeset
   922
            text2 := name2 contents.
488
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   923
            d := DiffTextView 
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   924
                    openOn:text1 label:l1
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   925
                    and:text2 label:name2 pathName.
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   926
            d label:'file differences'.
26f8da377672 allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   927
        ]
252
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   928
    ].
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   929
5b9377d69ab2 added file-Diff function
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   930
    "Created: 7.12.1995 / 20:33:58 / cg"
961
a3c51ef9baa3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   931
    "Modified: 16.1.1997 / 00:51:22 / cg"
267
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   932
!
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   933
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   934
openEditor
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   935
    self openTool:EditTextView
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   936
!
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   937
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   938
openHTMLReader
556
1549bab879c7 use new documentView
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   939
    self openTool:HTMLDocumentView
1549bab879c7 use new documentView
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   940
1549bab879c7 use new documentView
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   941
    "Modified: 20.5.1996 / 20:30:58 / cg"
267
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   942
!
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   943
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   944
openImageInspector
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   945
    |img|
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   946
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   947
    self selectedFilesDo:[:fileName |
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   948
        (currentDirectory isDirectory:fileName) ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   949
            img := Image fromFile:(currentDirectory pathName , '/' , fileName).
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   950
            img notNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   951
                img inspect
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   952
            ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   953
                self warn:'unknown format: ' , fileName
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   954
            ]
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
   955
        ]
267
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   956
    ].
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   957
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   958
    "Modified: 17.9.1995 / 17:41:24 / claus"
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   959
!
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   960
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   961
openTool:aToolClass
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   962
    "open a tool on the selected file(s)"
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   963
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   964
    |numItems|
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   965
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   966
    (numItems := fileListView selection size) > 2 ifTrue:[
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   967
        (self 
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   968
            confirm:(resources string:'open for each of the %1 items ?' 
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   969
                                 with:numItems)) ifFalse:[^ self].
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   970
    ].
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   971
267
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   972
    self selectedFilesDo:[:fileName |
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   973
        (currentDirectory isDirectory:fileName) ifFalse:[
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   974
            aToolClass openOn:(currentDirectory pathName , '/' , fileName).
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   975
        ]
267
03885fd03d97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   976
    ].
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   977
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   978
    "Modified: 14.11.1996 / 16:01:32 / cg"
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   979
!
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   980
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   981
showOrHideTabView
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   982
    "depending on the showLongList setting, show or hde the tabSpec view"
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   983
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   984
    showLongList ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   985
        false "self is3D" ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   986
            scrollView topInset:(tabRulerView superView height).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   987
            tabRulerView superView leftInset:(fileListView originRelativeTo:scrollView) x.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   988
        ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   989
            scrollView topInset:(tabRulerView height).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   990
            tabRulerView leftInset:(fileListView originRelativeTo:scrollView) x.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   991
        ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   992
        tabRulerView hiddenTabs:#(1).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   993
        tabRulerView fixedTabs:#(1).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   994
    ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   995
        scrollView topInset:0
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   996
    ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   997
    tabSpec := nil.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   998
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   999
    "Created: 19.4.1997 / 09:50:02 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1000
! !
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1001
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1002
!FileBrowser methodsFor:'help '!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1003
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1004
helpTextFor:aComponent
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1005
    |s|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1006
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1007
    aComponent == subView ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1008
        s := 'HELP_SUBVIEW'
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1009
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1010
    aComponent == fileListView ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1011
        s := 'HELP_FILELIST'
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1012
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1013
    aComponent == filterField ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1014
        s := 'HELP_FILTER'
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1015
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1016
    aComponent == labelView ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1017
        s := 'HELP_PATHFIELD'
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1018
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1019
    aComponent == commandView ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1020
        s := 'HELP_COMMANDVIEW'
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1021
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1022
    s notNil ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1023
        ^ resources string:s
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1024
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1025
    ^ nil
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1026
! !
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1027
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1028
!FileBrowser methodsFor:'initialization'!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1029
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1030
currentDirectory:aDirectoryPath
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1031
    "set the directory to be browsed"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1032
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1033
    currentDirectory := FileDirectory directoryNamed:aDirectoryPath.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1034
    self changed:#path.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1035
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1036
     tell my subview (whatever that is) to start its file-dialog
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1037
     (i.e. save-as etc.) in that directory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1038
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1039
    (subView respondsTo:#directoryForFileDialog:) ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1040
        subView directoryForFileDialog:currentDirectory
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1041
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1042
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1043
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1044
focusSequence
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1045
    "return the sequence in which ALT-CursorRight steps focus"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1046
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1047
    |fs|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1048
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1049
    fs := Array 
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1050
        with:filterField 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1051
        with:fileListView 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1052
        with:subView.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1053
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1054
    commandView notNil ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1055
        fs := fs copyWith:commandView
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1056
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1057
    ^fs
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1058
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1059
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1060
initEvents
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1061
    super initEvents.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1062
    self enableEvent:#visibilityChange.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1063
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1064
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1065
initialize
1102
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1066
    |frame spacing halfSpacing v topFrame labelFrame filterModel
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1067
     |
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1068
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1069
    super initialize.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1070
819
b78a26650047 initialize fileEncoding to #iso8859
Claus Gittinger <cg@exept.de>
parents: 807
diff changeset
  1071
    fileEncoding := #iso8859.        "/ native ST/X encoding
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1072
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1073
    "if true, will replace leading spaces by tabs on
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1074
     file write. If false, they will be written as spaces
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1075
    "
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1076
    compressTabs := resources at:'COMPRESS_TABS' default:true.
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1077
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1078
    "
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1079
     showing long or short by default
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1080
    "
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  1081
    showLongList := resources at:'LONG_LIST' default:true.
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1082
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1083
    "
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1084
     show hidden files or not ?
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1085
    "
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1086
    showDotFiles := resources at:'SHOW_DOT_FILES' default:false.
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1087
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1088
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1089
    lockUpdate := false.
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1090
132
claus
parents: 126
diff changeset
  1091
    CommandHistory isNil ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1092
        CommandHistory := OrderedCollection new.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1093
        CommandHistorySize := 50
132
claus
parents: 126
diff changeset
  1094
    ].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1095
    DirectoryHistory isNil ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1096
        DirectoryHistory := OrderedCollection new.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1097
        DirectoryHistoryWhere := OrderedCollection new.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1098
        HistorySize := 15.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1099
    ].
132
claus
parents: 126
diff changeset
  1100
    commandIndex := 0.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1101
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1102
    myName := (resources string:self class name).
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1103
    self label:myName.
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1104
93
claus
parents: 85
diff changeset
  1105
    labelFrame := View 
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1106
                        origin:(0.0 @ 0.0)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1107
                        corner:(1.0 @ (font height * 2))
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1108
                        in:self.
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
  1109
105
claus
parents: 100
diff changeset
  1110
    styleSheet name = #st80 ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1111
        labelFrame level:1
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1112
    ].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1113
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1114
    spacing := ViewSpacing.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1115
    halfSpacing := spacing // 2.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1116
1100
d9382b49c62d Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents: 1091
diff changeset
  1117
    "
d9382b49c62d Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents: 1091
diff changeset
  1118
      checkBlock is executed by the Processor every checkDelta seconds.
d9382b49c62d Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents: 1091
diff changeset
  1119
      We use #pushEvent: to perform the directory update
d9382b49c62d Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents: 1091
diff changeset
  1120
      in our windowgroups process.
d9382b49c62d Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents: 1091
diff changeset
  1121
    "
d9382b49c62d Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents: 1091
diff changeset
  1122
    checkBlock := [self pushEvent:#checkIfDirectoryHasChanged].
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1123
    checkDelta := resources at:'CHECK_DELTA' default:10.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1124
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1125
    currentDirectory := FileDirectory directoryNamed:'.'.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1126
344
3f881dbee13a use a model for the filter field
Claus Gittinger <cg@exept.de>
parents: 333
diff changeset
  1127
    filterModel := '*' asValue.
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1128
    filterField := EditField in:labelFrame.
1071
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  1129
    filterField 
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  1130
        origin:[((width // 4 * 3) + halfSpacing) @ halfSpacing]
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  1131
        corner:(1.0 @ (filterField heightIncludingBorder + halfSpacing + halfSpacing) ).
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  1132
    filterField rightInset:halfSpacing.
344
3f881dbee13a use a model for the filter field
Claus Gittinger <cg@exept.de>
parents: 333
diff changeset
  1133
    filterField model:filterModel.
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1134
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1135
    self initializeFilterPattern.
344
3f881dbee13a use a model for the filter field
Claus Gittinger <cg@exept.de>
parents: 333
diff changeset
  1136
    filterModel onChangeSend:#filterPatternChanged to:self.
3f881dbee13a use a model for the filter field
Claus Gittinger <cg@exept.de>
parents: 333
diff changeset
  1137
"/    filterField leaveAction:[:key | fileListView scrollToTop. self updateCurrentDirectory].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1138
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1139
    labelView := Label in:labelFrame.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1140
    labelView origin:(halfSpacing @ halfSpacing)
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1141
              extent:[((width // 4 * 3) - spacing - borderWidth)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1142
                       @
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1143
                       (filterField heightIncludingBorder)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1144
                       "(font height + font descent)"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1145
                     ].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1146
    labelView adjust:#right.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1147
    labelView borderWidth:0.
93
claus
parents: 85
diff changeset
  1148
    labelView model:self; menu:#labelMenu; aspect:#path; labelMessage:#path.
73
e332d9c71624 *** empty log message ***
claus
parents: 67
diff changeset
  1149
    labelFrame model:self; menu:#labelMenu.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1150
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1151
    killButton := Button label:(resources string:'kill') in:self.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1152
    killButton origin:(halfSpacing @ halfSpacing)
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1153
               extent:(killButton width @ filterField height).
331
a12998c7f3c2 use beVisible / beInvisible
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1154
    killButton beInvisible.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1155
132
claus
parents: 126
diff changeset
  1156
    self initializeCommandViewIn:self.
claus
parents: 126
diff changeset
  1157
claus
parents: 126
diff changeset
  1158
"/    frame := VariableVerticalPanel
claus
parents: 126
diff changeset
  1159
"/                 origin:[frame borderWidth negated 
claus
parents: 126
diff changeset
  1160
"/                         @ 
claus
parents: 126
diff changeset
  1161
"/                         labelFrame height
claus
parents: 126
diff changeset
  1162
"/                         "/ (labelView height + labelView origin y + spacing)
claus
parents: 126
diff changeset
  1163
"/                        ]
claus
parents: 126
diff changeset
  1164
"/                 corner:(1.0 @ 1.0)
claus
parents: 126
diff changeset
  1165
"/                     in:self.
claus
parents: 126
diff changeset
  1166
claus
parents: 126
diff changeset
  1167
    frame := VariableVerticalPanel origin:0.0@0.0 corner:1.0@1.0 in:self.
claus
parents: 126
diff changeset
  1168
    frame topInset:labelFrame height.
claus
parents: 126
diff changeset
  1169
    commandView notNil ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1170
        frame bottomInset:(commandView height + spacing + spacing)
132
claus
parents: 126
diff changeset
  1171
    ].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1172
1102
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1173
    topFrame := View in:frame.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1174
    topFrame origin:(0.0 @ 0.0) corner:(1.0 @ 0.3).
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1175
1104
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1176
    false "self is3D" ifTrue:[
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1177
        v := View in:topFrame.
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1178
        v level:-1.
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1179
        tabRulerView := TabSpecRuler in:v.
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1180
        tabRulerView level:1.
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1181
        v origin:(0.0@0.0) corner:(1.0@10).
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1182
        tabRulerView origin:(0.0@0.0) corner:(1.0@1.0).
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1183
    ] ifFalse:[
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1184
        tabRulerView := TabSpecRuler in:topFrame.
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1185
        tabRulerView origin:(0.0@0.0) corner:(1.0@10).
3de3f0cf3ba0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  1186
    ].
1102
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1187
    tabRulerView borderWidth:0.
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1188
    tabRulerView synchronousOperation:true.
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1189
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1190
    scrollView := ScrollableView in:topFrame.
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1191
    scrollView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1192
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1193
    fileListView := SelectionInListView new.
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1194
    scrollView scrolledView:fileListView.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1195
    fileListView action:[:lineNr | self fileSelect:lineNr].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1196
    fileListView doubleClickAction:[:lineNr | self fileSelect:lineNr.
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  1197
                                              self fileGet:true].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1198
    fileListView multipleSelectOk:true.
1010
1873d0f5aa1d Add accelerator keys.
Stefan Vogel <sv@exept.de>
parents: 994
diff changeset
  1199
    fileListView delegate:self.
98
claus
parents: 93
diff changeset
  1200
    fileListView menuHolder:self; menuPerformer:self; menuMessage:#fileListMenu.
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1201
    fileListView allowDrag:true.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1202
    fileListView dragObjectConverter:[:obj | 
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1203
                                        |dir nm path idx|
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1204
obj printCR.
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1205
                                        nm := obj theObject asString.
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1206
                                        idx := fileListView list indexOf:nm.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1207
idx printCR.
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1208
                                        idx == 0 ifTrue:[
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1209
                                            "/ cannot happen ...
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1210
                                            nil
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1211
                                        ] ifFalse:[
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1212
                                            nm := fileList at:idx.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1213
nm printCR.
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1214
                                            dir := currentDirectory pathName asFilename.
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1215
                                            path := dir constructString:nm.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1216
path printCR.
1122
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1217
                                            DropObject newFile:path.
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1218
                                        ]
970fc7e88639 support drag out of my list.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1219
                                     ].
1102
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1220
    tabRulerView leftInset:(fileListView originRelativeTo:scrollView) x.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1221
    self showOrHideTabView.
1102
ebea200b201b added a tabSpecRuler
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1222
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1223
    v := self initializeSubViewIn:frame.
132
claus
parents: 126
diff changeset
  1224
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1225
    v origin:(0.0 @ 0.3) corner:(1.0 @ 1.0).
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1226
    subView := v scrolledView.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1227
    (subView respondsTo:#directoryForFileDialog:) ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1228
        subView directoryForFileDialog:currentDirectory
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1229
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1230
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1231
    ObjectMemory addDependent:self.
132
claus
parents: 126
diff changeset
  1232
claus
parents: 126
diff changeset
  1233
    "Modified: 6.9.1995 / 20:26:06 / claus"
1100
d9382b49c62d Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents: 1091
diff changeset
  1234
    "Modified: 27.3.1997 / 11:04:31 / stefan"
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1235
    "Modified: 19.4.1997 / 09:56:06 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1236
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1237
132
claus
parents: 126
diff changeset
  1238
initializeCommandViewIn:frame
claus
parents: 126
diff changeset
  1239
    "set up the command view - can be redefined in subclasses as empty,
claus
parents: 126
diff changeset
  1240
     if no commandView is wanted"
claus
parents: 126
diff changeset
  1241
claus
parents: 126
diff changeset
  1242
claus
parents: 126
diff changeset
  1243
    commandView := EditField origin:0.0@1.0 corner:1.0@1.0 in:frame.
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1244
    commandView allInset:ViewSpacing.
132
claus
parents: 126
diff changeset
  1245
    commandView topInset:(commandView preferredExtent y negated - ViewSpacing).
claus
parents: 126
diff changeset
  1246
133
claus
parents: 132
diff changeset
  1247
"/    commandView contents:'** no commands which require input here **'.
132
claus
parents: 126
diff changeset
  1248
142
claus
parents: 139
diff changeset
  1249
    commandView entryCompletionBlock:[:contents |
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1250
        |newString|
142
claus
parents: 139
diff changeset
  1251
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1252
        newString := Filename 
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1253
                        filenameCompletionFor:contents 
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1254
                        directory:currentDirectory pathName asFilename 
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1255
                        directoriesOnly:false 
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1256
                        filesOnly:false 
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1257
                        ifMultiple:[:dir | commandView flash.].
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1258
        commandView contents:newString.
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1259
        commandView cursorToEndOfLine.
132
claus
parents: 126
diff changeset
  1260
    ].
claus
parents: 126
diff changeset
  1261
    commandView leaveAction:[:key | 
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1262
        |cmd nCmd empty|
132
claus
parents: 126
diff changeset
  1263
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1264
        (key == #CursorDown 
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1265
        or:[key == #CursorUp]) ifTrue:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1266
            nCmd := CommandHistory size.
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1267
            nCmd == 0 ifTrue:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1268
                empty := true
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1269
            ] ifFalse:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1270
                key == #CursorUp ifTrue:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1271
                    commandIndex == nCmd ifTrue:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1272
                        commandView flash.
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1273
                    ].
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1274
                    commandIndex := (commandIndex + 1) min:nCmd
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1275
                ] ifFalse:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1276
                    commandIndex == 1 ifTrue:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1277
                        commandView flash.
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1278
                        empty := true.
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1279
                    ].
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1280
                    commandIndex := (commandIndex - 1) max:1.
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1281
                ].
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1282
            ].
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1283
            empty == true ifTrue:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1284
                commandView contents:nil
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1285
            ] ifFalse:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1286
                commandView contents:(CommandHistory at:commandIndex).
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1287
            ]        
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1288
        ].
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1289
        key == #Return ifTrue:[
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1290
            cmd := commandView contents.
132
claus
parents: 126
diff changeset
  1291
539
33b603dd30ba replaced ColoredListEntry by Text
Claus Gittinger <cg@exept.de>
parents: 525
diff changeset
  1292
            subView insertLine:(
33b603dd30ba replaced ColoredListEntry by Text
Claus Gittinger <cg@exept.de>
parents: 525
diff changeset
  1293
                                Text string:('>> ' , cmd)
540
4c3c76a1af92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 539
diff changeset
  1294
                                     emphasis:(Array with:#bold with:#underline with:(#color->Color blue))
539
33b603dd30ba replaced ColoredListEntry by Text
Claus Gittinger <cg@exept.de>
parents: 525
diff changeset
  1295
"/                                ColoredListEntry string:('>> ' , cmd) color:Color blue
33b603dd30ba replaced ColoredListEntry by Text
Claus Gittinger <cg@exept.de>
parents: 525
diff changeset
  1296
                                )
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1297
                    before:(subView cursorLine).
539
33b603dd30ba replaced ColoredListEntry by Text
Claus Gittinger <cg@exept.de>
parents: 525
diff changeset
  1298
            subView cursorDown:1.
133
claus
parents: 132
diff changeset
  1299
claus
parents: 132
diff changeset
  1300
"/            subView insertStringAtCursor:cmd.
claus
parents: 132
diff changeset
  1301
"/            subView insertCharAtCursor:(Character cr).
132
claus
parents: 126
diff changeset
  1302
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1303
            (cmd notNil and:[cmd notEmpty]) ifTrue:[
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  1304
                self class addToCommandHistory:cmd for:nil.
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1305
                self doExecuteCommand:cmd replace:false.
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1306
                commandView contents:nil.
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1307
                commandIndex := 0
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1308
            ]
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  1309
        ]
132
claus
parents: 126
diff changeset
  1310
    ].
claus
parents: 126
diff changeset
  1311
133
claus
parents: 132
diff changeset
  1312
    "Modified: 7.9.1995 / 15:48:45 / claus"
865
48395e8ecca9 remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1313
    "Modified: 14.11.1996 / 14:58:38 / cg"
132
claus
parents: 126
diff changeset
  1314
!
claus
parents: 126
diff changeset
  1315
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1316
initializeFilterPattern
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1317
    "set an initial matchpattern - can be redefined in subclasses"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1318
344
3f881dbee13a use a model for the filter field
Claus Gittinger <cg@exept.de>
parents: 333
diff changeset
  1319
    filterField model value:'*'
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1320
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1321
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1322
initializeSubViewIn:frame
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1323
    "set up the contents view - can be redefined in subclasses for
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1324
     different view types (SoundFileBrowser/ImageBrowsers etc.)"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1325
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1326
    ^ HVScrollableView for:CodeView miniScrollerH:true miniScrollerV:false in:frame.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1327
! !
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1328
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1329
!FileBrowser methodsFor:'misc user interaction'!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1330
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1331
destroy
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1332
    "destroy view and boxes"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1333
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1334
    ObjectMemory removeDependent:self.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1335
    self stopUpdateProcess.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1336
    checkBlock := nil.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1337
    super destroy
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1338
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1339
    "Modified: 19.4.1997 / 13:51:48 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1340
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1341
346
9ee1f936b7ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1342
filterPatternChanged
9ee1f936b7ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1343
    fileListView scrollToTop. 
9ee1f936b7ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1344
    self updateCurrentDirectory
9ee1f936b7ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1345
!
9ee1f936b7ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1346
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1347
terminate
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1348
    "exit FileBrowser"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1349
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1350
    (self askIfModified:'contents has not been saved.\\Modifications will be lost when FileBrowser is closed.'
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1351
              yesButton:'close') ifTrue:[self destroy]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1352
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1353
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1354
update:what with:someArgument from:changedObject
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1355
    realized ifFalse:[^ self].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1356
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1357
    (what == #aboutToExit) ifTrue:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1358
        "system wants to shut down this
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1359
         - if text was modified, pop up, and ask user and save if requested."
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1360
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1361
        (subView modified and:[subView contentsWasSaved not]) ifTrue:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1362
            self raiseDeiconified.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1363
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1364
            (self 
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1365
                ask:(resources at:'FileBrowser:\\contents has not been saved.\\Save before exiting ?')
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1366
                yesButton:'save'
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1367
                noButton:'don''t save')
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1368
            ifTrue:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1369
                subView acceptAction notNil ifTrue:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1370
                    subView accept
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1371
                ] ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1372
                    subView save
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1373
                ]
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1374
            ]
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1375
        ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1376
        ^ self
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1377
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1378
    changedObject == tabSpec ifTrue:[
585
be0241bf7268 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 564
diff changeset
  1379
        fileListView invalidate
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1380
    ].
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1381
585
be0241bf7268 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 564
diff changeset
  1382
    "Modified: 29.5.1996 / 16:13:43 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1383
! !
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1384
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1385
!FileBrowser methodsFor:'pathField user interaction'!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1386
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1387
changeCurrentDirectory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1388
    "if text was modified show a queryBox, 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1389
     otherwise change immediately to directory"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1390
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1391
    (self askIfModified:'contents has not been saved.\\Modifications will be lost when directory is changed.'
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1392
              yesButton:'change') ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1393
        self queryForDirectoryToChange
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1394
    ]
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1395
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1396
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1397
changeDirectoryTo:aDirectoryName
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1398
    "sent from label menu to change back to a previous directory"
132
claus
parents: 126
diff changeset
  1399
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1400
    self doChangeCurrentDirectoryTo:aDirectoryName updateHistory:false
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1401
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1402
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1403
changeToHomeDirectory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1404
    "if text was modified show a queryBox, 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1405
     otherwise change immediately to directory"
132
claus
parents: 126
diff changeset
  1406
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1407
    (self askIfModified:'contents has not been saved.\\Modifications will be lost when directory is changed.'
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1408
              yesButton:'change') ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1409
         self doChangeToHomeDirectory
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1410
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1411
!
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1412
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1413
changeToParentDirectory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1414
    "if text was modified show a queryBox, 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1415
     otherwise change immediately to directory"
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
  1416
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1417
    (self askIfModified:'contents has not been saved.\\Modifications will be lost when directory is changed.'
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1418
              yesButton:'change') ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1419
         self doChangeToParentDirectory
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1420
    ]
98
claus
parents: 93
diff changeset
  1421
!
claus
parents: 93
diff changeset
  1422
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1423
copyPath
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1424
    "copy current path into cut & paste buffer"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1425
873
207dd8d14e57 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
  1426
    self setTextSelection:currentDirectory pathName
207dd8d14e57 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
  1427
207dd8d14e57 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
  1428
    "Modified: 14.12.1996 / 15:37:47 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1429
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1430
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1431
labelMenu
1040
5835207bcb3e menu resource
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1432
    "return the popUpMenu for the path label"
5835207bcb3e menu resource
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1433
5835207bcb3e menu resource
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1434
    <resource: #menu>
5835207bcb3e menu resource
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1435
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1436
    |labels selectors args menu|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1437
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1438
    labels := #(
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1439
                   'copy path'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1440
                   '-'                               
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1441
                   'up'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1442
                   'back'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1443
                   'change to home-directory'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1444
                   'change directory ...'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1445
               ).             
98
claus
parents: 93
diff changeset
  1446
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1447
    selectors := #(
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1448
                    copyPath
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1449
                    nil
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1450
                    changeToParentDirectory
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1451
                    changeToPreviousDirectory
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1452
                    changeToHomeDirectory
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1453
                    changeCurrentDirectory
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1454
                  ).
123
claus
parents: 120
diff changeset
  1455
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1456
    args := Array new:(labels size).
126
claus
parents: 123
diff changeset
  1457
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1458
    DirectoryHistory size > 0 ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1459
        labels := labels copyWith:'-'.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1460
        selectors := selectors copyWith:nil.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1461
        args := args copyWith:nil.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1462
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1463
        DirectoryHistory do:[:dirName |
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1464
            labels := labels copyWith:dirName.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1465
            selectors := selectors copyWith:#changeDirectoryTo:.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1466
            args := args copyWith:dirName
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1467
        ]
123
claus
parents: 120
diff changeset
  1468
    ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1469
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1470
    menu := PopUpMenu 
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1471
                labels:(resources array:labels)
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1472
                selectors:selectors
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1473
                args:args
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1474
                receiver:self.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1475
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1476
    previousDirectory isNil ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1477
        menu disable:#changeToPreviousDirectory.
132
claus
parents: 126
diff changeset
  1478
    ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1479
    ^menu.
1040
5835207bcb3e menu resource
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1480
5835207bcb3e menu resource
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1481
    "Modified: 25.2.1997 / 20:14:58 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1482
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1483
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1484
queryForDirectoryToChange
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1485
    "query for new directory"
123
claus
parents: 120
diff changeset
  1486
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1487
    |queryBox|
98
claus
parents: 93
diff changeset
  1488
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1489
    queryBox := FilenameEnterBox 
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1490
                    title:(resources at:'change directory to:') withCRs
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1491
                    okText:(resources at:'change')
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1492
                    action:[:newName | self doChangeCurrentDirectoryTo:newName updateHistory:true].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1493
"/    queryBox initialText:''.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1494
    queryBox showAtPointer
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1495
! !
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1496
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1497
!FileBrowser methodsFor:'private'!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1498
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1499
ask:question yesButton:yesButtonText
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1500
    "common method to ask a yes/no question; return true or false"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1501
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1502
    ^ self ask:question yesButton:yesButtonText noButton:'cancel' 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1503
!
93
claus
parents: 85
diff changeset
  1504
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1505
ask:question yesButton:yesButtonText noButton:noButtonText
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1506
    "common method to ask a yes/no question"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1507
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1508
    ^ Dialog 
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1509
        confirm:question withCRs
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1510
        yesLabel:(resources at:yesButtonText)
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1511
        noLabel:(resources at:noButtonText)
37
50f59bad66b1 *** empty log message ***
claus
parents: 36
diff changeset
  1512
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1513
    "Modified: 21.2.1996 / 01:19:21 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1514
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1515
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  1516
askForCommandFor:fileName thenDo:aBlock
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1517
    "setup and launch a querybox to ask for unix command.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1518
     Then evaluate aBlock passing the command-string as argument."
93
claus
parents: 85
diff changeset
  1519
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  1520
    |sel box|
93
claus
parents: 85
diff changeset
  1521
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1522
    box := FilenameEnterBox 
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1523
                title:(resources at:'execute unix command:')
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1524
               okText:(resources at:'execute')
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1525
               action:aBlock.
79
d78f92a07d5d *** empty log message ***
claus
parents: 75
diff changeset
  1526
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1527
    fileName notNil ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1528
        self initialCommandFor:fileName into:box.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1529
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1530
    box directory:currentDirectory pathName asFilename.
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  1531
    box showAtPointer.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  1532
    box destroy.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1533
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1534
    "Modified: 7.9.1995 / 10:31:54 / claus"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1535
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1536
98
claus
parents: 93
diff changeset
  1537
askIfModified:question yesButton:yesButtonText
claus
parents: 93
diff changeset
  1538
    "tell user, that code has been modified - let her confirm"
claus
parents: 93
diff changeset
  1539
claus
parents: 93
diff changeset
  1540
    (subView modified not or:[subView contentsWasSaved]) ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1541
        ^ true
98
claus
parents: 93
diff changeset
  1542
    ].
claus
parents: 93
diff changeset
  1543
    ^ self 
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1544
        ask:(resources string:question)
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1545
        yesButton:yesButtonText
98
claus
parents: 93
diff changeset
  1546
!
claus
parents: 93
diff changeset
  1547
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1548
changeToPreviousDirectory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1549
    "if text was modified show a queryBox, 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1550
     otherwise change immediately to previous directory."
93
claus
parents: 85
diff changeset
  1551
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1552
    previousDirectory isNil ifTrue:[^ self].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1553
    (self askIfModified:'contents has not been saved.\\Modifications will be lost when directory is changed.'
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1554
              yesButton:'change') ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1555
        self doChangeCurrentDirectoryTo:previousDirectory updateHistory:false 
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1556
    ]
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1557
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1558
98
claus
parents: 93
diff changeset
  1559
checkIfDirectoryHasChanged
claus
parents: 93
diff changeset
  1560
    "every checkDelta secs, check if directoy has changed and update the list if so.
claus
parents: 93
diff changeset
  1561
     Also, we check if the file shown has been touched in the meanwhile (for example,
claus
parents: 93
diff changeset
  1562
     from another browser) and say 'outdated' in the label if so. 
claus
parents: 93
diff changeset
  1563
     This avoids confusion if the same file is being edited by two browsers. (or other editors).
claus
parents: 93
diff changeset
  1564
     If the text shown in the codeView has been edited, 'modified' is shown.
claus
parents: 93
diff changeset
  1565
    "
claus
parents: 93
diff changeset
  1566
claus
parents: 93
diff changeset
  1567
    |oldSelection nOld here newState msg newLabel|
claus
parents: 93
diff changeset
  1568
claus
parents: 93
diff changeset
  1569
    shown ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1570
        currentDirectory notNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1571
            lockUpdate ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1572
                Processor removeTimedBlock:checkBlock.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1573
                Processor addTimedBlock:checkBlock afterSeconds:checkDelta.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1574
                ^ self
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1575
            ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1576
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1577
            subView modified ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1578
                newState := ' (modified)'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1579
            ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1580
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1581
            here := currentDirectory pathName.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1582
            (OperatingSystem isReadable:here) ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1583
                Processor removeTimedBlock:checkBlock.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1584
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1585
                (currentDirectory timeOfLastChange > timeOfLastCheck) ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1586
                    nOld := fileListView numberOfSelections.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1587
                    oldSelection := fileListView selectionValue.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1588
                    self updateCurrentDirectory.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1589
                    nOld ~~ 0 ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1590
                        nOld > 1 ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1591
                            oldSelection do:[:element  |
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1592
                                fileListView addElementToSelection:element
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1593
                            ]
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1594
                        ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1595
                            fileListView selectElementWithoutScroll:oldSelection
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1596
                        ]
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1597
                    ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1598
                ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1599
                    Processor addTimedBlock:checkBlock afterSeconds:checkDelta
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1600
                ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1601
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1602
                currentFileName notNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1603
                    (currentDirectory exists:currentFileName) ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1604
                        newState := ' (removed)'.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1605
                    ] ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1606
                        (currentDirectory timeOfLastChange:currentFileName) > timeOfFileRead ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1607
                            newState := ' (outdated)'.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1608
                            subView modified ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1609
                                newState := ' (modified & outdated)'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1610
                            ]
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1611
                        ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1612
                    ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1613
                ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1614
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1615
            ] ifFalse:[         
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1616
                "
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1617
                 if the directory has been deleted, or is not readable ...
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1618
                "
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1619
                (OperatingSystem isValidPath:here) ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1620
                    msg := 'FileBrowser:\\directory %1 is gone ?!!?'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1621
                ] ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1622
                    msg := 'FileBrowser:\\directory %1 is no longer readable ?!!?'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1623
                ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1624
                self warn:(resources string:msg with:here) withCRs.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1625
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1626
                fileListView contents:nil.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1627
                newLabel := myName , ': directory is gone !!'.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1628
                "/ Processor addTimedBlock:checkBlock afterSeconds:checkDelta
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1629
            ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1630
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1631
            newState notNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1632
                newLabel := myName.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1633
                currentFileName notNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1634
                    newLabel := newLabel , ': ' , currentFileName
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1635
                ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1636
                newLabel := newLabel , newState.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1637
            ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1638
            newLabel notNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1639
                self label:newLabel.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1640
            ]
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1641
        ]
98
claus
parents: 93
diff changeset
  1642
    ]
claus
parents: 93
diff changeset
  1643
!
claus
parents: 93
diff changeset
  1644
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1645
doChangeCurrentDirectoryTo:fileName updateHistory:updateHistory 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1646
    "verify argument is name of a readable & executable directory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1647
     and if so, go there"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1648
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1649
    |msg path idx|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1650
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1651
    self label:myName; iconLabel:myName.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1652
    fileName notNil ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1653
        (currentDirectory isDirectory:fileName) ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1654
            (currentDirectory isReadable:fileName) ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1655
                (currentDirectory isExecutable:fileName) ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1656
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1657
                    path := currentDirectory pathName.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1658
                    previousDirectory := path.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1659
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1660
                    "
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1661
                     remember where we are in the fileList
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1662
                     (in case we want to return)
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1663
                    "
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1664
                    idx := DirectoryHistory indexOf:path.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1665
                    idx ~~ 0 ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1666
                        DirectoryHistoryWhere at:idx put:fileListView firstLineShown
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1667
                    ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1668
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1669
                    self setCurrentDirectory:fileName.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1670
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1671
                    path := currentDirectory pathName.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1672
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1673
                    "
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1674
                     if we have already been there, look for the
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1675
                     position offset, and scroll the fileList
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1676
                    "
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1677
                    idx := DirectoryHistory indexOf:path.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1678
                    idx ~~ 0 ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1679
                        |pos|
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1680
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1681
                        pos := DirectoryHistoryWhere at:idx.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1682
                        pos notNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1683
                            fileListView scrollToLine:pos
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1684
                        ]
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1685
                    ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1686
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1687
                    updateHistory ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1688
                        |pos|
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1689
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1690
                        (DirectoryHistory includes:path) ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1691
                            DirectoryHistory size >= HistorySize ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1692
                                DirectoryHistory removeLast.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1693
                                DirectoryHistoryWhere removeLast
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1694
                            ]
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1695
                        ] ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1696
                            "already been there before; move the entry to
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1697
                             the beginning, so it will fall out later."
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1698
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1699
                            idx := DirectoryHistory indexOf:path.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1700
                            DirectoryHistory removeIndex:idx.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1701
                            pos := DirectoryHistoryWhere at:idx.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1702
                            DirectoryHistoryWhere removeIndex:idx.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1703
                        ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1704
                        DirectoryHistory addFirst:path.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1705
                        DirectoryHistoryWhere addFirst:pos.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1706
                    ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1707
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1708
                    ^ self
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1709
                ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1710
                msg := 'cannot change directory to ''%1'' !!'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1711
            ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1712
                msg := 'cannot read directory ''%1'' !!'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1713
            ]
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1714
        ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1715
            msg := '''%1'' is not a directory !!'
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1716
        ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1717
        self showAlert:(resources string:msg with:fileName) with:nil
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1718
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1719
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1720
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1721
doChangeToHomeDirectory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1722
    "go to home directory"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1723
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1724
    self doChangeCurrentDirectoryTo:(OperatingSystem getHomeDirectory) updateHistory:true
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1725
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1726
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1727
doChangeToParentDirectory
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1728
    "go to home directory"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1729
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1730
    self doChangeCurrentDirectoryTo:'..' updateHistory:true
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1731
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1732
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1733
doCreateDirectory:newName
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1734
    (currentDirectory includes:newName) ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1735
        self warn:'%1 already exists.' with:newName.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1736
        ^ self
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1737
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1738
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1739
    (currentDirectory createDirectory:newName) ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1740
        self updateCurrentDirectory
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1741
    ] ifFalse:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1742
        self showAlert:(resources string:'cannot create directory ''%1'' !!' with:newName)
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1743
                  with:(OperatingSystem lastErrorString)
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1744
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1745
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1746
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1747
doCreateFile:newName
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1748
    |aStream|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1749
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1750
    (currentDirectory includes:newName) ifTrue:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1751
        (self
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1752
            ask:(resources string:'%1 already exists\\truncate ?' with:newName)
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1753
            yesButton:'truncate'
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1754
        ) ifFalse:[^ self].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1755
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1756
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1757
    aStream := FileStream newFileNamed:newName in:currentDirectory.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1758
    aStream notNil ifTrue:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1759
        aStream close.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1760
        self updateCurrentDirectory
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1761
    ] ifFalse:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1762
        self showAlert:(resources string:'cannot create file ''%1'' !!' with:newName)
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1763
                  with:(FileStream lastErrorString)
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1764
    ]
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1765
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1766
    "Modified: 21.2.1996 / 01:24:16 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1767
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1768
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1769
doExecuteCommand:command replace:replace
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1770
    "execute a unix command inserting the output of the command.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1771
     If replace is true, all text is replaced by the commands output;
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1772
     otherwise, its inserted as selected text at the cursor position."
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1773
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1774
    |stream line lnr myProcess myPriority startLine startCol stopSignal
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1775
     access stillReplacing|
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1776
994
1734123c7520 friendly semaphore names
Claus Gittinger <cg@exept.de>
parents: 988
diff changeset
  1777
    access := Semaphore forMutualExclusion name:'accessLock'.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1778
    stopSignal := Signal new.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1779
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1780
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1781
     must take killButton out of my group
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1782
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1783
    windowGroup removeView:killButton.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1784
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1785
     bring it to front, and turn hidden-mode off
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1786
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1787
    killButton raise.
331
a12998c7f3c2 use beVisible / beInvisible
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1788
    killButton beVisible.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1789
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1790
     it will make me raise stopSignal when pressed
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1791
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1792
    killButton 
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1793
        action:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1794
            stream notNil ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1795
                access critical:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1796
                    myProcess interruptWith:[stopSignal raise].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1797
                ]
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1798
            ]
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1799
        ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1800
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1801
     start it up under its own windowgroup
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1802
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1803
    killButton openAutonomous.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1804
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1805
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1806
     go fork a pipe and read it
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1807
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1808
    self label:(myName , ': executing ' , (command copyTo:(20 min:command size)) , ' ...').
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1809
    [
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1810
      self withWaitCursorDo:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1811
        stopSignal catch:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1812
            startLine := subView cursorLine.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1813
            startCol := subView cursorCol.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1814
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1815
            "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1816
             this can be a time consuming operation; therefore lower my priority
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1817
            "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1818
            myProcess := Processor activeProcess.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1819
            myPriority := myProcess priority.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1820
            myProcess priority:(Processor userBackgroundPriority).
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1821
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1822
            stream := PipeStream readingFrom:('cd '
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1823
                                              , currentDirectory pathName
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1824
                                              , '; '
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1825
                                              , command
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1826
                                              , ' 2>&1' ).
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1827
            stream notNil ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1828
                [
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1829
                    |codeView lines|
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1830
729
da2aa1dee58f comment - use buffered Pipe when reading command output
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1831
                    stream buffered:true.
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1832
                    codeView := subView.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1833
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1834
                    replace ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1835
                        codeView list:nil.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1836
                        lnr := 1.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1837
                    ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1838
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1839
                   stillReplacing := replace.
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1840
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1841
                   [stream atEnd] whileFalse:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1842
                        (stream readWaitWithTimeoutMs:50) ifFalse:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1843
                            "
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1844
                             data available; read up to 100 lines
729
da2aa1dee58f comment - use buffered Pipe when reading command output
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1845
                             and insert as a single junk. This speeds up
da2aa1dee58f comment - use buffered Pipe when reading command output
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1846
                             display of long output (less line-scrolling).
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1847
                            "
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1848
                            lines := OrderedCollection new:100.
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1849
                            line := stream nextLine.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1850
                            line notNil ifTrue:[lines add:line].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1851
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1852
                            [stream atEnd not
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1853
                            and:[stream canReadWithoutBlocking
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1854
                            and:[lines size < 100]]] whileTrue:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1855
                                line := stream nextLine.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1856
                                line notNil ifTrue:[lines add:line].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1857
                            ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1858
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1859
                            "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1860
                             need this critical section; otherwise,
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1861
                             we could get the signal while waiting for
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1862
                             an expose event ...
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1863
                            "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1864
                            access critical:[                        
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1865
                                lines size > 0 ifTrue:[
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1866
                                    stillReplacing ifTrue:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1867
                                        lines do:[:line |
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1868
                                            codeView at:lnr put:line withTabsExpanded.
539
33b603dd30ba replaced ColoredListEntry by Text
Claus Gittinger <cg@exept.de>
parents: 525
diff changeset
  1869
                                            codeView cursorToBottom; cursorDown:1.
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1870
                                            lnr := lnr + 1.
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1871
                                            lnr > codeView list size ifTrue:[
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1872
                                                stillReplacing := false
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1873
                                            ]
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1874
                                        ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1875
                                    ] ifFalse:[
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1876
                                        codeView insertLines:lines before:codeView cursorLine.
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1877
                                        codeView cursorDown:lines size.
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1878
                                    ]
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1879
                                ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1880
                            ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1881
                        ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1882
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1883
                        shown ifTrue:[windowGroup processExposeEvents].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1884
                        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1885
                         give others running at same prio a chance too
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1886
                         (especially other FileBrowsers doing the same)
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1887
                        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1888
                        Processor yield
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1889
                    ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1890
                ] valueNowOrOnUnwindDo:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1891
                    stream shutDown "close". stream := nil.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1892
                ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1893
                self updateCurrentDirectory
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1894
            ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1895
            replace ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1896
                subView modified:false.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1897
            ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1898
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1899
      ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1900
    ] valueNowOrOnUnwindDo:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1901
        |wg|
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1902
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1903
        self label:myName; iconLabel:myName.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1904
        myProcess notNil ifTrue:[myProcess priority:myPriority].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1905
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1906
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1907
         remove the killButton from its group
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1908
         (otherwise, it will be destroyed when we shut down the group)
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1909
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1910
        wg := killButton windowGroup.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1911
        killButton windowGroup:nil.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1912
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1913
         shut down the windowgroup
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1914
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1915
        wg notNil ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1916
            wg process terminate.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1917
        ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1918
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1919
         hide the button, and make sure it will stay
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1920
         hidden when we are realized again
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1921
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1922
        killButton beInvisible.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1923
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1924
         clear its action (actually not needed, but
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1925
         releases reference to thisContext earlier)
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1926
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1927
        killButton action:nil.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1928
    ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1929
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1930
    currentFileName isNil ifTrue:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1931
        subView modified:false.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1932
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1933
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1934
    subView size > 10000 ifTrue:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1935
        self warn:'text quite large now - please cut off some lines'
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1936
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1937
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1938
    "Modified: 21.9.1995 / 11:18:46 / claus"
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1939
    "Modified: 11.4.1997 / 14:42:07 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1940
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1941
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  1942
doFileGet:viaDoubleClick
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1943
    "get selected file - show contents in subView"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1944
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1945
    |fileName iconLbl winLbl|
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1946
294
a693bd6d7ae6 read cursor while reading
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1947
    self withReadCursorDo:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1948
        fileName := self getSelectedFileName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1949
        fileName notNil ifTrue:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1950
            (currentDirectory isDirectory:fileName) ifTrue:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1951
                self doChangeCurrentDirectoryTo:fileName updateHistory:true.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1952
                winLbl := myName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1953
                iconLbl := myName
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1954
            ] ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1955
                (currentDirectory exists:fileName) ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1956
                    self warn:(resources string:'oops, ''%1'' is gone' with:fileName).
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1957
                    ^ self
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1958
                ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1959
                timeOfFileRead := currentDirectory timeOfLastChange:fileName.
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  1960
                self showFile:fileName insert:false encoding:fileEncoding doubleClick:viaDoubleClick.
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1961
                currentFileName := fileName.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1962
912
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1963
                self fileTypeSpecificActions.
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1964
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1965
                subView acceptAction:[:theCode |
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1966
                    self withCursor:(Cursor write) do:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1967
                        self writeFile:fileName text:theCode encoding:fileEncoding.
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1968
                        timeOfFileRead := currentDirectory timeOfLastChange:fileName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1969
                        self label:myName , ': ' , currentFileName
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1970
                    ]
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1971
                ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1972
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1973
                winLbl := myName , ': ' , fileName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1974
                (currentDirectory isWritable:fileName) ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1975
                    winLbl := winLbl , ' (readonly)'
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1976
                ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1977
                iconLbl := fileName
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1978
            ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1979
            self label:winLbl.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1980
            self iconLabel:iconLbl.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1981
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1982
    ]
294
a693bd6d7ae6 read cursor while reading
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1983
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  1984
    "Created: 19.6.1996 / 09:39:07 / cg"
912
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1985
    "Modified: 7.1.1997 / 20:21:44 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1986
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1987
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1988
doRemove
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1989
    "remove the selected file(s) - no questions asked"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1990
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1991
    |ok msg dir idx needUpdate toRemove updateRunning|
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1992
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1993
    updateRunning := listUpdateProcess notNil.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1994
    self stopUpdateProcess.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1995
    toRemove := OrderedCollection new.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1996
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1997
    "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1998
    "/ did the directory change in the meanwhile ?
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1999
    "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2000
    needUpdate := (currentDirectory timeOfLastChange > timeOfLastCheck).
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2001
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2002
    lockUpdate := true.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2003
    [
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2004
        self selectedFilesDo:[:fileName |
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2005
            ok := false.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2006
            (currentDirectory isDirectory:fileName) ifTrue:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2007
                dir := FileDirectory directoryNamed:fileName in:currentDirectory.
967
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2008
                dir isEmpty ifTrue:[
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2009
                    ok := currentDirectory removeDirectory:fileName
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2010
                ] ifFalse:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2011
                    (self 
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2012
                        ask:(resources string:'directory ''%1'' is not empty\remove anyway ?' with:fileName)
967
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2013
                        yesButton:'remove')
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2014
                    ifFalse:[
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2015
                        ^ self
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2016
                    ].
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2017
                    ok := currentDirectory removeDirectory:fileName
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2018
                ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2019
            ] ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2020
                ok := currentDirectory remove:fileName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2021
            ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2022
            ok ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2023
                "was not able to remove it"
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2024
                msg := (resources string:'cannot remove ''%1'' !!' with:fileName).
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2025
                self showAlert:msg with:(OperatingSystem lastErrorString)
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2026
            ] ifTrue:[
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2027
"
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2028
                self show:nil
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2029
"
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2030
                idx := fileList indexOf:fileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2031
                idx ~~ 0 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2032
                    toRemove add:idx.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2033
                ]
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2034
            ]
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2035
        ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2036
    ] valueNowOrOnUnwindDo:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2037
        lockUpdate := false.
564
28b766ce6ec5 selection: / setSelection:
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2038
        fileListView setSelection:nil.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2039
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2040
        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2041
        "/ remove reverse - otherwise indices are wrong
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2042
        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2043
        toRemove sort.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2044
        toRemove reverseDo:[:idx |
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2045
            fileList removeIndex:idx.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2046
            fileListView removeIndex:idx.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2047
        ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2048
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2049
        updateRunning ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2050
            self updateCurrentDirectory
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2051
        ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2052
            "
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2053
             install a new check after some time
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2054
            "
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2055
            needUpdate ifFalse:[timeOfLastCheck := AbsoluteTime now].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2056
            Processor addTimedBlock:checkBlock afterSeconds:checkDelta
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2057
        ]
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2058
    ]
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2059
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2060
    "Modified: 19.4.1997 / 14:03:55 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2061
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2062
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2063
doRename:oldName to:newName
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2064
    (oldName notNil and:[newName notNil]) ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2065
        (oldName isBlank or:[newName isBlank]) ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2066
            currentDirectory renameFile:oldName newName:newName.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2067
            self updateCurrentDirectory.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2068
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2069
    ]
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2070
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2071
912
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2072
fileCommentStrings
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2073
    "return useful comment definition; based upon the fileName for now"
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2074
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2075
    "/ for now,
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2076
    "/ define comment strings, by heuristics;
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2077
    "/ (should look for some mode= or similar string
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2078
    "/  found in the file itself - like emacs does it)
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2079
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2080
    (currentFileName = 'Make.proto'
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2081
    or:[currentFileName = 'Makefile'
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2082
    or:[currentFileName = 'makefile']]) ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2083
        ^ #('#' (nil nil)).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2084
    ].
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2085
    ((currentFileName endsWith:'.c')
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2086
    or:[(currentFileName endsWith:'.C')]) ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2087
        ^ #(nil ('/*' '*/')).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2088
    ].
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2089
    ((currentFileName endsWith:'.cc')
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2090
    or:[(currentFileName endsWith:'.CC')]) ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2091
        ^ #('//' ('/*' '*/')).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2092
    ].
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2093
    (currentFileName endsWith:'.java') ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2094
        ^ #('//' (nil nil)).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2095
    ].
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2096
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2097
    "/ smalltalk comments
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2098
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2099
    ^ #('"/' ('"' '"')).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2100
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2101
    "Created: 7.1.1997 / 20:30:00 / cg"
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2102
!
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2103
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2104
fileTypeSpecificActions
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2105
    "any special fileTypeSpecific actions are done here,
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2106
     when a new file is selected"
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2107
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2108
    |commentStrings|
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2109
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2110
    commentStrings := self fileCommentStrings.
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2111
    commentStrings notNil ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2112
        subView
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2113
            commentStrings:#('#' (nil nil)).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2114
    ].
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2115
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2116
    "Modified: 7.1.1997 / 20:30:54 / cg"
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2117
!
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2118
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2119
getFileInfoString:longInfo
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2120
    "get stat info on selected file - return a string which can be
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2121
     shown in a box"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2122
133
claus
parents: 132
diff changeset
  2123
    |fileName f fullPath text info fileOutput type modeBits modeString s ts|
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2124
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2125
    fileName := self getSelectedFileName.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2126
    fileName isNil ifTrue:[^ nil].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2127
133
claus
parents: 132
diff changeset
  2128
    f := currentDirectory pathName asFilename construct:fileName.
claus
parents: 132
diff changeset
  2129
    info := f info.
claus
parents: 132
diff changeset
  2130
claus
parents: 132
diff changeset
  2131
"/    info := currentDirectory infoOf:fileName.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2132
    info isNil ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2133
        self showAlert:(resources string:'cannot get info of ''%1'' !!' with:fileName)
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2134
                  with:(OperatingSystem lastErrorString).
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2135
        ^ nil
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2136
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2137
59
d8ff572dd357 Text eliminated
claus
parents: 58
diff changeset
  2138
    text := StringCollection new.
133
claus
parents: 132
diff changeset
  2139
    f isSymbolicLink ifTrue:[
831
61bc793bfcd8 changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2140
        text add:(resources string:'symbolic link to: %1' with:(f linkInfo path))
133
claus
parents: 132
diff changeset
  2141
    ].
claus
parents: 132
diff changeset
  2142
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2143
    type := info type.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2144
    (longInfo and:[type == #regular]) ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2145
        fullPath := currentDirectory pathName , '/' , fileName.
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2146
        fileOutput := fullPath asFilename fileType.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2147
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2148
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2149
    s := (resources at:'type:   ').
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2150
    fileOutput isNil ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2151
        s := s ,  type asString
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2152
    ] ifFalse:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2153
        s := s , 'regular (' , fileOutput , ')'
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2154
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2155
    text add:s.
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2156
    text add:(resources string:'size:   %1' with:(info size) printString).
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2157
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2158
    modeBits := info mode.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2159
    modeString := self getModeString:modeBits.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2160
    longInfo ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2161
        text add:(resources string:'access: %1 (%2)'
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2162
                              with:modeString 
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2163
                              with:(modeBits printStringRadix:8))
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2164
    ] ifFalse:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2165
        text add:(resources string:'access: %1' with:modeString)
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2166
    ].
133
claus
parents: 132
diff changeset
  2167
    text add:(resources string:'owner:  %1'
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2168
                          with:(OperatingSystem getUserNameFromID:(info uid))).
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2169
    longInfo ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2170
        text add:(resources string:'group:  %1'
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2171
                              with:(OperatingSystem getGroupNameFromID:(info gid))).
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2172
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2173
        ts := info accessed.
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2174
        text add:(resources string:'last access:       %1 %2' 
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2175
                              with:(ts asTime printString)
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2176
                              with:(ts asDate printString)).
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2177
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2178
        ts := info modified.
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2179
        text add:(resources string:'last modification: %1 %2'
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2180
                              with:(ts asTime printString)
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2181
                              with:(ts asDate printString)).
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2182
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2183
    ^ text asString
133
claus
parents: 132
diff changeset
  2184
claus
parents: 132
diff changeset
  2185
    "Modified: 8.9.1995 / 11:59:28 / claus"
831
61bc793bfcd8 changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2186
    "Modified: 1.11.1996 / 20:47:52 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2187
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2188
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2189
getInfoFile
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2190
    "get filename of a description-file (.dir.info, README etc.);
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2191
     This file is automatically shown when a directory is enterred.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2192
     You can add more names below if you like."
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2193
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2194
    #( '.dir.info'
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2195
       'README'
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2196
       'ReadMe'
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2197
       'Readme'
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2198
       'readme' 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2199
    ) do:[:f |
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2200
        (currentDirectory isReadable:f) ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2201
            (currentDirectory isDirectory:f) ifFalse:[^ f].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2202
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2203
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2204
    ^ nil
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2205
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2206
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2207
getModeString:modeBits
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2208
    "convert file-mode bits into a more user-friendly string.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2209
     This is wrong here - should be moved into OperatingSystem."
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2210
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2211
    ^ self getModeString:modeBits 
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2212
                    with:#( 'owner:' $r $w $x 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2213
                            ' group:' $r $w $x 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2214
                            ' others:' $r $w $x )
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2215
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2216
37
50f59bad66b1 *** empty log message ***
claus
parents: 36
diff changeset
  2217
getModeString:modeBits with:texts
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2218
    "convert file-mode bits into a more user-friendly string.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2219
     This is wrong here - should be moved into OperatingSystem."
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2220
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2221
    |bits modeString|
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2222
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2223
    bits := modeBits bitAnd:8r777.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2224
    modeString := ''.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2225
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2226
    #( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) 
37
50f59bad66b1 *** empty log message ***
claus
parents: 36
diff changeset
  2227
    with: texts do:[:bitMask :access |
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2228
        |ch|
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2229
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2230
        bitMask isNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2231
            modeString := modeString , (resources string:access)
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2232
        ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2233
            (bits bitAnd:bitMask) == 0 ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2234
                ch := $-
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2235
            ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2236
                ch := access
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2237
            ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2238
            modeString := modeString copyWith:ch 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2239
        ]
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2240
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2241
    ^ modeString
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2242
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2243
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2244
getSelectedFileName
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2245
    "returns the currently selected file; shows an error if
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2246
     multiple files are selected"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2247
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2248
    |sel|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2249
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2250
    sel := fileListView selection.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2251
    (sel size > 1) ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2252
        self onlyOneSelection
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2253
    ] ifFalse:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2254
        sel notNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2255
            ^ fileList at:sel first
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2256
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2257
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2258
    ^ nil
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2259
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2260
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2261
guessEncodingFrom:aBuffer
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2262
    "look for a string
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2263
        encoding #name
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2264
     or:
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2265
        encoding: name
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2266
     within the given buffer (which is usually the first few
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2267
     bytes of a textFile"
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2268
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2269
    |n "{Class: SmallInteger }"
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2270
     binary idx s w w2|
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2271
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2272
    binary := false.
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2273
    n := aBuffer size.
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2274
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2275
    (idx := aBuffer findString:'encoding') ~~ 0 ifTrue:[
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2276
        s := ReadStream on:aBuffer.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2277
        s position:idx + 8.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2278
        s skipSeparators.
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2279
        s peek == $: ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2280
            s next.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2281
            s skipSeparators. 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2282
        ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2283
            s peek == $# ifTrue:[s next].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2284
        ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2285
        w := s upToSeparator.
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2286
        w notNil ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2287
            ^ w asSymbol
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2288
        ].
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2289
    ].
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2290
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2291
    1 to:n do:[:i |
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2292
        (aBuffer at:i) isPrintable ifFalse:[binary := true].
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2293
    ].
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2294
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2295
    binary ifTrue:[
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2296
        "/ look for JIS7 / EUC encoding
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2297
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2298
        (aBuffer findString:(JISEncodedString jis7KanjiEscapeSequence)) ~~ 0 ifTrue:[
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2299
            ^ #jis7
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2300
        ].
396
e5777391727e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  2301
        (aBuffer findString:(JISEncodedString oldJis7KanjiEscapeSequence)) ~~ 0 ifTrue:[
e5777391727e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  2302
            ^ #jis7
e5777391727e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  2303
        ].
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2304
        ^ #binary
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2305
    ].
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2306
    ^ #ascii
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2307
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2308
    "Created: 26.2.1996 / 17:43:08 / cg"
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2309
    "Modified: 23.1.1997 / 20:39:25 / cg"
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2310
!
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2311
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2312
initialCommandFor:fileName into:aBox
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2313
    "set a useful initial command for execute box."
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2314
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2315
    |lcFilename cmd select|
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2316
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2317
    "/ XXX should be changed to take stuff from a config file
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2318
    "/ XXX or from resources.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2319
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2320
    ((currentDirectory typeOf:fileName) == #regular) ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2321
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2322
        (currentDirectory isExecutable:fileName) ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2323
            aBox initialText:(fileName , ' <arguments>').
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2324
            ^ self
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2325
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2326
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2327
        lcFilename := fileName asLowercase.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2328
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2329
        select := true.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2330
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2331
        "some heuristics - my personal preferences ...
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2332
         (actually this should come from a configfile)"
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2333
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2334
        (fileName endsWith:'akefile') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2335
            aBox initialText:'make target' selectFrom:6 to:11.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2336
            ^ self
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2337
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2338
        (lcFilename endsWith:'tar.z') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2339
            cmd := 'zcat %1 | tar tvf -'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2340
            select := false.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2341
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2342
        (fileName endsWith:'.taz') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2343
            aBox initialText:'zcat %1 | tar tvf -'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2344
            select := false.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2345
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2346
        (fileName endsWith:'.tar') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2347
            cmd := 'tar tvf %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2348
            select := 7.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2349
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2350
        (fileName endsWith:'.zoo') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2351
            cmd := 'zoo -list %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2352
            select := 9.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2353
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2354
        (lcFilename endsWith:'.zip') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2355
            cmd := 'unzip -l %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2356
            select := 8.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2357
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2358
        (lcFilename endsWith:'.z') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2359
            cmd := 'uncompress %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2360
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2361
        (fileName endsWith:'tar.gz') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2362
            cmd := ('gunzip < %1 | tar tvf -' ).
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2363
            select := false.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2364
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2365
        (fileName endsWith:'.tgz') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2366
            cmd := ('gunzip < %1 | tar tvf -' ).
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2367
            select := false.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2368
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2369
        (fileName endsWith:'.gz') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2370
            cmd := 'gunzip %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2371
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2372
        (lcFilename endsWith:'.html') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2373
            cmd := 'netscape %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2374
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2375
        (lcFilename endsWith:'.htm') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2376
            cmd := 'netscape %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2377
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2378
        (fileName endsWith:'.uue') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2379
            cmd := 'uudecode %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2380
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2381
        (fileName endsWith:'.c') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2382
            cmd := 'cc -c %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2383
            select := 5.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2384
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2385
        (fileName endsWith:'.cc') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2386
            cmd := 'g++ -c %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2387
            select := 6.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2388
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2389
        (fileName endsWith:'.C') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2390
            cmd := 'g++ -c %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2391
            select := 6.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2392
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2393
        (fileName endsWith:'.xbm') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2394
            cmd := 'bitmap %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2395
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2396
        (lcFilename endsWith:'.ps') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2397
            cmd := 'ghostview %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2398
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2399
        ((fileName endsWith:'.1') 
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2400
        or:[fileName endsWith:'.man']) ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2401
            cmd := 'nroff -man %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2402
            select := 10.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2403
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2404
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2405
        cmd isNil ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2406
            DefaultCommandPerSuffix isNil ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2407
                cmd := '<cmd>'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2408
            ] ifFalse:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2409
                cmd := DefaultCommandPerSuffix 
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2410
                        at:(lcFilename asFilename suffix)
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2411
                        ifAbsent:'<cmd>'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2412
            ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2413
            cmd := cmd , ' %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2414
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2415
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2416
        cmd := cmd bindWith:fileName.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2417
        select == false ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2418
            aBox initialText:cmd
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2419
        ] ifFalse:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2420
            select isInteger ifFalse:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2421
                select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2422
            ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2423
            aBox initialText:cmd selectFrom:1 to:select
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2424
        ]
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2425
    ]
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2426
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2427
    "Modified: 4.4.1997 / 12:26:40 / cg"
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2428
!
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2429
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2430
onlyOneSelection
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2431
    "show a warning, that only one file must be selected for
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2432
     this operation"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2433
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2434
    self warn:'exactly one file must be selected !!'
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2435
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2436
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2437
selectedFilesDo:aBlock
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2438
    "evaluate aBlock on all selected files;
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2439
     show a wait cursor while doing this"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2440
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2441
    |sel|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2442
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2443
    sel := fileListView selection.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2444
    sel notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2445
        self withWaitCursorDo:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2446
            sel do:[:aSelectionIndex |
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2447
                aBlock value:(fileList at:aSelectionIndex )
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2448
            ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2449
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2450
    ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2451
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2452
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2453
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2454
setCurrentDirectory:aPathName
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2455
    "setup for another directory"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2456
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2457
    |newDirectory|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2458
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2459
    aPathName isEmpty ifTrue:[^ self].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2460
    (currentDirectory isDirectory:aPathName) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2461
        newDirectory := FileDirectory directoryNamed:aPathName in:currentDirectory.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2462
        newDirectory notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2463
            self currentDirectory:newDirectory pathName.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2464
            currentFileName notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2465
                fileListView contents:nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2466
                currentFileName := nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2467
            ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2468
                fileListView setSelection:nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2469
                fileListView scrollToTop.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2470
            ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2471
            self updateCurrentDirectory.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2472
            self showInfo.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2473
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2474
    ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2475
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2476
    "Modified: 21.9.1995 / 11:22:45 / claus"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2477
    "Modified: 25.5.1996 / 12:27:01 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2478
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2479
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2480
show:something
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2481
    "show something in subview and undef acceptAction"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2482
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2483
    subView contents:something.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2484
    subView acceptAction:nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2485
    subView modified:false.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2486
    currentFileName := nil
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2487
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2488
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2489
showAlert:aString with:anErrorString
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2490
    "show an alertbox, displaying the last Unix-error"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2491
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2492
    |msg|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2493
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2494
    anErrorString isNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2495
        msg := aString
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2496
    ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2497
        msg := aString , '\\(' , anErrorString , ')'
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2498
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2499
    self warn:msg withCRs
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2500
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2501
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2502
showInfo
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2503
    "show directory info when dir has changed"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2504
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2505
    |info txt|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2506
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2507
    info := self getInfoFile.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2508
    info notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2509
        txt := self readFile:info
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2510
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2511
    self show:txt.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2512
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2513
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2514
sizePrintString:size
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2515
    "helper for update-directory to return a string with a files size.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2516
     This one gives the size in byte, Kb or Mb depending on size.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2517
     If you dont like this, just uncomment the first statement below."
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2518
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2519
    |unitString n|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2520
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2521
"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2522
    ^ size printString.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2523
"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2524
    unitString := ''.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2525
    size < (500 * 1024) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2526
        size < 1024 ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2527
            n := size
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2528
        ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2529
            n := (size * 10 // 1024 / 10.0).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2530
            unitString := ' Kb'
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2531
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2532
    ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2533
        n := (size * 10 // 1024 // 1024 / 10.0).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2534
        unitString := ' Mb'
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2535
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2536
    ^ (n printStringLeftPaddedTo:5) , unitString.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2537
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2538
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2539
validateFontEncodingFor:newEncoding ask:ask
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2540
    "if required, query user if he/she wants to change to another font,
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2541
     which is able to display text encoded as specified by newEncoding"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2542
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2543
    |fontsEncoding msg filter f defaultFont|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2544
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2545
    fontsEncoding := subView font encoding.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2546
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2547
    ((newEncoding == #jis7) or:[newEncoding == #euc]) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2548
        (fontsEncoding notNil and:[fontsEncoding startsWith:'jis']) ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2549
            msg := 'switch to a JIS encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2550
            filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2551
                            (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2552
                            and:['jis*' match:coding]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2553
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2554
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2555
    (newEncoding == #gb) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2556
        (fontsEncoding notNil and:[fontsEncoding startsWith:'gb']) ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2557
            msg := 'switch to a GB encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2558
            filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2559
                            (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2560
                            and:['gb*' match:coding]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2561
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2562
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2563
    (newEncoding == #big5) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2564
        (fontsEncoding notNil and:[fontsEncoding startsWith:'big5']) ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2565
            msg := 'switch to a BIG-5 encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2566
            filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2567
                            (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2568
                            and:['big5*' match:coding]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2569
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2570
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2571
    (newEncoding == #ksc) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2572
        (fontsEncoding notNil and:[fontsEncoding startsWith:'ksc']) ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2573
            msg := 'switch to a KSC encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2574
            filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2575
                            (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2576
                            and:['ksc*' match:coding]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2577
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2578
    ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2579
        fontsEncoding notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2580
            ((fontsEncoding startsWith:'jis')
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2581
            or:[(fontsEncoding startsWith:'gb')
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2582
            or:[(fontsEncoding startsWith:'ksc')
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2583
            or:[(fontsEncoding startsWith:'big5')]]])
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2584
            ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2585
                msg := 'switch back to an ASCII encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2586
                filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2587
                                (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2588
                                and:[('ascii' match:coding)
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2589
                                     or:['iso*' match:coding]]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2590
                defaultFont := TextView defaultFont
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2591
            ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2592
                (fontsEncoding notNil and:[fontsEncoding startsWith:'iso8859']) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2593
                    msg := 'switch to a ''' , newEncoding , ''' encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2594
                    filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2595
                                    (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2596
                                    and:[newEncoding asLowercase = coding asLowercase]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2597
                ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2598
            ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2599
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2600
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2601
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2602
    msg isNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2603
        "/ mhmh - can be represented in current font
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2604
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2605
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2606
    msg notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2607
        defaultFont isNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2608
            defaultFont := device 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2609
                                listOfAvailableFonts 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2610
                                    detect:[:f | filter value:f]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2611
                                    ifNone:nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2612
            defaultFont isNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2613
                self warn:'your display does not seem to provide any ' , newEncoding , '-encoded font.'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2614
                ^ self.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2615
            ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2616
        ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2617
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2618
        (ask not or:[self confirm:(resources string:msg) withCRs])
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2619
        ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2620
            f := FontPanel 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2621
                fontFromUserInitial:defaultFont
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2622
                              title:(resources string:'font selection')
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2623
                             filter:filter.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2624
            f notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2625
                subView font:f
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2626
            ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2627
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2628
    ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2629
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2630
    "Created: 26.10.1996 / 12:06:54 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2631
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2632
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2633
withoutHiddenFiles:aCollection
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2634
    "remove hidden files (i.e. those that start with '.') from
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2635
     the list in aCollection"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2636
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2637
    |newCollection|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2638
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2639
    newCollection := aCollection species new.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2640
    aCollection do:[:fname |
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2641
        |ignore|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2642
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2643
        ignore := false.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2644
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2645
        ((fname startsWith:'.') and:[fname ~= '..']) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2646
            showDotFiles ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2647
                ignore := true
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2648
            ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2649
        ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2650
        ignore ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2651
            newCollection add:fname
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2652
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2653
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2654
    ^ newCollection
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2655
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2656
    "Modified: 21.2.1996 / 01:33:18 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2657
! !
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2658
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2659
!FileBrowser methodsFor:'private - actions'!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2660
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2661
binaryFileAction:aFilename
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2662
    "for some binary files, if double clicked, we can do some useful
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2663
     action ..."
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2664
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2665
    (currentDirectory pathName , '/' , aFilename) asFilename isExecutable ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2666
        (OperatingSystem executeCommand:'cd ',currentDirectory pathName, '; ',aFilename)
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2667
        ifTrue:[^true].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2668
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2669
    ^ self imageAction:aFilename
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2670
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2671
    "Modified: 19.6.1996 / 09:44:07 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2672
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2673
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2674
imageAction:aFilename
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2675
    "for some image files, if double clicked, we can do some useful
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2676
     action ..."
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2677
1025
d6ee5f738d94 ask image suffix table for imageAction
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  2678
    |img|
d6ee5f738d94 ask image suffix table for imageAction
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  2679
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2680
    (Image isImageFileSuffix:(aFilename asFilename suffix))
1025
d6ee5f738d94 ask image suffix table for imageAction
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  2681
    ifTrue:[
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2682
        img := Image fromFile:(currentDirectory pathName , '/' , aFilename).
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2683
        img notNil ifTrue:[
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2684
            img inspect.
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2685
            ^ true
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2686
        ]
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2687
    ].
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2688
    ^ false
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2689
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2690
    "Created: 19.6.1996 / 09:43:50 / cg"
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2691
    "Modified: 18.4.1997 / 14:56:04 / cg"
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2692
!
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2693
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2694
nonBinaryFileAction:aFilename
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2695
    "for some nonBinary files, if double clicked, we can do some useful
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2696
     action ..."
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2697
1111
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2698
    |fullPath lcName|
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2699
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2700
    fullPath := currentDirectory pathName , '/' , aFilename.
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2701
    lcName := aFilename asLowercase.
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2702
    ((lcName endsWith:'.htm') or:[lcName endsWith:'.html']) ifTrue:[
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2703
        HTMLDocumentView openOn:fullPath.
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2704
        ^ true
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2705
    ].
1111
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2706
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2707
    OperatingSystem isUNIXlike ifTrue:[
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2708
        (#('.man' '.1' '.2' '.3') findFirst:[:suff | aFilename endsWith:suff]) ~~ 0 
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2709
        ifTrue:[
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2710
             HTMLDocumentView openFullOnText:(HTMLDocGenerator manPageForFile:fullPath).
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2711
            ^ true
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2712
        ]
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2713
    ].
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2714
    ^ self imageAction:aFilename
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2715
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2716
    "Created: 19.6.1996 / 09:36:38 / cg"
1111
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2717
    "Modified: 4.4.1997 / 10:49:00 / cg"
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2718
! !
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2719
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2720
!FileBrowser methodsFor:'private - presentation'!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2721
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2722
defineTabulatorsForLongList
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2723
    "define the tabs for the long list"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2724
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2725
    tabSpec := TabulatorSpecification new.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2726
    tabSpec unit:#inch.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2727
"/  tabSpec positions:#(0     0.25    2.3   4.3    5.3    6.0      6.5).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2728
    tabSpec widths:   #(0.25   2      2.0     1      0.5  0.5      1"any").
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2729
    "                   icon  name   mode  owner  group  size     type"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2730
    tabSpec align:    #(#left #left  #left #right #right #decimal #left).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2731
    tabSpec addDependent:self.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2732
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2733
    tabRulerView tabulatorSpecification:tabSpec.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2734
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2735
    "Modified: 17.4.1997 / 02:56:07 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2736
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2737
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2738
defineTabulatorsForShortList
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2739
    "define the tabs for the short list"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2740
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2741
    tabSpec := TabulatorSpecification new.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2742
    tabSpec unit:#inch.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2743
"/  tabSpec positions:#(0     0.25 ).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2744
    tabSpec widths:   #(0.25   2   ).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2745
    "                   icon  name"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2746
    tabSpec align:    #(#left #left).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2747
    tabSpec addDependent:self.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2748
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2749
    tabRulerView tabulatorSpecification:tabSpec.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2750
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2751
    "Created: 17.4.1997 / 02:51:41 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2752
    "Modified: 17.4.1997 / 02:55:17 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2753
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2754
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2755
iconForFile:aFilenameString
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2756
    "given a fileName, return an appropriate icon"
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2757
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2758
    |f suff i key|
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2759
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2760
    f := currentDirectory asFilename construct:aFilenameString.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2761
    f isDirectory ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2762
        f isSymbolicLink ifTrue:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2763
            key := #directoryLink
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2764
        ] ifFalse:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2765
            key := #directory
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2766
        ]
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2767
    ] ifFalse:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2768
        f isSymbolicLink ifTrue:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2769
            key := #fileLink
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2770
        ] ifFalse:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2771
            key := #file.
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2772
            (Image isImageFileSuffix:(f suffix)) ifTrue:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2773
                key := #imageFile
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2774
            ].
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2775
        ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2776
    ].
1141
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2777
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2778
    icons isNil ifTrue:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2779
        icons := IdentityDictionary new
1141
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2780
    ].
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2781
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2782
    i := icons at:key ifAbsent:nil.
1141
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2783
    i isNil ifTrue:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2784
        i := Icons at:key ifAbsent:nil.
1144
6bd7e0d7ca07 handle non-existent icons case
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
  2785
        i notNil ifTrue:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2786
            i := i on:device.
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2787
            icons at:key put:i.
1144
6bd7e0d7ca07 handle non-existent icons case
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
  2788
        ]
1141
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2789
    ].
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2790
    ^ i
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2791
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2792
    "Modified: 18.4.1997 / 15:18:38 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2793
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2794
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2795
stopUpdateProcess
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2796
    Processor removeTimedBlock:checkBlock.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2797
    listUpdateProcess notNil ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2798
        listUpdateProcess terminate.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2799
        listUpdateProcess := nil.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2800
    ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2801
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2802
    "Created: 19.4.1997 / 13:51:34 / cg"
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2803
!
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2804
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2805
updateCurrentDirectory
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2806
    "update listView with directory contents"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2807
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2808
    "the code below may look somewhat complex -
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2809
     it reads the directory first for the names,
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2810
     then (in followup sweeps over the files) gets the
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2811
     files type, info and icon in a forked subprocess. 
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2812
     This makes the Filebrowsers list update faster, since the fileInfo 
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2813
     (i.e. stat-calls) may take long - especially on NFS-mounted directories.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2814
     The file reading is done at lower priority, to let user continue
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2815
     his work in other views. However, to be fair to other fileBrowser,
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2816
     which may also read directories at low prio, give up the processor
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2817
     after every entry. This shares the cpu among all fileBrowsers;
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2818
     Therefore, browsers which read short directories will finish first.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2819
     ST/X users love this behavior ;-)
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2820
    "
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2821
294
a693bd6d7ae6 read cursor while reading
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  2822
    self withReadCursorDo:[
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2823
        |files matchPattern|
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2824
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2825
        self stopUpdateProcess.
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2826
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2827
        timeOfLastCheck := AbsoluteTime now.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2828
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2829
        files := currentDirectory asOrderedCollection.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2830
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2831
        "/ show files which are either directories
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2832
        "/ or match the current pattern
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2833
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2834
        matchPattern := filterField contents.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2835
        (matchPattern notNil and:[
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2836
         matchPattern isEmpty not and:[
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2837
         matchPattern ~= '*']]) ifTrue:[
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2838
             files := files select:[:aName | 
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2839
                         ((currentDirectory typeOf:aName) == #directory)
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2840
                         or:[matchPattern compoundMatch:aName]
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2841
                      ].
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2842
        ].
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2843
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2844
        files sort.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2845
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2846
        files size == 0 ifTrue:[
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2847
            self information:('directory ', currentDirectory pathName, ' vanished').
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2848
            ^ self
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2849
        ].
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2850
        files := self withoutHiddenFiles:files.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2851
        fileList := files copy.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2852
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2853
        "
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2854
         this is a time consuming operation (especially, if reading an
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2855
         NFS-mounted directory); therefore, start a low prio process,
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2856
         which fills in the remaining fields in the fileList ...
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2857
        "
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2858
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2859
        listUpdateProcess := [
1154
c02ebe91ba11 nameStrng bug
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
  2860
            |prevUid prevGid fileNameString nameString groupString 
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2861
             modeString info line len list
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2862
             anyImages passDone lineIndex aFileName
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2863
             entry typ f p typeString done endIndex 
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2864
             state stopAtEnd nextState img prevFirstLine prevLastLine
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2865
             numVisible|
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2866
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2867
            tabSpec isNil ifTrue:[
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2868
                showLongList ifTrue:[
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2869
                    self defineTabulatorsForLongList
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2870
                ] ifFalse:[
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2871
                    self defineTabulatorsForShortList
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2872
                ].
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2873
            ].
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2874
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2875
            "/
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2876
            "/ first show all the names - this can be done fast ...
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2877
            "/
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2878
            list := files collect:[:fileName |
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2879
                        |entry|
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2880
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2881
                        entry := MultiColListEntry new.
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2882
                        entry tabulatorSpecification:tabSpec.
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2883
                        entry colAt:1 put:nil.
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2884
                        entry colAt:2 put:fileName.
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2885
                    ].
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2886
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2887
            fileListView setList:list expandTabs:false.
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2888
            passDone := Array new:list size withAll:0.
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2889
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2890
            "/
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2891
            "/ then walk over the files, adding more info
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2892
            "/ (since we have to stat each file, this may take a while longer)
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2893
            "/ Visible items are always filled first.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2894
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2895
            "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2896
            "/ the state machine
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2897
            "/
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2898
            nextState := IdentityDictionary new.
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2899
            showLongList ifTrue:[
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2900
                nextState add:(#visibleIcons -> #visibleAttributes).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2901
                nextState add:(#visibleAttributes -> #visibleTypes).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2902
                nextState add:(#visibleTypes -> #visibleImages).
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2903
                nextState add:(#visibleImages -> #nextPageIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2904
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2905
                nextState add:(#nextPageIcons -> #nextPageAttributes).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2906
                nextState add:(#nextPageAttributes -> #nextPageTypes).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2907
                nextState add:(#nextPageTypes -> #nextPageImages).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2908
                nextState add:(#nextPageImages -> #previousPageIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2909
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2910
                nextState add:(#previousPageIcons -> #previousPageAttributes).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2911
                nextState add:(#previousPageAttributes -> #previousPageTypes).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2912
                nextState add:(#previousPageTypes -> #previousPageImages).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2913
                nextState add:(#previousPageImages -> #remainingIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2914
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2915
                nextState add:(#remainingIcons -> #remainingAttributes).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2916
                nextState add:(#remainingAttributes -> #remainingTypes).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2917
                nextState add:(#remainingTypes -> #remainingImages).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2918
                nextState add:(#remainingImages -> nil).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2919
            ] ifFalse:[
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2920
                nextState add:(#visibleIcons -> #nextPageIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2921
                nextState add:(#nextPageIcons -> #previousPageIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2922
                nextState add:(#previousPageIcons -> #remainingIcons).
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2923
                nextState add:(#remainingIcons -> nil).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2924
            ].
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2925
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2926
            anyImages := false.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2927
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2928
            lineIndex := prevFirstLine := fileListView firstLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2929
            endIndex := prevLastLine := fileListView lastLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2930
            endIndex := endIndex min:(files size).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2931
            state := #visibleIcons.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2932
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2933
            done := false.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2934
            [done] whileFalse:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2935
                "/
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2936
                "/ if multiple FileBrowsers are reading, let others
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2937
                "/ make some progress too
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2938
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2939
                Processor yield.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2940
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2941
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2942
                "/ could be destroyed in the meanwhile ...
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2943
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2944
                realized ifFalse:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2945
                    listUpdateProcess := nil.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2946
                    Processor activeProcess terminate
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2947
                ].
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2948
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2949
                ((prevFirstLine ~~ fileListView firstLineShown)
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2950
                or:[prevLastLine ~~ fileListView lastLineShown]) ifTrue:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2951
                    "/ start all over again
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2952
                    lineIndex := prevFirstLine := fileListView firstLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2953
                    endIndex := prevLastLine := fileListView lastLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2954
                    endIndex := endIndex min:(files size).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2955
                    state := #visibleIcons.
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2956
                ].
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2957
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2958
                (lineIndex between:1 and:(files size)) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2959
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2960
                    "/
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2961
                    "/ expand the next entry ...
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2962
                    "/
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2963
                    aFileName := files at:lineIndex.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2964
                    entry := fileListView at:lineIndex.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2965
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2966
                    (state endsWith:'Icons') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2967
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2968
                        "/ pass 1 - icons
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2969
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2970
                        (passDone at:lineIndex) < 1 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2971
                            ((currentDirectory isDirectory:aFileName) and:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2972
                            (aFileName ~= '..') and:[aFileName ~= '.']]) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2973
                                fileNameString := aFileName , ' ...'
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2974
                            ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2975
                                fileNameString := aFileName
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2976
                            ].
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2977
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2978
                            showLongList ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2979
                                len := fileNameString size.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2980
                                (len > 20) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2981
                                    fileNameString := (fileNameString contractTo:20)
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2982
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2983
                            ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2984
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2985
                            entry colAt:1 put:(self iconForFile:aFileName).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2986
                            entry colAt:2 put:fileNameString.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2987
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2988
                            fileListView at:lineIndex put:entry.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2989
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2990
                            anyImages ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2991
                                (Image isImageFileSuffix:(aFileName asFilename suffix))
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2992
                                ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2993
                                    anyImages := true
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2994
                                ]
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2995
                            ].
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2996
                            passDone at:lineIndex put:1
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2997
                        ]
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2998
                    ].
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2999
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3000
                    (state endsWith:'Attributes') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3001
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3002
                        "/ pass 2 - everything except fileType (which takes very long)
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3003
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3004
                        (passDone at:lineIndex) < 2 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3005
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3006
                            info := currentDirectory infoOf:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3007
                            info isNil ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3008
                                "not accessable - usually a symlink,
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3009
                                 to a nonexisting/nonreadable file
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3010
                                "
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3011
                                entry colAt:7 put:'(bad symbolic link ?)'.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3012
                            ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3013
                                typ := (info type).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3014
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3015
                                modeString := self getModeString:(info at:#mode)
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3016
                                                            with:#( '' $r $w $x 
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3017
                                                                    '  ' $r $w $x 
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3018
                                                                    '  ' $r $w $x ).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3019
                                entry colAt:3 put:modeString.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3020
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3021
                                ((info uid) ~~ prevUid) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3022
                                    prevUid := (info uid).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3023
                                    nameString := OperatingSystem getUserNameFromID:prevUid.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3024
                                    nameString := nameString , (String new:(10 - nameString size))
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3025
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3026
                                entry colAt:4 put:nameString withoutSpaces.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3027
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3028
                                ((info gid) ~~ prevGid) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3029
                                    prevGid := (info gid).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3030
                                    groupString := OperatingSystem getGroupNameFromID:prevGid.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3031
                                    groupString := groupString , (String new:(10 - groupString size))
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3032
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3033
                                entry colAt:5 put:groupString withoutSpaces.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3034
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3035
                                (typ == #regular) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3036
                                    entry colAt:6 put:(self sizePrintString:(info size)).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3037
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3038
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3039
                                f := currentDirectory asFilename:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3040
                                f isSymbolicLink ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3041
                                    p := f linkInfo path.    
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3042
                                    typeString := 'symbolic link to ' , p
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3043
                                ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3044
                                    typeString := typ asString
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3045
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3046
                                entry colAt:7 put:typeString
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3047
                            ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3048
                            fileListView at:lineIndex put:entry.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3049
                            passDone at:lineIndex put:2.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3050
                        ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3051
                    ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3052
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3053
                    (state endsWith:'Types') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3054
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3055
                        "/ pass 3: add fileType
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3056
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3057
                        (passDone at:lineIndex) < 3 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3058
                            info := currentDirectory infoOf:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3059
                            info notNil ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3060
                                f := currentDirectory asFilename:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3061
                                f isSymbolicLink ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3062
                                    typ := info type.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3063
                                    typ ~~ #directory ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3064
                                        (Image isImageFileSuffix:(f suffix)) ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3065
                                            typeString := f fileType.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3066
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3067
                                            entry colAt:7 put:typeString.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3068
                                            fileListView at:lineIndex put:entry
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3069
                                        ]
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3070
                                    ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3071
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3072
                            ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3073
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3074
                            passDone at:lineIndex put:3
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3075
                        ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3076
                    ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3077
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3078
                    (state endsWith:'Images') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3079
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3080
                        "/ pass 4: read images
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3081
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3082
                        (passDone at:lineIndex) < 4 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3083
                            f := currentDirectory asFilename construct:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3084
                            (Image isImageFileSuffix:(f suffix)) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3085
                                f isDirectory ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3086
                                    img := Image fromFile:(f pathName).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3087
                                    img notNil ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3088
                                        img := img magnifiedTo:16@16.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3089
                                        img := img on:self device.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3090
                                        entry colAt:7 put:img.
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3091
                                        fileListView at:lineIndex put:entry
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3092
                                    ]
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3093
                                ]
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  3094
                            ].
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3095
                            passDone at:lineIndex put:4
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3096
                        ].
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  3097
                    ].
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3098
                ].
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3099
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3100
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3101
                "/ advance to the next line
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3102
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3103
                lineIndex := lineIndex + 1.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3104
                lineIndex > endIndex ifTrue:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3105
                    "/ finished this round ...
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3106
                    "/ see what we are going for ...
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3107
                    numVisible := (fileListView lastLineShown - fileListView firstLineShown + 1).
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3108
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3109
                    state := nextState at:state ifAbsent:nil.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3110
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3111
                    state isNil ifTrue:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3112
                        done := true
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3113
                    ] ifFalse:[
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3114
                        (state startsWith:'visible') ifTrue:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3115
                            lineIndex := fileListView firstLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3116
                            endIndex := fileListView lastLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3117
                            endIndex := endIndex min:(files size).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3118
                        ] ifFalse:[
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3119
                            (state startsWith:'nextPage') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3120
                                lineIndex := fileListView lastLineShown + 1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3121
                                endIndex := lineIndex + numVisible.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3122
                                endIndex := endIndex min:(files size).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3123
                                lineIndex := lineIndex min:(files size).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3124
                            ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3125
                                (state startsWith:'previousPage') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3126
                                    endIndex := fileListView firstLineShown - 1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3127
                                    lineIndex := endIndex - numVisible.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3128
                                    lineIndex := lineIndex max:1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3129
                                    endIndex := endIndex min:(files size).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3130
                                    endIndex := endIndex max:1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3131
                                ] ifFalse:[ 
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3132
                                    "/ remaining
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3133
                                    lineIndex := 1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3134
                                    endIndex := files size.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3135
                                ]
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3136
                            ]
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3137
                        ]
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3138
                    ]
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3139
                ]
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3140
            ].
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3141
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  3142
            listUpdateProcess := nil.
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3143
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  3144
        ] forkAt:(Processor activePriority - 1).
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3145
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3146
        "
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3147
         install a new check after some time
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3148
        "
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3149
        Processor addTimedBlock:checkBlock afterSeconds:checkDelta
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3150
    ]
142
claus
parents: 139
diff changeset
  3151
claus
parents: 139
diff changeset
  3152
    "Modified: 21.9.1995 / 11:40:23 / claus"
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3153
    "Modified: 19.4.1997 / 14:35:43 / cg"
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3154
! !
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3155
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3156
!FileBrowser methodsFor:'private-file-I/O'!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3157
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3158
readFile:fileName
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3159
    "read in the file, answer its contents as StringCollection"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3160
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3161
    ^ self readFile:fileName lineDelimiter:Character cr encoding:nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3162
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3163
    "Modified: 22.2.1996 / 14:57:08 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3164
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3165
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3166
readFile:fileName lineDelimiter:aCharacter encoding:encoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3167
    "read in the file, return its contents as StringCollection. 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3168
     The files lines are delimited by aCharacter.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3169
     If encoding is nonNil, the file is assumed to be coded according to
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3170
     that symbol, and #decodeString: should be able to convert it."
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3171
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3172
    |stream text msg sz|
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3173
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3174
    stream := FileStream readonlyFileNamed:fileName in:currentDirectory.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3175
    stream isNil ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3176
        msg := (resources string:'cannot read file ''%1'' !!' with:fileName).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3177
        self showAlert:msg with:(FileStream lastErrorString).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3178
        ^ nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3179
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3180
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3181
    "
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3182
     for very big files, give ObjectMemory a hint, to preallocate more
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3183
    "
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3184
    (sz := stream size) > 1000000 ifTrue:[
749
27427c41b7ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 748
diff changeset
  3185
        Processor activeProcess withPriority:Processor userBackgroundPriority do:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3186
            ObjectMemory announceSpaceNeed:(sz + (sz // 5)) "/ add 20% for tab expansion
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3187
        ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3188
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3189
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3190
    text := self readStream:stream lineDelimiter:aCharacter encoding:encoding.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3191
    stream close.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3192
    ^ text
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3193
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3194
    "Created: 22.2.1996 / 14:56:48 / cg"
749
27427c41b7ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 748
diff changeset
  3195
    "Modified: 8.10.1996 / 21:01:57 / cg"
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3196
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3197
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3198
readStream:aStream
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3199
    "read in from aStream, answer its contents as StringCollection"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3200
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3201
    ^ self readStream:aStream lineDelimiter:Character cr encoding:nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3202
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3203
    "Modified: 22.2.1996 / 14:58:40 / cg"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3204
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3205
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3206
readStream:aStream lineDelimiter:aCharacter encoding:encoding 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3207
    "read from aStream, answer its contents as StringCollection. 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3208
     The files lines are delimited by aCharacter.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3209
     If encoding is nonNil, the file is assumed to be coded according to
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3210
     that symbol, and #decodeString: should be able to convert it."
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3211
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3212
    |text line enc|
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3213
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3214
    text := StringCollection new.
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3215
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3216
    enc := encoding.
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3217
    enc == #iso8859 ifTrue:[
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3218
        enc := nil
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3219
    ].
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3220
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3221
    aCharacter == Character cr ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3222
        [aStream atEnd] whileFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3223
            line := aStream nextLine withTabsExpanded.
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3224
            enc notNil ifTrue:[
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3225
                line := line decodeFrom:enc
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3226
            ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3227
            text add:line
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3228
        ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3229
    ] ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3230
        [aStream atEnd] whileFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3231
            line := (aStream upTo:aCharacter) withTabsExpanded.
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3232
            enc notNil ifTrue:[
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3233
                line := line decodeFrom:enc
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3234
            ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3235
            text add:line
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3236
        ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3237
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3238
    ^ text
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3239
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3240
    "Created: 22.2.1996 / 14:58:25 / cg"
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3241
    "Modified: 2.4.1997 / 21:31:36 / cg"
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3242
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3243
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3244
showFile:fileName
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3245
    "show contents of fileName in subView"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3246
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3247
    self showFile:fileName insert:false encoding:fileEncoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3248
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3249
    "Modified: 22.2.1996 / 14:47:10 / cg"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3250
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3251
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3252
showFile:fileName insert:insert encoding:encoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3253
    "show/insert contents of fileName in subView"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3254
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3255
    ^ self 
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3256
        showFile:fileName insert:insert encoding:encoding doubleClick:false
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3257
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3258
    "Modified: 19.6.1996 / 09:40:19 / cg"
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3259
!
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3260
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3261
showFile:fileName insert:insert encoding:encoding doubleClick:viaDoubleClick
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3262
    "show/insert contents of fileName in subView"
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3263
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3264
    |buffer s n i ok convert text msg eol guess action enc|
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3265
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3266
    ((currentDirectory typeOf:fileName) == #regular) ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3267
        "asked for a non-file  - ignore it ..."
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3268
        (currentDirectory exists:fileName) ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3269
            msg := '''%1'' does not exist !!'.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3270
        ] ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3271
            msg := '''%1'' is not a regular file !!'.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3272
        ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3273
        self warn:(resources string:msg with:fileName).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3274
        ^ self
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3275
    ].
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3276
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3277
    "/
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3278
    "/ check if file is a text file
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3279
    "/
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3280
    s := FileStream readonlyFileNamed:fileName in:currentDirectory.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3281
    s isNil ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3282
        self showAlert:(resources string:'cannot read file ''%1'' !!' with:fileName)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3283
                  with:(FileStream lastErrorString).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3284
        ^ nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3285
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3286
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3287
    buffer := String new:300.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3288
    n := s nextBytes:300 into:buffer.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3289
    s close.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3290
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3291
    enc := encoding.
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3292
    ok := true.
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3293
    guess := self guessEncodingFrom:buffer.
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  3294
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3295
    guess == #binary ifTrue:[
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3296
        ok := false.
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3297
        viaDoubleClick ifTrue:[
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3298
            (self binaryFileAction:fileName) ifTrue:[^ self].
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3299
        ].
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3300
        (self confirm:(resources string:'''%1'' seems to be a binary file - show anyway ?' with:fileName))
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3301
        ifFalse:[^ self]
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3302
    ] ifFalse:[
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3303
        viaDoubleClick ifTrue:[
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3304
            (self nonBinaryFileAction:fileName) ifTrue:[^ self].
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3305
        ].
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3306
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3307
        "/ ascii should work in any font ...
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3308
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3309
        guess ~~ #ascii ifTrue:[
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3310
            fileEncoding ~~ guess ifTrue:[
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3311
                action := Dialog choose:(resources string:'''%1'' seems to be ' , guess , ' encoded.' with:fileName)
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3312
                               labels:(resources array:#('cancel' 'show' 'change font'))
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3313
                               values:#(nil #show #encoding)
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3314
                               default:#encoding.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3315
                action isNil ifTrue:[^ self].
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3316
                action == #encoding ifTrue:[
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3317
                    fileEncoding := guess asSymbol.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3318
                    self validateFontEncodingFor:fileEncoding ask:false.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3319
                    enc := fileEncoding.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3320
                ]
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3321
            ]    
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3322
        ].
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3323
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3324
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3325
    convert := false.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3326
    ok ifTrue:[
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3327
        "/
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3328
        "/ check if line delimiter is a cr
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3329
        "/
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3330
        i := buffer indexOf:Character cr.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3331
        i == 0 ifTrue:[
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3332
            "/
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3333
            "/ no newline found - try cr
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3334
            "/
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3335
            i := buffer indexOf:(Character value:13).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3336
            i ~~ 0 ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3337
                convert := self confirm:(resources string:'''%1'' seems to have CR as line delimiter - convert to NL ?' with:fileName).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3338
            ]
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3339
        ]
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3340
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3341
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3342
    insert ifFalse:[
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3343
        "/ release old text first 
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3344
        "/ - we might need the memory in case of huge files
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3345
        "/  (helps if you have a 4Mb file in the view, 
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3346
        "/   and click on another biggy)
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3347
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3348
        subView contents:nil.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3349
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3350
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3351
    convert ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3352
        eol := Character value:13
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3353
    ] ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3354
        eol := Character cr
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3355
    ].
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3356
    text := self readFile:fileName lineDelimiter:eol encoding:enc.
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3357
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3358
    insert ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3359
        self show:text
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3360
    ] ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3361
        subView insertSelectedStringAtCursor:text asString
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3362
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3363
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3364
    "Created: 19.6.1996 / 09:39:52 / cg"
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  3365
    "Modified: 23.1.1997 / 20:31:43 / cg"
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3366
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3367
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3368
writeFile:fileName text:someText encoding:encoding
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3369
    |stream msg startNr nLines string|
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3370
310
8731287abedd minor changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3371
    stream := FileStream newFileNamed:fileName in:currentDirectory.
8731287abedd minor changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3372
    stream isNil ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3373
        msg := (resources string:'cannot write file ''%1'' !!' with:fileName).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3374
        self showAlert:msg with:(FileStream lastErrorString)
310
8731287abedd minor changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3375
    ] ifFalse:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3376
        someText isString ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3377
            stream nextPutAll:someText.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3378
        ] ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3379
            "
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3380
             on some systems, writing linewise is very slow (via NFS)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3381
             therefore we convert to a string and write it in chunks
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3382
             to avoid creating huge strings, we do it in blocks of 1000 lines
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3383
            "
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3384
            startNr := 1.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3385
            nLines := someText size.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3386
            [startNr <= nLines] whileTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3387
                string := someText asStringWithCRsFrom:startNr
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3388
                                                    to:((startNr + 1000) min:nLines)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3389
                                          compressTabs:compressTabs.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3390
                encoding notNil ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3391
                    string := string encodeInto:encoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3392
                ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3393
                stream nextPutAll:string.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3394
                startNr := startNr + 1000 + 1.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3395
            ].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3396
"/                someText do:[:line |
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3397
"/                  line notNil ifTrue:[
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3398
"/                      stream nextPutAll:line.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3399
"/                  ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3400
"/                  stream cr.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3401
"/              ]
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3402
        ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3403
        stream close.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3404
        subView modified:false
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3405
    ]
310
8731287abedd minor changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3406
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3407
    "Created: 22.2.1996 / 15:03:10 / cg"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3408
    "Modified: 22.2.1996 / 15:08:31 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3409
! !
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3410
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3411
!FileBrowser methodsFor:'queries'!
73
e332d9c71624 *** empty log message ***
claus
parents: 67
diff changeset
  3412
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3413
path
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3414
    "return my currentDirectories pathName;
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3415
     sent from the pathField label to aquire pathname when I changed directory"
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  3416
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3417
    ^ currentDirectory pathName
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  3418
! !
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  3419
763
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
  3420
!FileBrowser class methodsFor:'documentation'!
203
de8d39d459fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 172
diff changeset
  3421
de8d39d459fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 172
diff changeset
  3422
version
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3423
    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.147 1997-04-19 13:23:34 cg Exp $'
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  3424
! !
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  3425
FileBrowser initialize!