FileBrowser.st
branchjv
changeset 12401 4714b9640528
parent 12287 400a99059170
parent 11689 e6586cca74dd
child 12431 9f0c59c742d5
equal deleted inserted replaced
12330:235b77901045 12401:4714b9640528
    82     [start with:]
    82     [start with:]
    83         FileBrowser open
    83         FileBrowser open
    84 "
    84 "
    85 ! !
    85 ! !
    86 
    86 
       
    87 
    87 !FileBrowser class methodsFor:'instance creation'!
    88 !FileBrowser class methodsFor:'instance creation'!
    88 
    89 
    89 on:aDirectoryPath
    90 on:aDirectoryPath
    90     "return a new FileBrowser in a pathname"
    91     "return a new FileBrowser in a pathname"
    91 
    92 
   147     "
   148     "
   148 
   149 
   149     "Modified: / 17.6.1998 / 11:25:29 / cg"
   150     "Modified: / 17.6.1998 / 11:25:29 / cg"
   150 ! !
   151 ! !
   151 
   152 
       
   153 
   152 !FileBrowser class methodsFor:'aspects'!
   154 !FileBrowser class methodsFor:'aspects'!
   153 
   155 
   154 directoryBookmarks
   156 directoryBookmarks
   155     ^ AbstractFileBrowser directoryBookmarks.
   157     ^ AbstractFileBrowser directoryBookmarks.
   156 !
   158 !
   157 
   159 
   158 directoryHistory
   160 directoryHistory
   159 
   161 
   160     ^ AbstractFileBrowser directoryHistory.
   162     ^ AbstractFileBrowser directoryHistory.
   161 ! !
   163 ! !
       
   164 
   162 
   165 
   163 !FileBrowser class methodsFor:'defaults'!
   166 !FileBrowser class methodsFor:'defaults'!
   164 
   167 
   165 defaultIcon
   168 defaultIcon
   166     "return the file browsers default window icon"
   169     "return the file browsers default window icon"
   188 
   191 
   189     "Modified: / 19-03-1997 / 20:48:34 / ca"
   192     "Modified: / 19-03-1997 / 20:48:34 / ca"
   190     "Modified: / 17-09-2007 / 11:36:12 / cg"
   193     "Modified: / 17-09-2007 / 11:36:12 / cg"
   191 ! !
   194 ! !
   192 
   195 
       
   196 
   193 !FileBrowser class methodsFor:'fileList user interaction'!
   197 !FileBrowser class methodsFor:'fileList user interaction'!
   194 
   198 
   195 goodRenameDefaultForFile:oldName lastOld:lastOldName lastNew:lastNewName
   199 goodRenameDefaultForFile:oldName lastOld:lastOldName lastNew:lastNewName
   196     ^ DoWhatIMeanSupport goodRenameDefaultForFile:oldName lastOld:lastOldName lastNew:lastNewName
   200     ^ DoWhatIMeanSupport goodRenameDefaultForFile:oldName lastOld:lastOldName lastNew:lastNewName
   197 ! !
   201 ! !
       
   202 
   198 
   203 
   199 !FileBrowser class methodsFor:'history'!
   204 !FileBrowser class methodsFor:'history'!
   200 
   205 
   201 addToCommandHistory:aCommandString for:aFilename
   206 addToCommandHistory:aCommandString for:aFilename
   202     |cmd suffix|
   207     |cmd suffix|
   238         VisitedFileHistory removeIndex:idx.
   243         VisitedFileHistory removeIndex:idx.
   239     ].
   244     ].
   240     VisitedFileHistory addFirst:path.
   245     VisitedFileHistory addFirst:path.
   241 ! !
   246 ! !
   242 
   247 
       
   248 
   243 !FileBrowser class methodsFor:'icon-presentation'!
   249 !FileBrowser class methodsFor:'icon-presentation'!
   244 
   250 
   245 addOnIconsFor:aFilename to:anIcon
   251 addOnIconsFor:aFilename to:anIcon
   246     "given a fileName, return an appropriate icon"
   252     "given a fileName, return an appropriate icon"
   247 
   253 
   304 iconKeyForRemoteDirectory:aFilenameArg
   310 iconKeyForRemoteDirectory:aFilenameArg
   305     "given a fileName, return an appropriate icon"
   311     "given a fileName, return an appropriate icon"
   306 
   312 
   307     ^ MIMETypeIconLibrary iconKeyForRemoteDirectory:aFilenameArg
   313     ^ MIMETypeIconLibrary iconKeyForRemoteDirectory:aFilenameArg
   308 ! !
   314 ! !
       
   315 
   309 
   316 
   310 !FileBrowser class methodsFor:'interface specs'!
   317 !FileBrowser class methodsFor:'interface specs'!
   311 
   318 
   312 fileSearchDialogSpec
   319 fileSearchDialogSpec
   313     "This resource specification was automatically generated
   320     "This resource specification was automatically generated
   436            )
   443            )
   437          
   444          
   438         )
   445         )
   439       )
   446       )
   440 ! !
   447 ! !
       
   448 
   441 
   449 
   442 !FileBrowser class methodsFor:'menu specs'!
   450 !FileBrowser class methodsFor:'menu specs'!
   443 
   451 
   444 baseBookmarksMenuSpec
   452 baseBookmarksMenuSpec
   445     "This resource specification was automatically generated
   453     "This resource specification was automatically generated
  1466                         yourself).
  1474                         yourself).
  1467     ].
  1475     ].
  1468     ^ m
  1476     ^ m
  1469 ! !
  1477 ! !
  1470 
  1478 
       
  1479 
  1471 !FileBrowser class methodsFor:'queries'!
  1480 !FileBrowser class methodsFor:'queries'!
  1472 
  1481 
  1473 isVisualStartable
  1482 isVisualStartable
  1474     "return true, if this application can be started via #open.
  1483     "return true, if this application can be started via #open.
  1475      (to allow start of a change browser via double-click in the browser)"
  1484      (to allow start of a change browser via double-click in the browser)"
  1476 
  1485 
  1477     ^ true
  1486     ^ true
  1478 ! !
  1487 ! !
       
  1488 
  1479 
  1489 
  1480 !FileBrowser methodsFor:'aspects'!
  1490 !FileBrowser methodsFor:'aspects'!
  1481 
  1491 
  1482 anyFilesPresentWithSuffix:suffix
  1492 anyFilesPresentWithSuffix:suffix
  1483     ^ currentDirectory notNil
  1493     ^ currentDirectory notNil
  1870     ^ OperatingSystem isVMSlike
  1880     ^ OperatingSystem isVMSlike
  1871 
  1881 
  1872     "Created: / 4.8.1998 / 13:37:37 / cg"
  1882     "Created: / 4.8.1998 / 13:37:37 / cg"
  1873 ! !
  1883 ! !
  1874 
  1884 
       
  1885 
  1875 !FileBrowser methodsFor:'drag & drop'!
  1886 !FileBrowser methodsFor:'drag & drop'!
  1876 
  1887 
  1877 canDropObjects:aCollectionOfDropObjects
  1888 canDropObjects:aCollectionOfDropObjects
  1878     "I accept file- and textObjects only"
  1889     "I accept file- and textObjects only"
  1879 
  1890 
  1938         ^ self
  1949         ^ self
  1939     ].
  1950     ].
  1940 
  1951 
  1941     "Modified: 6.4.1997 / 14:46:44 / cg"
  1952     "Modified: 6.4.1997 / 14:46:44 / cg"
  1942 ! !
  1953 ! !
       
  1954 
  1943 
  1955 
  1944 !FileBrowser methodsFor:'events'!
  1956 !FileBrowser methodsFor:'events'!
  1945 
  1957 
  1946 handlesKeyPress:key inView:view
  1958 handlesKeyPress:key inView:view
  1947     "this method is reached via delegation: are we prepared to handle
  1959     "this method is reached via delegation: are we prepared to handle
  2059         self scheduleCheckBlock.
  2071         self scheduleCheckBlock.
  2060     ]
  2072     ]
  2061 
  2073 
  2062     "Modified: / 18.2.1998 / 17:57:44 / cg"
  2074     "Modified: / 18.2.1998 / 17:57:44 / cg"
  2063 ! !
  2075 ! !
       
  2076 
  2064 
  2077 
  2065 !FileBrowser methodsFor:'fileList user interaction'!
  2078 !FileBrowser methodsFor:'fileList user interaction'!
  2066 
  2079 
  2067 bigImagePreviewSettingChanged
  2080 bigImagePreviewSettingChanged
  2068     "invoked, when big image preview flag changed"
  2081     "invoked, when big image preview flag changed"
  3826 
  3839 
  3827     "Created: / 19.4.1997 / 09:50:02 / cg"
  3840     "Created: / 19.4.1997 / 09:50:02 / cg"
  3828     "Modified: / 4.8.1998 / 13:44:14 / cg"
  3841     "Modified: / 4.8.1998 / 13:44:14 / cg"
  3829 ! !
  3842 ! !
  3830 
  3843 
       
  3844 
  3831 !FileBrowser methodsFor:'help'!
  3845 !FileBrowser methodsFor:'help'!
  3832 
  3846 
  3833 helpTextFor:aComponent
  3847 helpTextFor:aComponent
  3834     |s|
  3848     |s|
  3835 
  3849 
  3851     s notNil ifTrue:[
  3865     s notNil ifTrue:[
  3852         ^ resources string:s
  3866         ^ resources string:s
  3853     ].
  3867     ].
  3854     ^ nil
  3868     ^ nil
  3855 ! !
  3869 ! !
       
  3870 
  3856 
  3871 
  3857 !FileBrowser methodsFor:'initialization & release'!
  3872 !FileBrowser methodsFor:'initialization & release'!
  3858 
  3873 
  3859 createTabRulerIn:topFrame
  3874 createTabRulerIn:topFrame
  3860     |v|
  3875     |v|
  4356     self showOrHideTabView.
  4371     self showOrHideTabView.
  4357 
  4372 
  4358     "Created: 24.7.1997 / 18:13:46 / cg"
  4373     "Created: 24.7.1997 / 18:13:46 / cg"
  4359 ! !
  4374 ! !
  4360 
  4375 
       
  4376 
  4361 !FileBrowser methodsFor:'menu actions'!
  4377 !FileBrowser methodsFor:'menu actions'!
  4362 
  4378 
  4363 addBookmark
  4379 addBookmark
  4364     self addBookmark:currentDirectory asFilename pathName
  4380     self addBookmark:currentDirectory asFilename pathName
  4365 !
  4381 !
  4503     self updateCurrentDirectory
  4519     self updateCurrentDirectory
  4504 
  4520 
  4505     "Created: / 14.8.1998 / 16:17:20 / cg"
  4521     "Created: / 14.8.1998 / 16:17:20 / cg"
  4506     "Modified: / 14.8.1998 / 16:44:00 / cg"
  4522     "Modified: / 14.8.1998 / 16:44:00 / cg"
  4507 ! !
  4523 ! !
       
  4524 
  4508 
  4525 
  4509 !FileBrowser methodsFor:'menu actions-cvs'!
  4526 !FileBrowser methodsFor:'menu actions-cvs'!
  4510 
  4527 
  4511 cvsAddAndCommitSelection
  4528 cvsAddAndCommitSelection
  4512     "add files (or all in current directory) and commit"
  4529     "add files (or all in current directory) and commit"
  4718         replace:false.
  4735         replace:false.
  4719 
  4736 
  4720     "Modified: / 21.10.1998 / 17:02:11 / cg"
  4737     "Modified: / 21.10.1998 / 17:02:11 / cg"
  4721 ! !
  4738 ! !
  4722 
  4739 
       
  4740 
  4723 !FileBrowser methodsFor:'misc user interaction'!
  4741 !FileBrowser methodsFor:'misc user interaction'!
  4724 
  4742 
  4725 closeRequest
  4743 closeRequest
  4726     "asks for permission before closing"
  4744     "asks for permission before closing"
  4727 
  4745 
  4850         fileListView invalidate
  4868         fileListView invalidate
  4851     ].
  4869     ].
  4852 
  4870 
  4853     "Modified: 29.5.1996 / 16:13:43 / cg"
  4871     "Modified: 29.5.1996 / 16:13:43 / cg"
  4854 ! !
  4872 ! !
       
  4873 
  4855 
  4874 
  4856 !FileBrowser methodsFor:'pathField user interaction'!
  4875 !FileBrowser methodsFor:'pathField user interaction'!
  4857 
  4876 
  4858 addDirToJavaClassPath
  4877 addDirToJavaClassPath
  4859     "add the current path to javas classPath
  4878     "add the current path to javas classPath
  5182 
  5201 
  5183     "Modified: 14.12.1996 / 15:37:47 / cg"
  5202     "Modified: 14.12.1996 / 15:37:47 / cg"
  5184     "Created: 2.8.1997 / 14:11:41 / cg"
  5203     "Created: 2.8.1997 / 14:11:41 / cg"
  5185 ! !
  5204 ! !
  5186 
  5205 
       
  5206 
  5187 !FileBrowser methodsFor:'private'!
  5207 !FileBrowser methodsFor:'private'!
  5188 
  5208 
  5189 ask:question yesButton:yesButtonText
  5209 ask:question yesButton:yesButtonText
  5190     "common method to ask a yes/no question; return true or false"
  5210     "common method to ask a yes/no question; return true or false"
  5191 
  5211 
  5362     showingHiddenFiles value ifTrue:[
  5382     showingHiddenFiles value ifTrue:[
  5363         ^ aCollection
  5383         ^ aCollection
  5364     ].
  5384     ].
  5365     ^ aCollection reject:[:fn | fn asFilename isHidden].
  5385     ^ aCollection reject:[:fn | fn asFilename isHidden].
  5366 ! !
  5386 ! !
       
  5387 
  5367 
  5388 
  5368 !FileBrowser methodsFor:'private-actions & command execution'!
  5389 !FileBrowser methodsFor:'private-actions & command execution'!
  5369 
  5390 
  5370 binaryFileAction:aFilename
  5391 binaryFileAction:aFilename
  5371     "for some binary files, if double clicked, we can do some useful
  5392     "for some binary files, if double clicked, we can do some useful
  5730 
  5751 
  5731     "Created: 19.6.1996 / 09:36:38 / cg"
  5752     "Created: 19.6.1996 / 09:36:38 / cg"
  5732     "Modified: 4.4.1997 / 10:49:00 / cg"
  5753     "Modified: 4.4.1997 / 10:49:00 / cg"
  5733     "Modified: 18.9.1997 / 16:58:40 / stefan"
  5754     "Modified: 18.9.1997 / 16:58:40 / stefan"
  5734 ! !
  5755 ! !
       
  5756 
  5735 
  5757 
  5736 !FileBrowser methodsFor:'private-directory stuff'!
  5758 !FileBrowser methodsFor:'private-directory stuff'!
  5737 
  5759 
  5738 changeToPreviousDirectory
  5760 changeToPreviousDirectory
  5739     "if text was modified show a queryBox, 
  5761     "if text was modified show a queryBox, 
  5986     ]
  6008     ]
  5987 
  6009 
  5988     "Modified: / 16.9.1997 / 15:35:52 / stefan"
  6010     "Modified: / 16.9.1997 / 15:35:52 / stefan"
  5989     "Modified: / 16.12.1998 / 22:55:44 / cg"
  6011     "Modified: / 16.12.1998 / 22:55:44 / cg"
  5990 ! !
  6012 ! !
       
  6013 
  5991 
  6014 
  5992 !FileBrowser methodsFor:'private-file I/O'!
  6015 !FileBrowser methodsFor:'private-file I/O'!
  5993 
  6016 
  5994 readFile:fileName
  6017 readFile:fileName
  5995     "read in the file, answer its contents as StringCollection"
  6018     "read in the file, answer its contents as StringCollection"
  6296 
  6319 
  6297     "Created: / 22.2.1996 / 15:03:10 / cg"
  6320     "Created: / 22.2.1996 / 15:03:10 / cg"
  6298     "Modified: / 18.9.1997 / 17:12:44 / stefan"
  6321     "Modified: / 18.9.1997 / 17:12:44 / stefan"
  6299     "Modified: / 6.5.1999 / 11:45:50 / cg"
  6322     "Modified: / 6.5.1999 / 11:45:50 / cg"
  6300 ! !
  6323 ! !
       
  6324 
  6301 
  6325 
  6302 !FileBrowser methodsFor:'private-file stuff'!
  6326 !FileBrowser methodsFor:'private-file stuff'!
  6303 
  6327 
  6304 doCreateFile:newName
  6328 doCreateFile:newName
  6305     "create an empty file"
  6329     "create an empty file"
  6652 
  6676 
  6653     "Modified: / 24-09-1997 / 09:20:00 / stefan"
  6677     "Modified: / 24-09-1997 / 09:20:00 / stefan"
  6654     "Modified: / 21-09-2006 / 18:34:45 / cg"
  6678     "Modified: / 21-09-2006 / 18:34:45 / cg"
  6655 ! !
  6679 ! !
  6656 
  6680 
       
  6681 
  6657 !FileBrowser methodsFor:'private-file type & info'!
  6682 !FileBrowser methodsFor:'private-file type & info'!
  6658 
  6683 
  6659 fileTypeSpecificActions
  6684 fileTypeSpecificActions
  6660     "any special fileTypeSpecific actions are done here,
  6685     "any special fileTypeSpecific actions are done here,
  6661      when a new file is selected"
  6686      when a new file is selected"
  6869         n := (size * 10 // 1024 // 1024 / 10.0).
  6894         n := (size * 10 // 1024 // 1024 / 10.0).
  6870         unitString := ' Mb'
  6895         unitString := ' Mb'
  6871     ].
  6896     ].
  6872     ^ (n printStringLeftPaddedTo:5) , unitString.
  6897     ^ (n printStringLeftPaddedTo:5) , unitString.
  6873 ! !
  6898 ! !
       
  6899 
  6874 
  6900 
  6875 !FileBrowser methodsFor:'private-presentation'!
  6901 !FileBrowser methodsFor:'private-presentation'!
  6876 
  6902 
  6877 defineTabulatorsForLongList
  6903 defineTabulatorsForLongList
  6878     "define the tabs for the long list"
  6904     "define the tabs for the long list"
  7463     "Modified: / 28.4.1997 / 22:30:30 / dq"
  7489     "Modified: / 28.4.1997 / 22:30:30 / dq"
  7464     "Modified: / 18.9.1997 / 18:28:30 / stefan"
  7490     "Modified: / 18.9.1997 / 18:28:30 / stefan"
  7465     "Modified: / 15.11.2001 / 23:49:03 / cg"
  7491     "Modified: / 15.11.2001 / 23:49:03 / cg"
  7466 ! !
  7492 ! !
  7467 
  7493 
       
  7494 
  7468 !FileBrowser methodsFor:'queries'!
  7495 !FileBrowser methodsFor:'queries'!
  7469 
  7496 
  7470 fileName
  7497 fileName
  7471     "return my current fileName - during fileIn, the file
  7498     "return my current fileName - during fileIn, the file
  7472      which is being loaded is returned.
  7499      which is being loaded is returned.
  7497     ^ currentDirectory pathName "/ asFilename osNameForDirectory
  7524     ^ currentDirectory pathName "/ asFilename osNameForDirectory
  7498 
  7525 
  7499     "Modified: / 12.8.1998 / 14:45:48 / cg"
  7526     "Modified: / 12.8.1998 / 14:45:48 / cg"
  7500 ! !
  7527 ! !
  7501 
  7528 
       
  7529 
  7502 !FileBrowser class methodsFor:'documentation'!
  7530 !FileBrowser class methodsFor:'documentation'!
  7503 
  7531 
  7504 version
  7532 version
  7505     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.643 2012/07/27 09:07:58 cg Exp $'
  7533     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.643 2012-07-27 09:07:58 cg Exp $'
  7506 !
  7534 !
  7507 
  7535 
  7508 version_CVS
  7536 version_CVS
  7509     ^ '§Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.643 2012/07/27 09:07:58 cg Exp §'
  7537     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.643 2012-07-27 09:07:58 cg Exp $'
  7510 !
  7538 !
  7511 
  7539 
  7512 version_SVN
  7540 version_SVN
  7513     ^ '$Id: FileBrowser.st 8048 2012-09-07 17:28:09Z vranyj1 $'
  7541     ^ '$Id: FileBrowser.st 8048 2012-09-07 17:28:09Z vranyj1 $'
  7514 ! !
  7542 ! !
       
  7543