FileBrowser.st
author Claus Gittinger <cg@exept.de>
Sat, 19 Apr 1997 15:32:01 +0200
changeset 1157 667a57034e40
parent 1156 f3df28086973
child 1158 ea2cd788ef59
permissions -rw-r--r--
only update if the directory did change (after execute command)
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:[
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  1740
        self updateCurrentDirectoryIfChanged
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
    ]
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  1745
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  1746
    "Modified: 19.4.1997 / 15:30:32 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1747
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1748
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1749
doCreateFile:newName
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1750
    |aStream|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1751
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1752
    (currentDirectory includes:newName) ifTrue:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1753
        (self
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1754
            ask:(resources string:'%1 already exists\\truncate ?' with:newName)
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1755
            yesButton:'truncate'
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1756
        ) ifFalse:[^ self].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1757
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1758
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1759
    aStream := FileStream newFileNamed:newName in:currentDirectory.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1760
    aStream notNil ifTrue:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1761
        aStream close.
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  1762
        self updateCurrentDirectoryIfChanged
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1763
    ] ifFalse:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1764
        self showAlert:(resources string:'cannot create file ''%1'' !!' with:newName)
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1765
                  with:(FileStream lastErrorString)
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1766
    ]
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1767
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  1768
    "Modified: 19.4.1997 / 15:30:35 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1769
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1770
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1771
doExecuteCommand:command replace:replace
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1772
    "execute a unix command inserting the output of the command.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1773
     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
  1774
     otherwise, its inserted as selected text at the cursor position."
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1775
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1776
    |stream line lnr myProcess myPriority startLine startCol stopSignal
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1777
     access stillReplacing|
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1778
994
1734123c7520 friendly semaphore names
Claus Gittinger <cg@exept.de>
parents: 988
diff changeset
  1779
    access := Semaphore forMutualExclusion name:'accessLock'.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1780
    stopSignal := Signal new.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1781
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
     must take killButton out of my group
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
    windowGroup removeView:killButton.
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
     bring it to front, and turn hidden-mode off
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1788
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1789
    killButton raise.
331
a12998c7f3c2 use beVisible / beInvisible
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1790
    killButton beVisible.
172
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
     it will make me raise stopSignal when pressed
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1793
    "
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1794
    killButton 
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1795
        action:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1796
            stream notNil ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1797
                access critical:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1798
                    myProcess interruptWith:[stopSignal raise].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1799
                ]
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1800
            ]
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1801
        ].
172
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
     start it up under its own windowgroup
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
    killButton openAutonomous.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1806
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
     go fork a pipe and read it
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 label:(myName , ': executing ' , (command copyTo:(20 min:command size)) , ' ...').
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1811
    [
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1812
      self withWaitCursorDo:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1813
        stopSignal catch:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1814
            startLine := subView cursorLine.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1815
            startCol := subView cursorCol.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1816
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
             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
  1819
            "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1820
            myProcess := Processor activeProcess.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1821
            myPriority := myProcess priority.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1822
            myProcess priority:(Processor userBackgroundPriority).
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1823
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1824
            stream := PipeStream readingFrom:('cd '
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1825
                                              , currentDirectory pathName
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1826
                                              , '; '
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1827
                                              , command
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1828
                                              , ' 2>&1' ).
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1829
            stream notNil ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1830
                [
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1831
                    |codeView lines|
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1832
729
da2aa1dee58f comment - use buffered Pipe when reading command output
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1833
                    stream buffered:true.
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1834
                    codeView := subView.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1835
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1836
                    replace ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1837
                        codeView list:nil.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1838
                        lnr := 1.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1839
                    ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1840
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1841
                   stillReplacing := replace.
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1842
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1843
                   [stream atEnd] whileFalse:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1844
                        (stream readWaitWithTimeoutMs:50) ifFalse:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1845
                            "
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1846
                             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
  1847
                             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
  1848
                             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
  1849
                            "
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1850
                            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
  1851
                            line := stream nextLine.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1852
                            line notNil ifTrue:[lines add:line].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1853
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1854
                            [stream atEnd not
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1855
                            and:[stream canReadWithoutBlocking
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1856
                            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
  1857
                                line := stream nextLine.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1858
                                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
  1859
                            ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1860
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1861
                            "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1862
                             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
  1863
                             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
  1864
                             an expose event ...
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1865
                            "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1866
                            access critical:[                        
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1867
                                lines size > 0 ifTrue:[
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1868
                                    stillReplacing ifTrue:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1869
                                        lines do:[:line |
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1870
                                            codeView at:lnr put:line withTabsExpanded.
539
33b603dd30ba replaced ColoredListEntry by Text
Claus Gittinger <cg@exept.de>
parents: 525
diff changeset
  1871
                                            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
  1872
                                            lnr := lnr + 1.
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1873
                                            lnr > codeView list size ifTrue:[
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1874
                                                stillReplacing := false
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1875
                                            ]
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1876
                                        ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1877
                                    ] ifFalse:[
1133
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1878
                                        codeView insertLines:lines before:codeView cursorLine.
42779d9c9f4c much faster command-output display
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1879
                                        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
  1880
                                    ]
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1881
                                ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1882
                            ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1883
                        ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1884
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1885
                        shown ifTrue:[windowGroup processExposeEvents].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1886
                        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1887
                         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
  1888
                         (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
  1889
                        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1890
                        Processor yield
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1891
                    ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1892
                ] valueNowOrOnUnwindDo:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1893
                    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
  1894
                ].
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  1895
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  1896
                self updateCurrentDirectoryIfChanged
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  1897
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1898
            ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1899
            replace ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1900
                subView modified:false.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1901
            ].
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1902
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1903
      ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1904
    ] valueNowOrOnUnwindDo:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1905
        |wg|
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1906
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1907
        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
  1908
        myProcess notNil ifTrue:[myProcess priority:myPriority].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1909
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1910
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1911
         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
  1912
         (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
  1913
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1914
        wg := killButton windowGroup.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1915
        killButton windowGroup:nil.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1916
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1917
         shut down the windowgroup
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
        wg notNil ifTrue:[
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1920
            wg process terminate.
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
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1923
         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
  1924
         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
  1925
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1926
        killButton beInvisible.
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1927
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1928
         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
  1929
         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
  1930
        "
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1931
        killButton action:nil.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  1932
    ].
172
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
    currentFileName isNil ifTrue:[
355
55f1bac567eb command execution kill fixed (for pipes where nothing ever arrives)
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
  1935
        subView modified:false.
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
    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
  1939
        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
  1940
    ]
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1941
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1942
    "Modified: 21.9.1995 / 11:18:46 / claus"
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  1943
    "Modified: 19.4.1997 / 15:29:54 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1944
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1945
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  1946
doFileGet:viaDoubleClick
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1947
    "get selected file - show contents in subView"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1948
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1949
    |fileName iconLbl winLbl|
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1950
294
a693bd6d7ae6 read cursor while reading
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1951
    self withReadCursorDo:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1952
        fileName := self getSelectedFileName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1953
        fileName notNil ifTrue:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1954
            (currentDirectory isDirectory:fileName) ifTrue:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1955
                self doChangeCurrentDirectoryTo:fileName updateHistory:true.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1956
                winLbl := myName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1957
                iconLbl := myName
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1958
            ] ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1959
                (currentDirectory exists:fileName) ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1960
                    self warn:(resources string:'oops, ''%1'' is gone' with:fileName).
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1961
                    ^ self
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1962
                ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1963
                timeOfFileRead := currentDirectory timeOfLastChange:fileName.
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  1964
                self showFile:fileName insert:false encoding:fileEncoding doubleClick:viaDoubleClick.
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1965
                currentFileName := fileName.
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1966
912
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1967
                self fileTypeSpecificActions.
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1968
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1969
                subView acceptAction:[:theCode |
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1970
                    self withCursor:(Cursor write) do:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  1971
                        self writeFile:fileName text:theCode encoding:fileEncoding.
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1972
                        timeOfFileRead := currentDirectory timeOfLastChange:fileName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1973
                        self label:myName , ': ' , currentFileName
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1974
                    ]
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1975
                ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1976
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1977
                winLbl := myName , ': ' , fileName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1978
                (currentDirectory isWritable:fileName) ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1979
                    winLbl := winLbl , ' (readonly)'
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1980
                ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1981
                iconLbl := fileName
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1982
            ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1983
            self label:winLbl.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1984
            self iconLabel:iconLbl.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  1985
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1986
    ]
294
a693bd6d7ae6 read cursor while reading
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1987
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  1988
    "Created: 19.6.1996 / 09:39:07 / cg"
912
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1989
    "Modified: 7.1.1997 / 20:21:44 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1990
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1991
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1992
doRemove
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1993
    "remove the selected file(s) - no questions asked"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  1994
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1995
    |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
  1996
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1997
    updateRunning := listUpdateProcess notNil.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1998
    self stopUpdateProcess.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  1999
    toRemove := OrderedCollection new.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2000
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2001
    "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2002
    "/ 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
  2003
    "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2004
    needUpdate := (currentDirectory timeOfLastChange > timeOfLastCheck).
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2005
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2006
    lockUpdate := true.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2007
    [
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2008
        self selectedFilesDo:[:fileName |
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2009
            ok := false.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2010
            (currentDirectory isDirectory:fileName) ifTrue:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2011
                dir := FileDirectory directoryNamed:fileName in:currentDirectory.
967
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2012
                dir isEmpty ifTrue:[
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2013
                    ok := currentDirectory removeDirectory:fileName
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2014
                ] ifFalse:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2015
                    (self 
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2016
                        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
  2017
                        yesButton:'remove')
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2018
                    ifFalse:[
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2019
                        ^ self
5b475194c477 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  2020
                    ].
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2021
                    ok := currentDirectory removeDirectory:fileName
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2022
                ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2023
            ] ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2024
                ok := currentDirectory remove:fileName.
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2025
            ].
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2026
            ok ifFalse:[
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2027
                "was not able to remove it"
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2028
                msg := (resources string:'cannot remove ''%1'' !!' with:fileName).
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2029
                self showAlert:msg with:(OperatingSystem lastErrorString)
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2030
            ] ifTrue:[
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2031
"
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2032
                self show:nil
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2033
"
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2034
                idx := fileList indexOf:fileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2035
                idx ~~ 0 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2036
                    toRemove add:idx.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2037
                ]
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2038
            ]
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2039
        ].
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2040
    ] valueNowOrOnUnwindDo:[
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2041
        lockUpdate := false.
564
28b766ce6ec5 selection: / setSelection:
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2042
        fileListView setSelection:nil.
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2043
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2044
        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2045
        "/ remove reverse - otherwise indices are wrong
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2046
        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2047
        toRemove sort.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2048
        toRemove reverseDo:[:idx |
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2049
            fileList removeIndex:idx.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2050
            fileListView removeIndex:idx.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2051
        ].
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
        updateRunning ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2054
            self updateCurrentDirectory
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2055
        ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2056
            "
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2057
             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
  2058
            "
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2059
            needUpdate ifFalse:[timeOfLastCheck := AbsoluteTime now].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2060
            Processor addTimedBlock:checkBlock afterSeconds:checkDelta
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2061
        ]
380
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2062
    ]
ec0cfd2b3200 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  2063
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2064
    "Modified: 19.4.1997 / 14:03:55 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2065
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2066
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2067
doRename:oldName to:newName
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2068
    (oldName notNil and:[newName notNil]) ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2069
        (oldName isBlank or:[newName isBlank]) ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2070
            currentDirectory renameFile:oldName newName:newName.
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2071
            self updateCurrentDirectoryIfChanged.
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2072
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2073
    ]
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2074
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2075
    "Modified: 19.4.1997 / 15:30:49 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2076
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2077
912
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2078
fileCommentStrings
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2079
    "return useful comment definition; based upon the fileName for now"
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2080
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2081
    "/ for now,
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2082
    "/ define comment strings, by heuristics;
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2083
    "/ (should look for some mode= or similar string
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2084
    "/  found in the file itself - like emacs does it)
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2085
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2086
    (currentFileName = 'Make.proto'
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2087
    or:[currentFileName = 'Makefile'
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2088
    or:[currentFileName = 'makefile']]) ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2089
        ^ #('#' (nil nil)).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2090
    ].
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2091
    ((currentFileName endsWith:'.c')
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2092
    or:[(currentFileName endsWith:'.C')]) ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2093
        ^ #(nil ('/*' '*/')).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2094
    ].
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2095
    ((currentFileName endsWith:'.cc')
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2096
    or:[(currentFileName endsWith:'.CC')]) ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2097
        ^ #('//' ('/*' '*/')).
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
    (currentFileName endsWith:'.java') ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2100
        ^ #('//' (nil nil)).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2101
    ].
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
    "/ smalltalk comments
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2104
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2105
    ^ #('"/' ('"' '"')).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2106
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2107
    "Created: 7.1.1997 / 20:30:00 / cg"
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2108
!
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
fileTypeSpecificActions
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2111
    "any special fileTypeSpecific actions are done here,
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2112
     when a new file is selected"
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2113
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2114
    |commentStrings|
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
    commentStrings := self fileCommentStrings.
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2117
    commentStrings notNil ifTrue:[
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2118
        subView
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2119
            commentStrings:#('#' (nil nil)).
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2120
    ].
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2121
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2122
    "Modified: 7.1.1997 / 20:30:54 / cg"
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2123
!
dae70963b64c define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  2124
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2125
getFileInfoString:longInfo
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2126
    "get stat info on selected file - return a string which can be
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2127
     shown in a box"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2128
133
claus
parents: 132
diff changeset
  2129
    |fileName f fullPath text info fileOutput type modeBits modeString s ts|
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2130
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2131
    fileName := self getSelectedFileName.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2132
    fileName isNil ifTrue:[^ nil].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2133
133
claus
parents: 132
diff changeset
  2134
    f := currentDirectory pathName asFilename construct:fileName.
claus
parents: 132
diff changeset
  2135
    info := f info.
claus
parents: 132
diff changeset
  2136
claus
parents: 132
diff changeset
  2137
"/    info := currentDirectory infoOf:fileName.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2138
    info isNil ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2139
        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
  2140
                  with:(OperatingSystem lastErrorString).
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2141
        ^ nil
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2142
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2143
59
d8ff572dd357 Text eliminated
claus
parents: 58
diff changeset
  2144
    text := StringCollection new.
133
claus
parents: 132
diff changeset
  2145
    f isSymbolicLink ifTrue:[
831
61bc793bfcd8 changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2146
        text add:(resources string:'symbolic link to: %1' with:(f linkInfo path))
133
claus
parents: 132
diff changeset
  2147
    ].
claus
parents: 132
diff changeset
  2148
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2149
    type := info type.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2150
    (longInfo and:[type == #regular]) ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2151
        fullPath := currentDirectory pathName , '/' , fileName.
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2152
        fileOutput := fullPath asFilename fileType.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2153
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2154
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2155
    s := (resources at:'type:   ').
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2156
    fileOutput isNil ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2157
        s := s ,  type asString
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2158
    ] ifFalse:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2159
        s := s , 'regular (' , fileOutput , ')'
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2160
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2161
    text add:s.
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2162
    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
  2163
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2164
    modeBits := info mode.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2165
    modeString := self getModeString:modeBits.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2166
    longInfo ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2167
        text add:(resources string:'access: %1 (%2)'
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2168
                              with:modeString 
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2169
                              with:(modeBits printStringRadix:8))
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2170
    ] ifFalse:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2171
        text add:(resources string:'access: %1' with:modeString)
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2172
    ].
133
claus
parents: 132
diff changeset
  2173
    text add:(resources string:'owner:  %1'
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2174
                          with:(OperatingSystem getUserNameFromID:(info uid))).
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2175
    longInfo ifTrue:[
830
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2176
        text add:(resources string:'group:  %1'
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2177
                              with:(OperatingSystem getGroupNameFromID:(info gid))).
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2178
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2179
        ts := info accessed.
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2180
        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
  2181
                              with:(ts asTime printString)
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2182
                              with:(ts asDate printString)).
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2183
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2184
        ts := info modified.
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2185
        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
  2186
                              with:(ts asTime printString)
36107b468bb8 changes for new return from OS>>infoOf:
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
  2187
                              with:(ts asDate printString)).
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2188
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2189
    ^ text asString
133
claus
parents: 132
diff changeset
  2190
claus
parents: 132
diff changeset
  2191
    "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
  2192
    "Modified: 1.11.1996 / 20:47:52 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2193
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2194
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2195
getInfoFile
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2196
    "get filename of a description-file (.dir.info, README etc.);
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2197
     This file is automatically shown when a directory is enterred.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2198
     You can add more names below if you like."
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2199
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2200
    #( '.dir.info'
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2201
       'README'
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2202
       'ReadMe'
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2203
       'Readme'
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2204
       'readme' 
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2205
    ) do:[:f |
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2206
        (currentDirectory isReadable:f) ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2207
            (currentDirectory isDirectory:f) ifFalse:[^ f].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2208
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2209
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2210
    ^ nil
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2211
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2212
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2213
getModeString:modeBits
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2214
    "convert file-mode bits into a more user-friendly string.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2215
     This is wrong here - should be moved into OperatingSystem."
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2216
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2217
    ^ self getModeString:modeBits 
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2218
                    with:#( 'owner:' $r $w $x 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2219
                            ' group:' $r $w $x 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2220
                            ' others:' $r $w $x )
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2221
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2222
37
50f59bad66b1 *** empty log message ***
claus
parents: 36
diff changeset
  2223
getModeString:modeBits with:texts
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2224
    "convert file-mode bits into a more user-friendly string.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2225
     This is wrong here - should be moved into OperatingSystem."
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2226
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2227
    |bits modeString|
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2228
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2229
    bits := modeBits bitAnd:8r777.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2230
    modeString := ''.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2231
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2232
    #( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) 
37
50f59bad66b1 *** empty log message ***
claus
parents: 36
diff changeset
  2233
    with: texts do:[:bitMask :access |
988
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
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2236
        bitMask isNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2237
            modeString := modeString , (resources string:access)
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2238
        ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2239
            (bits bitAnd:bitMask) == 0 ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2240
                ch := $-
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2241
            ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2242
                ch := access
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2243
            ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2244
            modeString := modeString copyWith:ch 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2245
        ]
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2246
    ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2247
    ^ modeString
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2248
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2249
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2250
getSelectedFileName
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2251
    "returns the currently selected file; shows an error if
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2252
     multiple files are selected"
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2253
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2254
    |sel|
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2255
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2256
    sel := fileListView selection.
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2257
    (sel size > 1) ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2258
        self onlyOneSelection
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2259
    ] ifFalse:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2260
        sel notNil ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2261
            ^ fileList at:sel first
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2262
        ]
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2263
    ].
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2264
    ^ nil
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2265
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2266
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2267
guessEncodingFrom:aBuffer
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2268
    "look for a string
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2269
        encoding #name
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2270
     or:
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2271
        encoding: name
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2272
     within the given buffer (which is usually the first few
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2273
     bytes of a textFile"
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2274
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2275
    |n "{Class: SmallInteger }"
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2276
     binary idx s w w2|
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2277
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2278
    binary := false.
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2279
    n := aBuffer size.
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2280
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2281
    (idx := aBuffer findString:'encoding') ~~ 0 ifTrue:[
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2282
        s := ReadStream on:aBuffer.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2283
        s position:idx + 8.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2284
        s skipSeparators.
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2285
        s peek == $: ifTrue:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2286
            s next.
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2287
            s skipSeparators. 
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2288
        ] ifFalse:[
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2289
            s peek == $# ifTrue:[s next].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2290
        ].
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2291
        w := s upToSeparator.
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2292
        w notNil ifTrue:[
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2293
            ^ w asSymbol
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2294
        ].
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2295
    ].
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2296
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2297
    1 to:n do:[:i |
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2298
        (aBuffer at:i) isPrintable ifFalse:[binary := true].
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2299
    ].
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  2300
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2301
    binary ifTrue:[
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2302
        "/ look for JIS7 / EUC encoding
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2303
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2304
        (aBuffer findString:(JISEncodedString jis7KanjiEscapeSequence)) ~~ 0 ifTrue:[
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2305
            ^ #jis7
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2306
        ].
396
e5777391727e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  2307
        (aBuffer findString:(JISEncodedString oldJis7KanjiEscapeSequence)) ~~ 0 ifTrue:[
e5777391727e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  2308
            ^ #jis7
e5777391727e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  2309
        ].
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2310
        ^ #binary
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2311
    ].
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2312
    ^ #ascii
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2313
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2314
    "Created: 26.2.1996 / 17:43:08 / cg"
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  2315
    "Modified: 23.1.1997 / 20:39:25 / cg"
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2316
!
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  2317
1142
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2318
initialCommandFor:fileName into:aBox
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2319
    "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
  2320
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2321
    |lcFilename cmd select|
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2322
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2323
    "/ 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
  2324
    "/ XXX or from resources.
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
    ((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
  2327
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2328
        (currentDirectory isExecutable:fileName) ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2329
            aBox initialText:(fileName , ' <arguments>').
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2330
            ^ self
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2331
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2332
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2333
        lcFilename := fileName asLowercase.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2334
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2335
        select := true.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2336
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2337
        "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
  2338
         (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
  2339
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2340
        (fileName endsWith:'akefile') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2341
            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
  2342
            ^ self
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2343
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2344
        (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
  2345
            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
  2346
            select := false.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2347
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2348
        (fileName endsWith:'.taz') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2349
            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
  2350
            select := false.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2351
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2352
        (fileName endsWith:'.tar') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2353
            cmd := 'tar tvf %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2354
            select := 7.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2355
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2356
        (fileName endsWith:'.zoo') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2357
            cmd := 'zoo -list %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2358
            select := 9.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2359
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2360
        (lcFilename endsWith:'.zip') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2361
            cmd := 'unzip -l %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2362
            select := 8.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2363
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2364
        (lcFilename endsWith:'.z') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2365
            cmd := 'uncompress %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2366
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2367
        (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
  2368
            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
  2369
            select := false.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2370
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2371
        (fileName endsWith:'.tgz') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2372
            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
  2373
            select := false.
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
        (fileName endsWith:'.gz') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2376
            cmd := 'gunzip %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
        (lcFilename endsWith:'.html') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2379
            cmd := 'netscape %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
        (lcFilename endsWith:'.htm') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2382
            cmd := 'netscape %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2383
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2384
        (fileName endsWith:'.uue') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2385
            cmd := 'uudecode %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2386
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2387
        (fileName endsWith:'.c') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2388
            cmd := 'cc -c %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2389
            select := 5.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2390
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2391
        (fileName endsWith:'.cc') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2392
            cmd := 'g++ -c %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2393
            select := 6.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2394
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2395
        (fileName endsWith:'.C') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2396
            cmd := 'g++ -c %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2397
            select := 6.
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:'.xbm') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2400
            cmd := 'bitmap %1'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2401
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2402
        (lcFilename endsWith:'.ps') ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2403
            cmd := 'ghostview %1'
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
        ((fileName endsWith:'.1') 
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2406
        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
  2407
            cmd := 'nroff -man %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2408
            select := 10.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2409
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2410
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2411
        cmd isNil ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2412
            DefaultCommandPerSuffix isNil ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2413
                cmd := '<cmd>'
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2414
            ] ifFalse:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2415
                cmd := DefaultCommandPerSuffix 
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2416
                        at:(lcFilename asFilename suffix)
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2417
                        ifAbsent:'<cmd>'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2418
            ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2419
            cmd := cmd , ' %1'.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2420
        ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2421
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2422
        cmd := cmd bindWith:fileName.
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2423
        select == false ifTrue:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2424
            aBox initialText:cmd
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2425
        ] ifFalse:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2426
            select isInteger ifFalse:[
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2427
                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
  2428
            ].
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2429
            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
  2430
        ]
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2431
    ]
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2432
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2433
    "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
  2434
!
9066d7d02a3a remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents: 1141
diff changeset
  2435
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2436
onlyOneSelection
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2437
    "show a warning, that only one file must be selected for
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2438
     this operation"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2439
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2440
    self warn:'exactly one file must be selected !!'
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2441
!
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
selectedFilesDo:aBlock
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2444
    "evaluate aBlock on all selected files;
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2445
     show a wait cursor while doing this"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2446
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2447
    |sel|
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
    sel := fileListView selection.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2450
    sel notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2451
        self withWaitCursorDo:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2452
            sel do:[:aSelectionIndex |
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2453
                aBlock value:(fileList at:aSelectionIndex )
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2454
            ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2455
        ]
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
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
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2460
setCurrentDirectory:aPathName
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2461
    "setup for another directory"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2462
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2463
    |newDirectory|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2464
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2465
    aPathName isEmpty ifTrue:[^ self].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2466
    (currentDirectory isDirectory:aPathName) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2467
        newDirectory := FileDirectory directoryNamed:aPathName in:currentDirectory.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2468
        newDirectory notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2469
            self currentDirectory:newDirectory pathName.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2470
            currentFileName notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2471
                fileListView contents:nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2472
                currentFileName := nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2473
            ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2474
                fileListView setSelection:nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2475
                fileListView scrollToTop.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2476
            ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2477
            self updateCurrentDirectory.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2478
            self showInfo.
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
    ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2481
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2482
    "Modified: 21.9.1995 / 11:22:45 / claus"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2483
    "Modified: 25.5.1996 / 12:27:01 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2484
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2485
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2486
show:something
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2487
    "show something in subview and undef acceptAction"
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
    subView contents:something.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2490
    subView acceptAction:nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2491
    subView modified:false.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2492
    currentFileName := nil
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
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2495
showAlert:aString with:anErrorString
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2496
    "show an alertbox, displaying the last Unix-error"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2497
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2498
    |msg|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2499
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2500
    anErrorString isNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2501
        msg := aString
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2502
    ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2503
        msg := aString , '\\(' , anErrorString , ')'
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
    self warn:msg withCRs
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
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2508
showInfo
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2509
    "show directory info when dir has changed"
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
    |info 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
    info := self getInfoFile.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2514
    info notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2515
        txt := self readFile:info
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2516
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2517
    self show:txt.
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
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2520
sizePrintString:size
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2521
    "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
  2522
     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
  2523
     If you dont like this, just uncomment the first statement below."
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2524
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2525
    |unitString n|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2526
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2527
"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2528
    ^ size printString.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2529
"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2530
    unitString := ''.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2531
    size < (500 * 1024) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2532
        size < 1024 ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2533
            n := size
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2534
        ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2535
            n := (size * 10 // 1024 / 10.0).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2536
            unitString := ' Kb'
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
    ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2539
        n := (size * 10 // 1024 // 1024 / 10.0).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2540
        unitString := ' Mb'
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2541
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2542
    ^ (n printStringLeftPaddedTo:5) , unitString.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2543
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2544
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2545
updateCurrentDirectoryIfChanged
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2546
    (currentDirectory timeOfLastChange > timeOfLastCheck) ifTrue:[
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2547
        self updateCurrentDirectory
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2548
    ]
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2549
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2550
    "Modified: 19.4.1997 / 15:30:03 / cg"
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2551
!
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  2552
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2553
validateFontEncodingFor:newEncoding ask:ask
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2554
    "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
  2555
     which is able to display text encoded as specified by newEncoding"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2556
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2557
    |fontsEncoding msg filter f defaultFont|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2558
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2559
    fontsEncoding := subView font encoding.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2560
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2561
    ((newEncoding == #jis7) or:[newEncoding == #euc]) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2562
        (fontsEncoding notNil and:[fontsEncoding startsWith:'jis']) ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2563
            msg := 'switch to a JIS encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2564
            filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2565
                            (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2566
                            and:['jis*' match:coding]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2567
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2568
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2569
    (newEncoding == #gb) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2570
        (fontsEncoding notNil and:[fontsEncoding startsWith:'gb']) ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2571
            msg := 'switch to a GB encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2572
            filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2573
                            (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2574
                            and:['gb*' match:coding]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2575
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2576
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2577
    (newEncoding == #big5) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2578
        (fontsEncoding notNil and:[fontsEncoding startsWith:'big5']) ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2579
            msg := 'switch to a BIG-5 encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2580
            filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2581
                            (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2582
                            and:['big5*' match:coding]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2583
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2584
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2585
    (newEncoding == #ksc) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2586
        (fontsEncoding notNil and:[fontsEncoding startsWith:'ksc']) ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2587
            msg := 'switch to a KSC encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2588
            filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2589
                            (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2590
                            and:['ksc*' match:coding]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2591
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2592
    ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2593
        fontsEncoding notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2594
            ((fontsEncoding startsWith:'jis')
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2595
            or:[(fontsEncoding startsWith:'gb')
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2596
            or:[(fontsEncoding startsWith:'ksc')
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2597
            or:[(fontsEncoding startsWith:'big5')]]])
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2598
            ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2599
                msg := 'switch back to an ASCII encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2600
                filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2601
                                (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2602
                                and:[('ascii' match:coding)
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2603
                                     or:['iso*' match:coding]]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2604
                defaultFont := TextView defaultFont
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2605
            ] ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2606
                (fontsEncoding notNil and:[fontsEncoding startsWith:'iso8859']) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2607
                    msg := 'switch to a ''' , newEncoding , ''' encoded font ?'.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2608
                    filter := [:f | |coding|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2609
                                    (coding := f encoding) notNil 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2610
                                    and:[newEncoding asLowercase = coding asLowercase]].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2611
                ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2612
            ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2613
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2614
    ].
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
    msg isNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2617
        "/ mhmh - can be represented in current font
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2618
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2619
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2620
    msg notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2621
        defaultFont isNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2622
            defaultFont := device 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2623
                                listOfAvailableFonts 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2624
                                    detect:[:f | filter value:f]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2625
                                    ifNone:nil.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2626
            defaultFont isNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2627
                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
  2628
                ^ self.
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
        ].
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
        (ask not or:[self confirm:(resources string:msg) withCRs])
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2633
        ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2634
            f := FontPanel 
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2635
                fontFromUserInitial:defaultFont
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2636
                              title:(resources string:'font selection')
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2637
                             filter:filter.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2638
            f notNil ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2639
                subView font:f
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2640
            ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2641
        ]
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
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2644
    "Created: 26.10.1996 / 12:06:54 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2645
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2646
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2647
withoutHiddenFiles:aCollection
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2648
    "remove hidden files (i.e. those that start with '.') from
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2649
     the list in aCollection"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2650
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2651
    |newCollection|
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
    newCollection := aCollection species new.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2654
    aCollection do:[:fname |
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2655
        |ignore|
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2656
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2657
        ignore := false.
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
        ((fname startsWith:'.') and:[fname ~= '..']) ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2660
            showDotFiles ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2661
                ignore := true
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2662
            ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2663
        ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2664
        ignore ifFalse:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2665
            newCollection add:fname
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2666
        ]
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2667
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2668
    ^ newCollection
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2669
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2670
    "Modified: 21.2.1996 / 01:33:18 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2671
! !
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
!FileBrowser methodsFor:'private - actions'!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2674
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2675
binaryFileAction:aFilename
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2676
    "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
  2677
     action ..."
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2678
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2679
    (currentDirectory pathName , '/' , aFilename) asFilename isExecutable ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2680
        (OperatingSystem executeCommand:'cd ',currentDirectory pathName, '; ',aFilename)
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2681
        ifTrue:[^true].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2682
    ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2683
    ^ self imageAction:aFilename
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2684
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2685
    "Modified: 19.6.1996 / 09:44:07 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2686
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2687
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2688
imageAction:aFilename
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2689
    "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
  2690
     action ..."
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2691
1025
d6ee5f738d94 ask image suffix table for imageAction
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  2692
    |img|
d6ee5f738d94 ask image suffix table for imageAction
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  2693
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2694
    (Image isImageFileSuffix:(aFilename asFilename suffix))
1025
d6ee5f738d94 ask image suffix table for imageAction
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  2695
    ifTrue:[
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2696
        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
  2697
        img notNil ifTrue:[
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2698
            img inspect.
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2699
            ^ true
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2700
        ]
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2701
    ].
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2702
    ^ false
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2703
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2704
    "Created: 19.6.1996 / 09:43:50 / cg"
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2705
    "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
  2706
!
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2707
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2708
nonBinaryFileAction:aFilename
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2709
    "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
  2710
     action ..."
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2711
1111
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2712
    |fullPath lcName|
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2713
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2714
    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
  2715
    lcName := aFilename asLowercase.
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2716
    ((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
  2717
        HTMLDocumentView openOn:fullPath.
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2718
        ^ true
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2719
    ].
1111
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2720
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2721
    OperatingSystem isUNIXlike ifTrue:[
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2722
        (#('.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
  2723
        ifTrue:[
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2724
             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
  2725
            ^ true
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2726
        ]
5e7eb6e13e59 double click on '.man' file opens an html-reader on it
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2727
    ].
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2728
    ^ self imageAction:aFilename
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2729
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2730
    "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
  2731
    "Modified: 4.4.1997 / 10:49:00 / cg"
1140
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
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2734
!FileBrowser methodsFor:'private - presentation'!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2735
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2736
defineTabulatorsForLongList
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2737
    "define the tabs for the long list"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2738
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2739
    tabSpec := TabulatorSpecification new.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2740
    tabSpec unit:#inch.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2741
"/  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
  2742
    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
  2743
    "                   icon  name   mode  owner  group  size     type"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2744
    tabSpec align:    #(#left #left  #left #right #right #decimal #left).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2745
    tabSpec addDependent:self.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2746
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2747
    tabRulerView tabulatorSpecification:tabSpec.
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
    "Modified: 17.4.1997 / 02:56:07 / cg"
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2750
!
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  2751
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2752
defineTabulatorsForShortList
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2753
    "define the tabs for the short list"
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
    tabSpec := TabulatorSpecification new.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2756
    tabSpec unit:#inch.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2757
"/  tabSpec positions:#(0     0.25 ).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2758
    tabSpec widths:   #(0.25   2   ).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2759
    "                   icon  name"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2760
    tabSpec align:    #(#left #left).
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2761
    tabSpec addDependent:self.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2762
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2763
    tabRulerView tabulatorSpecification:tabSpec.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2764
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2765
    "Created: 17.4.1997 / 02:51:41 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2766
    "Modified: 17.4.1997 / 02:55:17 / cg"
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2767
!
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2768
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2769
iconForFile:aFilenameString
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2770
    "given a fileName, return an appropriate icon"
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2771
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2772
    |f suff i key|
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2773
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2774
    f := currentDirectory asFilename construct:aFilenameString.
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2775
    f isDirectory ifTrue:[
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2776
        f isSymbolicLink ifTrue:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2777
            key := #directoryLink
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2778
        ] ifFalse:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2779
            key := #directory
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2780
        ]
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2781
    ] ifFalse:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2782
        f isSymbolicLink ifTrue:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2783
            key := #fileLink
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2784
        ] ifFalse:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2785
            key := #file.
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2786
            (Image isImageFileSuffix:(f suffix)) ifTrue:[
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2787
                key := #imageFile
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2788
            ].
1140
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2789
        ].
56f36855266d nicer directory list.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2790
    ].
1141
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2791
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2792
    icons isNil ifTrue:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2793
        icons := IdentityDictionary new
1141
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2794
    ].
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2795
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2796
    i := icons at:key ifAbsent:nil.
1141
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2797
    i isNil ifTrue:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2798
        i := Icons at:key ifAbsent:nil.
1144
6bd7e0d7ca07 handle non-existent icons case
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
  2799
        i notNil ifTrue:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2800
            i := i on:device.
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2801
            icons at:key put:i.
1144
6bd7e0d7ca07 handle non-existent icons case
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
  2802
        ]
1141
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2803
    ].
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2804
    ^ i
62e6fd3083b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
  2805
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2806
    "Modified: 18.4.1997 / 15:18:38 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2807
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2808
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2809
stopUpdateProcess
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2810
    Processor removeTimedBlock:checkBlock.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2811
    listUpdateProcess notNil ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2812
        listUpdateProcess terminate.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2813
        listUpdateProcess := nil.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2814
    ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2815
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2816
    "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
  2817
!
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2818
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2819
updateCurrentDirectory
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2820
    "update listView with directory contents"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  2821
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2822
    "the code below may look somewhat complex -
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2823
     it reads the directory first for the names,
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2824
     then (in followup sweeps over the files) gets the
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2825
     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
  2826
     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
  2827
     (i.e. stat-calls) may take long - especially on NFS-mounted directories.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2828
     The file reading is done at lower priority, to let user continue
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2829
     his work in other views. However, to be fair to other fileBrowser,
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2830
     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
  2831
     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
  2832
     Therefore, browsers which read short directories will finish first.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2833
     ST/X users love this behavior ;-)
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2834
    "
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  2835
294
a693bd6d7ae6 read cursor while reading
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  2836
    self withReadCursorDo:[
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2837
        |files matchPattern|
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2838
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2839
        self stopUpdateProcess.
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2840
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2841
        timeOfLastCheck := AbsoluteTime now.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2842
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2843
        files := currentDirectory asOrderedCollection.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2844
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2845
        "/ 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
  2846
        "/ or match the current pattern
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2847
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2848
        matchPattern := filterField contents.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2849
        (matchPattern notNil and:[
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2850
         matchPattern isEmpty not and:[
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2851
         matchPattern ~= '*']]) ifTrue:[
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2852
             files := files select:[:aName | 
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2853
                         ((currentDirectory typeOf:aName) == #directory)
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2854
                         or:[matchPattern compoundMatch:aName]
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2855
                      ].
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2856
        ].
1138
0e1d96c6ddab allow multiPatterns (i.e. '*.c;*.h') in pattern field
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2857
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2858
        files sort.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2859
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2860
        files size == 0 ifTrue:[
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2861
            self information:('directory ', currentDirectory pathName, ' vanished').
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2862
            ^ self
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2863
        ].
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2864
        files := self withoutHiddenFiles:files.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2865
        fileList := files copy.
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2866
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2867
        "
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2868
         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
  2869
         NFS-mounted directory); therefore, start a low prio process,
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2870
         which fills in the remaining fields in the fileList ...
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2871
        "
1145
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
        listUpdateProcess := [
1154
c02ebe91ba11 nameStrng bug
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
  2874
            |prevUid prevGid fileNameString nameString groupString 
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2875
             modeString info line len list
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2876
             anyImages passDone lineIndex aFileName
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2877
             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
  2878
             state stopAtEnd nextState img prevFirstLine prevLastLine
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2879
             numVisible|
1145
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
            tabSpec isNil ifTrue:[
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2882
                showLongList ifTrue:[
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2883
                    self defineTabulatorsForLongList
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2884
                ] ifFalse:[
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2885
                    self defineTabulatorsForShortList
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
            ].
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2888
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2889
            "/
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2890
            "/ first show all the names - this can be done fast ...
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2891
            "/
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2892
            list := files collect:[:fileName |
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2893
                        |entry|
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2894
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2895
                        entry := MultiColListEntry new.
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2896
                        entry tabulatorSpecification:tabSpec.
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2897
                        entry colAt:1 put:nil.
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2898
                        entry colAt:2 put:fileName.
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2899
                    ].
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2900
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  2901
            fileListView setList:list expandTabs:false.
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2902
            passDone := Array new:list size withAll:0.
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2903
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2904
            "/
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2905
            "/ then walk over the files, adding more info
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2906
            "/ (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
  2907
            "/ Visible items are always filled first.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2908
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2909
            "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2910
            "/ the state machine
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2911
            "/
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2912
            nextState := IdentityDictionary new.
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2913
            showLongList ifTrue:[
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2914
                nextState add:(#visibleIcons -> #visibleAttributes).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2915
                nextState add:(#visibleAttributes -> #visibleTypes).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2916
                nextState add:(#visibleTypes -> #visibleImages).
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2917
                nextState add:(#visibleImages -> #nextPageIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2918
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2919
                nextState add:(#nextPageIcons -> #nextPageAttributes).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2920
                nextState add:(#nextPageAttributes -> #nextPageTypes).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2921
                nextState add:(#nextPageTypes -> #nextPageImages).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2922
                nextState add:(#nextPageImages -> #previousPageIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2923
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2924
                nextState add:(#previousPageIcons -> #previousPageAttributes).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2925
                nextState add:(#previousPageAttributes -> #previousPageTypes).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2926
                nextState add:(#previousPageTypes -> #previousPageImages).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2927
                nextState add:(#previousPageImages -> #remainingIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2928
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2929
                nextState add:(#remainingIcons -> #remainingAttributes).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2930
                nextState add:(#remainingAttributes -> #remainingTypes).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2931
                nextState add:(#remainingTypes -> #remainingImages).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2932
                nextState add:(#remainingImages -> nil).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2933
            ] ifFalse:[
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2934
                nextState add:(#visibleIcons -> #nextPageIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2935
                nextState add:(#nextPageIcons -> #previousPageIcons).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2936
                nextState add:(#previousPageIcons -> #remainingIcons).
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2937
                nextState add:(#remainingIcons -> nil).
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
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2940
            anyImages := false.
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
            lineIndex := prevFirstLine := fileListView firstLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2943
            endIndex := prevLastLine := fileListView lastLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2944
            endIndex := endIndex min:(files size).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2945
            state := #visibleIcons.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2946
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2947
            done := false.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2948
            [done] whileFalse:[
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2949
                "/
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2950
                "/ if multiple FileBrowsers are reading, let others
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2951
                "/ make some progress too
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2952
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2953
                Processor yield.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2954
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2955
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2956
                "/ could be destroyed in the meanwhile ...
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2957
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2958
                realized ifFalse:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2959
                    listUpdateProcess := nil.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2960
                    Processor activeProcess terminate
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2961
                ].
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2962
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2963
                ((prevFirstLine ~~ fileListView firstLineShown)
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2964
                or:[prevLastLine ~~ fileListView lastLineShown]) ifTrue:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2965
                    "/ start all over again
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2966
                    lineIndex := prevFirstLine := fileListView firstLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2967
                    endIndex := prevLastLine := fileListView lastLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2968
                    endIndex := endIndex min:(files size).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2969
                    state := #visibleIcons.
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  2970
                ].
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2971
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2972
                (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
  2973
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2974
                    "/
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2975
                    "/ expand the next entry ...
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
                    aFileName := files at:lineIndex.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2978
                    entry := fileListView at:lineIndex.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2979
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2980
                    (state endsWith:'Icons') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2981
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2982
                        "/ pass 1 - icons
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
                        (passDone at:lineIndex) < 1 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2985
                            ((currentDirectory isDirectory:aFileName) and:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2986
                            (aFileName ~= '..') and:[aFileName ~= '.']]) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2987
                                fileNameString := aFileName , ' ...'
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2988
                            ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2989
                                fileNameString := aFileName
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  2990
                            ].
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2991
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2992
                            showLongList ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2993
                                len := fileNameString size.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2994
                                (len > 20) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2995
                                    fileNameString := (fileNameString contractTo:20)
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2996
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2997
                            ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2998
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  2999
                            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
  3000
                            entry colAt:2 put:fileNameString.
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
                            fileListView at:lineIndex put:entry.
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
                            anyImages ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3005
                                (Image isImageFileSuffix:(aFileName asFilename suffix))
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3006
                                ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3007
                                    anyImages := true
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3008
                                ]
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3009
                            ].
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3010
                            passDone at:lineIndex put:1
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3011
                        ]
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3012
                    ].
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3013
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3014
                    (state endsWith:'Attributes') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3015
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3016
                        "/ 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
  3017
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3018
                        (passDone at:lineIndex) < 2 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3019
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3020
                            info := currentDirectory infoOf:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3021
                            info isNil ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3022
                                "not accessable - usually a symlink,
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3023
                                 to a nonexisting/nonreadable file
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3024
                                "
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3025
                                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
  3026
                            ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3027
                                typ := (info type).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3028
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3029
                                modeString := self getModeString:(info at:#mode)
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3030
                                                            with:#( '' $r $w $x 
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3031
                                                                    '  ' $r $w $x 
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3032
                                                                    '  ' $r $w $x ).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3033
                                entry colAt:3 put:modeString.
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
                                ((info uid) ~~ prevUid) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3036
                                    prevUid := (info uid).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3037
                                    nameString := OperatingSystem getUserNameFromID:prevUid.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3038
                                    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
  3039
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3040
                                entry colAt:4 put:nameString withoutSpaces.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3041
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3042
                                ((info gid) ~~ prevGid) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3043
                                    prevGid := (info gid).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3044
                                    groupString := OperatingSystem getGroupNameFromID:prevGid.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3045
                                    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
  3046
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3047
                                entry colAt:5 put:groupString withoutSpaces.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3048
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3049
                                (typ == #regular) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3050
                                    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
  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
                                f := currentDirectory asFilename:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3054
                                f isSymbolicLink ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3055
                                    p := f linkInfo path.    
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3056
                                    typeString := 'symbolic link to ' , p
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3057
                                ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3058
                                    typeString := typ asString
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3059
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3060
                                entry colAt:7 put:typeString
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3061
                            ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3062
                            fileListView at:lineIndex put:entry.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3063
                            passDone at:lineIndex put:2.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3064
                        ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3065
                    ].
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
                    (state endsWith:'Types') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3068
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3069
                        "/ pass 3: add fileType
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
                        (passDone at:lineIndex) < 3 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3072
                            info := currentDirectory infoOf:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3073
                            info notNil ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3074
                                f := currentDirectory asFilename:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3075
                                f isSymbolicLink ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3076
                                    typ := info type.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3077
                                    typ ~~ #directory ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3078
                                        (Image isImageFileSuffix:(f suffix)) ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3079
                                            typeString := f fileType.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3080
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3081
                                            entry colAt:7 put:typeString.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3082
                                            fileListView at:lineIndex put:entry
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3083
                                        ]
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3084
                                    ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3085
                                ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3086
                            ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3087
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3088
                            passDone at:lineIndex put:3
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3089
                        ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3090
                    ].
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3091
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3092
                    (state endsWith:'Images') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3093
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3094
                        "/ pass 4: read images
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3095
                        "/
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3096
                        (passDone at:lineIndex) < 4 ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3097
                            f := currentDirectory asFilename construct:aFileName.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3098
                            (Image isImageFileSuffix:(f suffix)) ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3099
                                f isDirectory ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3100
                                    img := Image fromFile:(f pathName).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3101
                                    img notNil ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3102
                                        img := img magnifiedTo:16@16.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3103
                                        img := img on:self device.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3104
                                        entry colAt:7 put:img.
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3105
                                        fileListView at:lineIndex put:entry
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3106
                                    ]
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3107
                                ]
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  3108
                            ].
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3109
                            passDone at:lineIndex put:4
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3110
                        ].
1147
d0e297f94b9b defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  3111
                    ].
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3112
                ].
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3113
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3114
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3115
                "/ advance to the next line
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3116
                "/
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3117
                lineIndex := lineIndex + 1.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3118
                lineIndex > endIndex ifTrue:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3119
                    "/ finished this round ...
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3120
                    "/ see what we are going for ...
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3121
                    numVisible := (fileListView lastLineShown - fileListView firstLineShown + 1).
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3122
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3123
                    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
  3124
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3125
                    state isNil ifTrue:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3126
                        done := true
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3127
                    ] ifFalse:[
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3128
                        (state startsWith:'visible') ifTrue:[
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3129
                            lineIndex := fileListView firstLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3130
                            endIndex := fileListView lastLineShown.
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3131
                            endIndex := endIndex min:(files size).
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3132
                        ] ifFalse:[
1156
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3133
                            (state startsWith:'nextPage') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3134
                                lineIndex := fileListView lastLineShown + 1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3135
                                endIndex := lineIndex + numVisible.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3136
                                endIndex := endIndex min:(files size).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3137
                                lineIndex := lineIndex min:(files size).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3138
                            ] ifFalse:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3139
                                (state startsWith:'previousPage') ifTrue:[
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3140
                                    endIndex := fileListView firstLineShown - 1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3141
                                    lineIndex := endIndex - numVisible.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3142
                                    lineIndex := lineIndex max:1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3143
                                    endIndex := endIndex min:(files size).
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3144
                                    endIndex := endIndex max:1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3145
                                ] ifFalse:[ 
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3146
                                    "/ remaining
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3147
                                    lineIndex := 1.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3148
                                    endIndex := files size.
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3149
                                ]
f3df28086973 dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
  3150
                            ]
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3151
                        ]
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3152
                    ]
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3153
                ]
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3154
            ].
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3155
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  3156
            listUpdateProcess := nil.
1151
194b10bad6da great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents: 1147
diff changeset
  3157
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  3158
        ] forkAt:(Processor activePriority - 1).
747
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3159
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3160
        "
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3161
         install a new check after some time
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3162
        "
a50e8643c666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  3163
        Processor addTimedBlock:checkBlock afterSeconds:checkDelta
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3164
    ]
142
claus
parents: 139
diff changeset
  3165
claus
parents: 139
diff changeset
  3166
    "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
  3167
    "Modified: 19.4.1997 / 14:35:43 / cg"
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3168
! !
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3169
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3170
!FileBrowser methodsFor:'private-file-I/O'!
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
readFile:fileName
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3173
    "read in the file, answer its contents as StringCollection"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3174
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3175
    ^ self readFile:fileName lineDelimiter:Character cr encoding:nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3176
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3177
    "Modified: 22.2.1996 / 14:57:08 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3178
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3179
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3180
readFile:fileName lineDelimiter:aCharacter encoding:encoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3181
    "read in the file, return its contents as StringCollection. 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3182
     The files lines are delimited by aCharacter.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3183
     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
  3184
     that symbol, and #decodeString: should be able to convert it."
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3185
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3186
    |stream text msg sz|
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
    stream := FileStream readonlyFileNamed:fileName in:currentDirectory.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3189
    stream isNil ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3190
        msg := (resources string:'cannot read file ''%1'' !!' with:fileName).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3191
        self showAlert:msg with:(FileStream lastErrorString).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3192
        ^ nil
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
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3195
    "
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3196
     for very big files, give ObjectMemory a hint, to preallocate more
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
    (sz := stream size) > 1000000 ifTrue:[
749
27427c41b7ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 748
diff changeset
  3199
        Processor activeProcess withPriority:Processor userBackgroundPriority do:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3200
            ObjectMemory announceSpaceNeed:(sz + (sz // 5)) "/ add 20% for tab expansion
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3201
        ].
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
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3204
    text := self readStream:stream lineDelimiter:aCharacter encoding:encoding.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3205
    stream close.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3206
    ^ text
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3207
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3208
    "Created: 22.2.1996 / 14:56:48 / cg"
749
27427c41b7ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 748
diff changeset
  3209
    "Modified: 8.10.1996 / 21:01:57 / cg"
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3210
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3211
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3212
readStream:aStream
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3213
    "read in from aStream, answer its contents as StringCollection"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3214
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3215
    ^ self readStream:aStream lineDelimiter:Character cr encoding:nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3216
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3217
    "Modified: 22.2.1996 / 14:58:40 / cg"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3218
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3219
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3220
readStream:aStream lineDelimiter:aCharacter encoding:encoding 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3221
    "read from aStream, answer its contents as StringCollection. 
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3222
     The files lines are delimited by aCharacter.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3223
     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
  3224
     that symbol, and #decodeString: should be able to convert it."
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3225
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3226
    |text line enc|
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3227
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3228
    text := StringCollection new.
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3229
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3230
    enc := encoding.
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3231
    enc == #iso8859 ifTrue:[
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3232
        enc := nil
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3233
    ].
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3234
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3235
    aCharacter == Character cr ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3236
        [aStream atEnd] whileFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3237
            line := aStream nextLine withTabsExpanded.
1110
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3238
            enc notNil ifTrue:[
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3239
                line := line decodeFrom:enc
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3240
            ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3241
            text add:line
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
    ] ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3244
        [aStream atEnd] whileFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3245
            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
  3246
            enc notNil ifTrue:[
9ec4692e9cda dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  3247
                line := line decodeFrom:enc
386
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
            text add:line
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
    ^ text
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3253
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3254
    "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
  3255
    "Modified: 2.4.1997 / 21:31:36 / cg"
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3256
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3257
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3258
showFile:fileName
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3259
    "show contents of fileName in subView"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3260
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3261
    self showFile:fileName insert:false encoding:fileEncoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3262
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3263
    "Modified: 22.2.1996 / 14:47:10 / cg"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3264
!
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
showFile:fileName insert:insert encoding:encoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3267
    "show/insert contents of fileName in subView"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3268
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3269
    ^ self 
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3270
        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
  3271
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3272
    "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
  3273
!
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3274
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3275
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
  3276
    "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
  3277
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3278
    |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
  3279
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3280
    ((currentDirectory typeOf:fileName) == #regular) ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3281
        "asked for a non-file  - ignore it ..."
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3282
        (currentDirectory exists:fileName) ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3283
            msg := '''%1'' does not exist !!'.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3284
        ] ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3285
            msg := '''%1'' is not a regular file !!'.
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
        self warn:(resources string:msg with:fileName).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3288
        ^ self
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3289
    ].
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3290
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3291
    "/
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3292
    "/ check if file is a text file
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3293
    "/
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3294
    s := FileStream readonlyFileNamed:fileName in:currentDirectory.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3295
    s isNil ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3296
        self showAlert:(resources string:'cannot read file ''%1'' !!' with:fileName)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3297
                  with:(FileStream lastErrorString).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3298
        ^ nil
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3299
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3300
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3301
    buffer := String new:300.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3302
    n := s nextBytes:300 into:buffer.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3303
    s close.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3304
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3305
    enc := encoding.
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3306
    ok := true.
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3307
    guess := self guessEncodingFrom:buffer.
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  3308
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3309
    guess == #binary ifTrue:[
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3310
        ok := false.
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3311
        viaDoubleClick ifTrue:[
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3312
            (self binaryFileAction:fileName) ifTrue:[^ self].
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3313
        ].
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3314
        (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
  3315
        ifFalse:[^ self]
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3316
    ] ifFalse:[
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3317
        viaDoubleClick ifTrue:[
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3318
            (self nonBinaryFileAction:fileName) ifTrue:[^ self].
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3319
        ].
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3320
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3321
        "/ ascii should work in any font ...
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3322
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3323
        guess ~~ #ascii ifTrue:[
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3324
            fileEncoding ~~ guess ifTrue:[
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3325
                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
  3326
                               labels:(resources array:#('cancel' 'show' 'change font'))
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3327
                               values:#(nil #show #encoding)
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3328
                               default:#encoding.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3329
                action isNil ifTrue:[^ self].
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3330
                action == #encoding ifTrue:[
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3331
                    fileEncoding := guess asSymbol.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3332
                    self validateFontEncodingFor:fileEncoding ask:false.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3333
                    enc := fileEncoding.
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3334
                ]
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3335
            ]    
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3336
        ].
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3337
    ].
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
    convert := false.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3340
    ok ifTrue:[
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3341
        "/
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3342
        "/ check if line delimiter is a cr
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3343
        "/
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3344
        i := buffer indexOf:Character cr.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3345
        i == 0 ifTrue:[
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3346
            "/
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3347
            "/ no newline found - try cr
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3348
            "/
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3349
            i := buffer indexOf:(Character value:13).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3350
            i ~~ 0 ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3351
                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
  3352
            ]
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3353
        ]
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3354
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3355
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3356
    insert ifFalse:[
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3357
        "/ release old text first 
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3358
        "/ - we might need the memory in case of huge files
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3359
        "/  (helps if you have a 4Mb file in the view, 
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3360
        "/   and click on another biggy)
395
ae713196f3e6 added guess on encoding
Claus Gittinger <cg@exept.de>
parents: 389
diff changeset
  3361
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3362
        subView contents:nil.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3363
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3364
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3365
    convert ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3366
        eol := Character value:13
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3367
    ] ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3368
        eol := Character cr
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3369
    ].
807
d14ccf8ab4a2 improved check for encoding;
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3370
    text := self readFile:fileName lineDelimiter:eol encoding:enc.
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3371
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3372
    insert ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3373
        self show:text
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3374
    ] ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3375
        subView insertSelectedStringAtCursor:text asString
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3376
    ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3377
633
4630175ed31e double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3378
    "Created: 19.6.1996 / 09:39:52 / cg"
988
40eba68d33f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  3379
    "Modified: 23.1.1997 / 20:31:43 / cg"
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3380
!
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3381
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3382
writeFile:fileName text:someText encoding:encoding
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3383
    |stream msg startNr nLines string|
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3384
310
8731287abedd minor changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3385
    stream := FileStream newFileNamed:fileName in:currentDirectory.
8731287abedd minor changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3386
    stream isNil ifTrue:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3387
        msg := (resources string:'cannot write file ''%1'' !!' with:fileName).
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3388
        self showAlert:msg with:(FileStream lastErrorString)
310
8731287abedd minor changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3389
    ] ifFalse:[
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3390
        someText isString ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3391
            stream nextPutAll:someText.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3392
        ] ifFalse:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3393
            "
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3394
             on some systems, writing linewise is very slow (via NFS)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3395
             therefore we convert to a string and write it in chunks
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3396
             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
  3397
            "
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3398
            startNr := 1.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3399
            nLines := someText size.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3400
            [startNr <= nLines] whileTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3401
                string := someText asStringWithCRsFrom:startNr
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3402
                                                    to:((startNr + 1000) min:nLines)
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3403
                                          compressTabs:compressTabs.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3404
                encoding notNil ifTrue:[
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3405
                    string := string encodeInto:encoding
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3406
                ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3407
                stream nextPutAll:string.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3408
                startNr := startNr + 1000 + 1.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3409
            ].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3410
"/                someText do:[:line |
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3411
"/                  line notNil ifTrue:[
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3412
"/                      stream nextPutAll:line.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3413
"/                  ].
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3414
"/                  stream cr.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3415
"/              ]
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3416
        ].
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3417
        stream close.
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3418
        subView modified:false
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3419
    ]
310
8731287abedd minor changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3420
386
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3421
    "Created: 22.2.1996 / 15:03:10 / cg"
3fd24d9116b3 added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
  3422
    "Modified: 22.2.1996 / 15:08:31 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3423
! !
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
  3424
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3425
!FileBrowser methodsFor:'queries'!
73
e332d9c71624 *** empty log message ***
claus
parents: 67
diff changeset
  3426
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3427
path
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3428
    "return my currentDirectories pathName;
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3429
     sent from the pathField label to aquire pathname when I changed directory"
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  3430
172
3578af8feec6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
  3431
    ^ currentDirectory pathName
49
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  3432
! !
6fe62433cfa3 *** empty log message ***
claus
parents: 47
diff changeset
  3433
763
94a8d188b52d care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
  3434
!FileBrowser class methodsFor:'documentation'!
203
de8d39d459fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 172
diff changeset
  3435
de8d39d459fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 172
diff changeset
  3436
version
1157
667a57034e40 only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  3437
    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.148 1997-04-19 13:32:01 cg Exp $'
381
0b715d777c48 slight cleanup
Claus Gittinger <cg@exept.de>
parents: 380
diff changeset
  3438
! !
1145
0464625bbdbb read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  3439
FileBrowser initialize!