FileBrowser.st
changeset 3935 0dd8e9d71933
parent 3910 98acd94e6244
child 3943 e95eccd089a9
equal deleted inserted replaced
3934:a4c9d913af62 3935:0dd8e9d71933
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
       
    13 'From Smalltalk/X, Version:4.1.5 on 29-Sep-2002 at 18:55:49'                    !
       
    14 
    12 
    15 "{ Package: 'stx:libtool' }"
    13 "{ Package: 'stx:libtool' }"
    16 
    14 
    17 StandardSystemView subclass:#FileBrowser
    15 StandardSystemView subclass:#FileBrowser
    18 	instanceVariableNames:'menuPanel labelView filterField fileListView subView
    16 	instanceVariableNames:'menuPanel labelView filterField fileListView subView
   396 !
   394 !
   397 
   395 
   398 addToHistory:path
   396 addToHistory:path
   399     |pos idx|
   397     |pos idx|
   400 
   398 
   401     idx := DirectoryHistory indexOf:path.
   399     idx := self directoryHistory indexOf:path.
   402     idx == 0 ifTrue:[
   400     idx == 0 ifTrue:[
   403         DirectoryHistory size >= HistorySize ifTrue:[
   401         self directoryHistory size >= HistorySize ifTrue:[
   404             DirectoryHistory removeLast.
   402             self directoryHistory removeLast.
   405             DirectoryHistoryWhere removeLast
   403             self directoryHistoryWhere removeLast
   406         ]
   404         ]
   407     ] ifFalse:[
   405     ] ifFalse:[
   408         "already been there before; move the entry to
   406         "already been there before; move the entry to
   409          the beginning, so it will fall out later."
   407          the beginning, so it will fall out later."
   410 
   408 
   411         DirectoryHistory removeIndex:idx.
   409         self directoryHistory removeIndex:idx.
   412         pos := DirectoryHistoryWhere at:idx.
   410         pos := self directoryHistoryWhere at:idx.
   413         DirectoryHistoryWhere removeIndex:idx.
   411         self directoryHistoryWhere removeIndex:idx.
   414     ].
   412     ].
   415     DirectoryHistory addFirst:path.
   413     self directoryHistory addFirst:path.
   416     DirectoryHistoryWhere addFirst:pos.
   414     self directoryHistoryWhere addFirst:pos.
   417 
   415 
   418     "Created: / 8.11.1997 / 17:16:29 / cg"
   416     "Created: / 8.11.1997 / 17:16:29 / cg"
   419 !
   417 !
   420 
   418 
   421 addToVisitedFileHistory:path
   419 addToVisitedFileHistory:path
   803 
   801 
   804     "Modified: / 17.8.1998 / 10:13:05 / cg"
   802     "Modified: / 17.8.1998 / 10:13:05 / cg"
   805 !
   803 !
   806 
   804 
   807 directoryHistory
   805 directoryHistory
   808     ^ DirectoryHistory ? #()
   806 
       
   807     DirectoryHistory isNil ifTrue:[
       
   808         DirectoryHistory := OrderedCollection new.
       
   809     ].
       
   810     ^ DirectoryHistory
       
   811 !
       
   812 
       
   813 directoryHistoryWhere
       
   814 
       
   815     DirectoryHistoryWhere isNil ifTrue:[
       
   816         DirectoryHistoryWhere := OrderedCollection new.
       
   817     ].
       
   818     ^ DirectoryHistoryWhere
   809 !
   819 !
   810 
   820 
   811 directoryMenuSpec
   821 directoryMenuSpec
   812     "This resource specification was automatically generated
   822     "This resource specification was automatically generated
   813      by the MenuEditor of ST/X."
   823      by the MenuEditor of ST/X."
   900 
   910 
   901     |m|
   911     |m|
   902 
   912 
   903     "/ add the history items ...
   913     "/ add the history items ...
   904 
   914 
   905     DirectoryHistory size > 0 ifTrue:[
   915     self directoryHistory size > 0 ifTrue:[
   906         m := Menu new.
   916         m := Menu new.
   907 
   917 
   908         DirectoryHistory do:[:dirName |
   918         self directoryHistory do:[:dirName |
   909             m addItem:((MenuItem label:dirName value:#changeDirectoryTo:)
   919             m addItem:((MenuItem label:dirName value:#changeDirectoryTo:)
   910                             argument:dirName;
   920                             argument:dirName;
   911                             yourself).
   921                             yourself).
   912         ].
   922         ].
   913     ].
   923     ].
  1904     "Created: / 4.8.1998 / 14:10:31 / cg"
  1914     "Created: / 4.8.1998 / 14:10:31 / cg"
  1905     "Modified: / 4.8.1998 / 14:10:57 / cg"
  1915     "Modified: / 4.8.1998 / 14:10:57 / cg"
  1906 !
  1916 !
  1907 
  1917 
  1908 hasVisitHistory
  1918 hasVisitHistory
  1909     ^ [DirectoryHistory size > 0]
  1919     ^ [self class directoryHistory size > 0]
  1910 
  1920 
  1911     "Created: / 14.8.1998 / 19:17:02 / cg"
  1921     "Created: / 14.8.1998 / 19:17:02 / cg"
  1912     "Modified: / 14.8.1998 / 19:17:17 / cg"
  1922     "Modified: / 14.8.1998 / 19:17:17 / cg"
  1913 !
  1923 !
  1914 
  1924 
  4193 
  4203 
  4194     CommandHistory isNil ifTrue:[
  4204     CommandHistory isNil ifTrue:[
  4195         CommandHistory := OrderedCollection new.
  4205         CommandHistory := OrderedCollection new.
  4196         CommandHistorySize := 50
  4206         CommandHistorySize := 50
  4197     ].
  4207     ].
  4198     DirectoryHistory isNil ifTrue:[
       
  4199         DirectoryHistory := OrderedCollection new.
       
  4200         DirectoryHistoryWhere := OrderedCollection new.
       
  4201     ].
       
  4202     VisitedFileHistory isNil ifTrue:[
  4208     VisitedFileHistory isNil ifTrue:[
  4203         VisitedFileHistory := OrderedCollection new.
  4209         VisitedFileHistory := OrderedCollection new.
  4204     ].
  4210     ].
  4205     HistorySize isNil ifTrue:[
  4211     HistorySize isNil ifTrue:[
  4206         HistorySize := 15
  4212         HistorySize := 15
  5269                             ( 'remove from JavaClassPath'  removeDirFromJavaClassPath)
  5275                             ( 'remove from JavaClassPath'  removeDirFromJavaClassPath)
  5270                             ( 'remove from JavaSourcePath' removeDirFromJavaSourcePath)
  5276                             ( 'remove from JavaSourcePath' removeDirFromJavaSourcePath)
  5271                           ).
  5277                           ).
  5272     ].
  5278     ].
  5273 
  5279 
  5274     DirectoryHistory size > 0 ifTrue:[
  5280     self class directoryHistory size > 0 ifTrue:[
  5275         items := items copyWith:#('-').
  5281         items := items copyWith:#('-').
  5276         items := items ,
  5282         items := items ,
  5277                  (DirectoryHistory 
  5283                  (self class directoryHistory 
  5278                         collect:[:dirName |
  5284                         collect:[:dirName |
  5279                                     Array 
  5285                                     Array 
  5280                                         with:dirName 
  5286                                         with:dirName 
  5281                                         with:#changeDirectoryTo:
  5287                                         with:#changeDirectoryTo:
  5282                                         with:nil
  5288                                         with:nil
  6231 
  6237 
  6232                     "
  6238                     "
  6233                      remember where we are positioned in the fileList
  6239                      remember where we are positioned in the fileList
  6234                      (in case we want to return)
  6240                      (in case we want to return)
  6235                     "
  6241                     "
  6236                     idx := DirectoryHistory indexOf:path.
  6242                     idx := self class directoryHistory indexOf:path.
  6237                     idx ~~ 0 ifTrue:[
  6243                     idx ~~ 0 ifTrue:[
  6238                         DirectoryHistoryWhere at:idx put:fileListView firstLineShown
  6244                         self class directoryHistoryWhere at:idx put:fileListView firstLineShown
  6239                     ].
  6245                     ].
  6240 
  6246 
  6241                     updateHistory ifTrue:[
  6247                     updateHistory ifTrue:[
  6242                         self addToHistory:path.
  6248                         self addToHistory:path.
  6243                     ].
  6249                     ].
  6249 
  6255 
  6250                     "
  6256                     "
  6251                      if we have already been there, look for the
  6257                      if we have already been there, look for the
  6252                      position offset, and scroll the fileList
  6258                      position offset, and scroll the fileList
  6253                     "
  6259                     "
  6254                     idx := DirectoryHistory indexOf:path.
  6260                     idx := self class directoryHistory indexOf:path.
  6255                     idx ~~ 0 ifTrue:[
  6261                     idx ~~ 0 ifTrue:[
  6256                         |pos|
  6262                         |pos|
  6257 
  6263 
  6258                         pos := DirectoryHistoryWhere at:idx.
  6264                         pos := self class directoryHistoryWhere at:idx.
  6259                         pos notNil ifTrue:[
  6265                         pos notNil ifTrue:[
  6260                             fileListView scrollToLine:pos.
  6266                             fileListView scrollToLine:pos.
  6261                         ]
  6267                         ]
  6262                     ].
  6268                     ].
  6263 
  6269 
  8068 ! !
  8074 ! !
  8069 
  8075 
  8070 !FileBrowser class methodsFor:'documentation'!
  8076 !FileBrowser class methodsFor:'documentation'!
  8071 
  8077 
  8072 version
  8078 version
  8073     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.503 2002-09-29 16:56:28 cg Exp $'
  8079     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.504 2002-10-01 15:15:08 penk Exp $'
  8074 ! !
  8080 ! !