FileApplicationNoteBook.st
changeset 18236 1a5d0cc081b7
parent 17994 5bf3861b0696
child 18266 0e62cddf5604
equal deleted inserted replaced
18235:a20ddffb0618 18236:1a5d0cc081b7
    26 AbstractFileApplicationNoteBookComponent subclass:#ArchiveViewApplication
    26 AbstractFileApplicationNoteBookComponent subclass:#ArchiveViewApplication
    27 	instanceVariableNames:'archiveFileList enableStopButton fileTable currentSortOrder
    27 	instanceVariableNames:'archiveFileList enableStopButton fileTable currentSortOrder
    28 		selectionHolder tableColumns commandProcess errorListHolder
    28 		selectionHolder tableColumns commandProcess errorListHolder
    29 		viewErrorList temporaryDirectory enableRemoveErrorOutput
    29 		viewErrorList temporaryDirectory enableRemoveErrorOutput
    30 		errorListVisibilityHolder hasListEntriesHolder archiver process
    30 		errorListVisibilityHolder hasListEntriesHolder archiver process
    31 		terminateByMe columnDescriptors inDropMode'
    31 		terminateByMe columnDescriptors inDropMode selectionIndexHolder'
    32 	classVariableNames:''
    32 	classVariableNames:'LastSearchedInName'
    33 	poolDictionaries:''
    33 	poolDictionaries:''
    34 	privateIn:FileApplicationNoteBook
    34 	privateIn:FileApplicationNoteBook
    35 !
    35 !
    36 
    36 
    37 Object subclass:#ArchivItem
    37 Object subclass:#ArchivItem
  1473     "
  1473     "
  1474 
  1474 
  1475     <resource: #canvas>
  1475     <resource: #canvas>
  1476 
  1476 
  1477     ^ 
  1477     ^ 
  1478      #(#FullSpec
  1478     #(FullSpec
  1479         #name: #windowSpec
  1479        name: windowSpec
  1480         #window: 
  1480        uuid: '7d0661ea-7553-11e8-9d37-b8f6b1108e05'
  1481        #(#WindowSpec
  1481        window: 
  1482           #label: 'Archive Application'
  1482       (WindowSpec
  1483           #name: 'Archive Application'
  1483          label: 'Archive Application'
  1484           #min: #(#Point 10 10)
  1484          name: 'Archive Application'
  1485           #bounds: #(#Rectangle 16 46 692 538)
  1485          uuid: '7d066460-7553-11e8-9d37-b8f6b1108e05'
  1486           #menu: #mainMenu
  1486          min: (Point 10 10)
  1487         )
  1487          bounds: (Rectangle 0 0 676 492)
  1488         #component: 
  1488          menu: mainMenu
  1489        #(#SpecCollection
  1489        )
  1490           #collection: #(
  1490        component: 
  1491            #(#MenuPanelSpec
  1491       (SpecCollection
  1492               #name: 'MenuArchive'
  1492          collection: (
  1493               #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0)
  1493           (MenuPanelSpec
  1494               #level: 0
  1494              name: 'MenuArchive'
  1495               #menu: #menu
  1495              layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0)
  1496               #textDefault: true
  1496              uuid: '7d066668-7553-11e8-9d37-b8f6b1108e05'
  1497             )
  1497              level: 0
  1498            #(#'FileBrowserV2UISpecifications::PanelSpec'
  1498              menu: menu
  1499               #name: 'VerticalPanel'
  1499              textDefault: true
  1500               #layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0)
  1500            )
  1501               #level: 0
  1501           (#'FileBrowserV2UISpecifications::PanelSpec'
  1502               #whichView: #last
  1502              name: 'VerticalPanel'
  1503               #orientation: #vertical
  1503              layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0)
  1504               #visibility: #errorListVisibilityHolder
  1504              uuid: '7d06688e-7553-11e8-9d37-b8f6b1108e05'
  1505               #component: 
  1505              level: 0
  1506              #(#SpecCollection
  1506              whichView: last
  1507                 #collection: #(
  1507              orientation: vertical
  1508                  #(#DataSetSpec
  1508              visibility: errorListVisibilityHolder
  1509                     #name: 'Table1'
  1509              component: 
  1510                     #model: #selectionHolder
  1510             (SpecCollection
  1511                     #menu: #fileListMenu
  1511                collection: (
  1512                     #hasHorizontalScrollBar: true
  1512                 (DataSetSpec
  1513                     #hasVerticalScrollBar: true
  1513                    name: 'Table1'
  1514                     #dataList: #archiveFileList
  1514                    uuid: '7d066a8c-7553-11e8-9d37-b8f6b1108e05'
  1515                     #useIndex: false
  1515                    model: selectionIndexHolder
  1516                     #has3Dsepartors: false
  1516                    menu: fileListMenu
  1517                     #doubleClickSelector: #dblClick
  1517                    hasHorizontalScrollBar: true
  1518                     #columnHolder: #tableColumns
  1518                    hasVerticalScrollBar: true
  1519                     #multipleSelectOk: true
  1519                    dataList: archiveFileList
  1520                     #verticalSpacing: 0
  1520                    doubleClickSelector: dblClick
  1521                     #postBuildCallback: #postBuildFileTable:
  1521                    columnHolder: tableColumns
  1522                     #properties: 
  1522                    multipleSelectOk: true
  1523                    #(#PropertyListDictionary
  1523                    verticalSpacing: 0
  1524                       #enterSelector: #dropEnter:
  1524                    postBuildCallback: postBuildFileTable:
  1525                       #dragArgument: #archivApplication
  1525                    properties: 
  1526                       #startDragSelector: #doStartDrag:in:
  1526                   (PropertyListDictionary
  1527                       #displayObjectSelector: #getDisplayObjects:
  1527                      leaveSelector: dropLeave:
  1528                       #dropObjectSelector: #getDropObjects:
  1528                      startDragSelector: doStartDrag:in:
  1529                       #overSelector: nil
  1529                      overSelector: nil
  1530                       #dropArgument: #archivApplication
  1530                      dragArgument: archivApplication
  1531                       #canDropSelector: #canDrop:
  1531                      dropSelector: doDrop:
  1532                       #leaveSelector: #dropLeave:
  1532                      canDropSelector: canDrop:
  1533                       #dropSelector: #doDrop:
  1533                      dropObjectSelector: getDropObjects:
  1534                     )
  1534                      enterSelector: dropEnter:
  1535                   )
  1535                      dropArgument: archivApplication
  1536                  #(#SequenceViewSpec
  1536                      displayObjectSelector: getDisplayObjects:
  1537                     #name: 'ErrorList'
  1537                    )
  1538                     #initiallyDisabled: true
       
  1539                     #hasHorizontalScrollBar: true
       
  1540                     #hasVerticalScrollBar: true
       
  1541                     #backgroundColor: #(#Color 100.0 100.0 100.0)
       
  1542                     #isMultiSelect: true
       
  1543                     #useIndex: false
       
  1544                     #sequenceList: #errorListHolder
       
  1545                   )
       
  1546                  )
  1538                  )
  1547                
  1539                 (SequenceViewSpec
  1548               )
  1540                    name: 'ErrorList'
  1549               #handles: #(#Any 0.5 1.0)
  1541                    uuid: '7d066e1a-7553-11e8-9d37-b8f6b1108e05'
  1550             )
  1542                    initiallyDisabled: true
       
  1543                    hasHorizontalScrollBar: true
       
  1544                    hasVerticalScrollBar: true
       
  1545                    backgroundColor: (Color 100.0 100.0 100.0)
       
  1546                    isMultiSelect: true
       
  1547                    useIndex: false
       
  1548                    sequenceList: errorListHolder
       
  1549                  )
       
  1550                 )
       
  1551               
       
  1552              )
       
  1553              handles: (Any 0.5 1.0)
  1551            )
  1554            )
  1552          
  1555           )
  1553         )
  1556         
  1554       )
  1557        )
       
  1558      )
  1555 ! !
  1559 ! !
  1556 
  1560 
  1557 !FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'menu specs'!
  1561 !FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'menu specs'!
  1558 
  1562 
  1559 fileListMenu
  1563 fileListMenu
  1575         #(
  1579         #(
  1576          #(#MenuItem
  1580          #(#MenuItem
  1577             #enabled: #hasListEntriesHolder
  1581             #enabled: #hasListEntriesHolder
  1578             #label: 'Select All'
  1582             #label: 'Select All'
  1579             #itemValue: #selectAll
  1583             #itemValue: #selectAll
       
  1584             #translateLabel: true
       
  1585           )
       
  1586          #(#MenuItem
       
  1587             #enabled: #hasListEntriesHolder
       
  1588             #label: 'Find in Name...'
       
  1589             #itemValue: #findInName
  1580             #translateLabel: true
  1590             #translateLabel: true
  1581           )
  1591           )
  1582          #(#MenuItem
  1592          #(#MenuItem
  1583             #label: '-'
  1593             #label: '-'
  1584           )
  1594           )
  1609             #translateLabel: true
  1619             #translateLabel: true
  1610             #shortcutKey: #Delete
  1620             #shortcutKey: #Delete
  1611           )
  1621           )
  1612          #(#MenuItem
  1622          #(#MenuItem
  1613             #label: '-'
  1623             #label: '-'
       
  1624             "/ #isVisible: #closeButtonShown
  1614           )
  1625           )
  1615          #(#MenuItem
  1626          #(#MenuItem
  1616             #enabled: #canViewFile
  1627             #enabled: #canViewFile
  1617             #label: 'Show Contents'
  1628             #label: 'Show Contents'
  1618             #itemValue: #viewFile
  1629             #itemValue: #viewFile
  1619             #translateLabel: true
  1630             #translateLabel: true
  1620             #isVisible: #closeButtonShown
  1631             "/ #isVisible: #closeButtonShown
  1621           )
  1632           )
  1622          )
  1633          )
  1623         nil
  1634         nil
  1624         nil
  1635         nil
  1625       )
  1636       )
  1626 
  1637 
  1627     "Modified: / 12-01-2012 / 00:34:13 / cg"
  1638     "Modified: / 12-01-2012 / 00:34:13 / cg"
       
  1639     "Modified: / 21-06-2018 / 14:58:39 / Claus Gittinger"
  1628 !
  1640 !
  1629 
  1641 
  1630 menu
  1642 menu
  1631     "This resource specification was automatically generated
  1643     "This resource specification was automatically generated
  1632      by the MenuEditor of ST/X."
  1644      by the MenuEditor of ST/X."
  1937         ^ true
  1949         ^ true
  1938     ]. 
  1950     ]. 
  1939     ^ false
  1951     ^ false
  1940 !
  1952 !
  1941 
  1953 
       
  1954 selection
       
  1955     ^ self selectionHolder value.
       
  1956 
       
  1957     "Created: / 21-06-2018 / 15:04:24 / Claus Gittinger"
       
  1958 !
       
  1959 
  1942 temporaryDirectory
  1960 temporaryDirectory
  1943     "return the value of the instance variable 'temporaryDirectory' (automatically generated)"
  1961     "return the value of the instance variable 'temporaryDirectory' (automatically generated)"
  1944 
  1962 
  1945     temporaryDirectory isNil ifTrue:[
  1963     temporaryDirectory isNil ifTrue:[
  1946         temporaryDirectory := Filename newTemporaryDirectory.
  1964         temporaryDirectory := Filename newTemporaryDirectory.
  1961 
  1979 
  1962     self archiveFileList value removeAll.
  1980     self archiveFileList value removeAll.
  1963 !
  1981 !
  1964 
  1982 
  1965 copyFilesToClipboard
  1983 copyFilesToClipboard
       
  1984     "copy the names of the selected files to the clipboard"
       
  1985     
  1966     |sel list stream|
  1986     |sel list stream|
  1967 
  1987 
  1968     sel := self selectionHolder value.
  1988     sel := self selection.
  1969     list := self archiveFileList.
  1989     list := self archiveFileList.
  1970     (sel notEmptyOrNil) ifTrue:[
  1990     (sel notEmptyOrNil) ifTrue:[
  1971         stream := CharacterWriteStream new.
  1991         stream := CharacterWriteStream new.
  1972         sel do:[: key |
  1992         sel do:[: key |
  1973             stream nextPutAll:(key fileName asString).
  1993             stream nextPutAll:(key fileName asString).
  1975         ].
  1995         ].
  1976         self window setClipboardText:stream contents.
  1996         self window setClipboardText:stream contents.
  1977     ].
  1997     ].
  1978 
  1998 
  1979     "Modified (format): / 29-11-2011 / 18:57:40 / cg"
  1999     "Modified (format): / 29-11-2011 / 18:57:40 / cg"
       
  2000     "Modified (comment): / 21-06-2018 / 15:05:13 / Claus Gittinger"
  1980 !
  2001 !
  1981 
  2002 
  1982 dblClick
  2003 dblClick
  1983 
  2004 
  1984     self viewFile.
  2005     self viewFile.
  1995     self enableStopButton value:false.
  2016     self enableStopButton value:false.
  1996 
  2017 
  1997     "Modified (format): / 29-11-2011 / 18:57:50 / cg"
  2018     "Modified (format): / 29-11-2011 / 18:57:50 / cg"
  1998 !
  2019 !
  1999 
  2020 
       
  2021 findInName
       
  2022 
       
  2023     |selIndices pattern startIndex listOfFiles|
       
  2024 
       
  2025     pattern := Dialog request:'Find in Name:'
       
  2026                       initialAnswer:LastSearchedInName.
       
  2027     pattern isEmptyOrNil ifTrue:[
       
  2028         ^ self
       
  2029     ].    
       
  2030     LastSearchedInName := pattern.
       
  2031     
       
  2032     selIndices := self selectionIndexHolder value.
       
  2033     selIndices isEmpty ifTrue:[ selIndices := #(1) ].
       
  2034     startIndex := (selIndices min max:1) + 1.
       
  2035 
       
  2036     listOfFiles := self archiveFileList value.
       
  2037 
       
  2038     startIndex to:(listOfFiles size) do:[:idx |
       
  2039         |item|
       
  2040         
       
  2041         item := listOfFiles at:idx.
       
  2042         (item fileName includesString:pattern caseSensitive:false) ifTrue:[
       
  2043             self selectionIndexHolder value:(Array with:idx).
       
  2044             ^ self
       
  2045         ].    
       
  2046     ].
       
  2047     self device beep.
       
  2048 
       
  2049     "Created: / 21-06-2018 / 15:00:31 / Claus Gittinger"
       
  2050 !
       
  2051 
  2000 removeErrorOutput
  2052 removeErrorOutput
  2001 
  2053 
  2002     self viewErrorList value:false.
  2054     self viewErrorList value:false.
  2003     self errorListHolder removeAll.
  2055     self errorListHolder removeAll.
  2004 !
  2056 !
  2010         temporaryDirectory := nil.
  2062         temporaryDirectory := nil.
  2011     ].
  2063     ].
  2012 !
  2064 !
  2013 
  2065 
  2014 selectAll
  2066 selectAll
  2015 
  2067     |sel listOfFiles|
  2016     | sel listOfFiles|
  2068 
  2017 
       
  2018     sel := OrderedCollection new.
       
  2019     listOfFiles := self archiveFileList value.
  2069     listOfFiles := self archiveFileList value.
  2020     1 to:(listOfFiles size) do:[ : el |
  2070 "/    sel := OrderedCollection new.
  2021         sel add:el
  2071 "/    1 to:(listOfFiles size) do:[:el |
  2022     ].
  2072 "/        sel add:el
  2023     self selectionHolder value:sel.
  2073 "/    ].
       
  2074 "/    self selectionHolder value:sel.
       
  2075     self selectionIndexHolder value:(1 to:(listOfFiles size)).
       
  2076 
       
  2077     "Modified: / 21-06-2018 / 15:07:08 / Claus Gittinger"
  2024 !
  2078 !
  2025 
  2079 
  2026 updateFileBrowserIfPresentWith:aDirectory
  2080 updateFileBrowserIfPresentWith:aDirectory
  2027 
  2081 
  2028     | master|
  2082     | master|
  2037 
  2091 
  2038     | master item file tempDir|
  2092     | master item file tempDir|
  2039 
  2093 
  2040     self canViewFile ifFalse:[^ self].
  2094     self canViewFile ifFalse:[^ self].
  2041     master := self masterApplication.
  2095     master := self masterApplication.
  2042     self selectionHolder value size = 1 ifFalse:[
  2096     self selection size = 1 ifFalse:[
  2043         Dialog warn:'only one file have to be selected'.
  2097         Dialog warn:'only one file has to be selected'.
  2044         ^ self.
  2098         ^ self.
  2045     ].
  2099     ].
  2046     tempDir := self temporaryDirectory.
  2100     tempDir := self temporaryDirectory.
  2047     self extractSelectedFilesTo:tempDir askForExtractOptions:false.
  2101     self extractSelectedFilesTo:tempDir askForExtractOptions:false.
  2048     process notNil ifTrue:[
  2102     process notNil ifTrue:[
  2053         item := DirectoryContentsBrowser itemClass fileName:file.
  2107         item := DirectoryContentsBrowser itemClass fileName:file.
  2054     ].
  2108     ].
  2055     master notNil ifTrue:[
  2109     master notNil ifTrue:[
  2056         master openApplByFileItem:item.
  2110         master openApplByFileItem:item.
  2057     ].
  2111     ].
       
  2112 
       
  2113     "Modified: / 21-06-2018 / 15:07:23 / Claus Gittinger"
  2058 ! !
  2114 ! !
  2059 
  2115 
  2060 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'aspects'!
  2116 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'aspects'!
  2061 
  2117 
  2062 archiveFileList
  2118 archiveFileList
  2102 !
  2158 !
  2103 
  2159 
  2104 hasSelectionInList
  2160 hasSelectionInList
  2105     | sel |
  2161     | sel |
  2106 
  2162 
  2107     sel := self selectionHolder value.
  2163     sel := self selection.
  2108     ^ sel notEmptyOrNil
  2164     ^ sel notEmptyOrNil
       
  2165 
       
  2166     "Modified: / 21-06-2018 / 15:05:54 / Claus Gittinger"
  2109 !
  2167 !
  2110 
  2168 
  2111 selectionHolder
  2169 selectionHolder
  2112     selectionHolder isNil ifTrue:[
  2170     selectionHolder isNil ifTrue:[
  2113         selectionHolder := ValueHolder new.
  2171         selectionHolder := ValueHolder new.
  2114         selectionHolder addDependent:self.
  2172         selectionHolder addDependent:self.
  2115     ].
  2173     ].
  2116     ^ selectionHolder.
  2174     ^ selectionHolder.
  2117 !
  2175 !
  2118 
  2176 
       
  2177 selectionIndexHolder
       
  2178     selectionIndexHolder isNil ifTrue:[
       
  2179         selectionIndexHolder := ValueHolder new.
       
  2180         selectionIndexHolder addDependent:self.
       
  2181     ].
       
  2182     ^ selectionIndexHolder.
       
  2183 
       
  2184     "Created: / 21-06-2018 / 15:03:42 / Claus Gittinger"
       
  2185 !
       
  2186 
  2119 tableColumns
  2187 tableColumns
  2120 
  2188 
  2121     tableColumns isNil ifTrue:[
  2189     tableColumns isNil ifTrue:[
  2122         tableColumns := self class tableColumns asValue.
  2190         tableColumns := self class tableColumns asValue.
  2123     ].
  2191     ].
  2135 ! !
  2203 ! !
  2136 
  2204 
  2137 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'change & update'!
  2205 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'change & update'!
  2138 
  2206 
  2139 update:something with:aParameter from:changedObject
  2207 update:something with:aParameter from:changedObject
       
  2208     changedObject == selectionIndexHolder ifTrue:[
       
  2209         self selectionHolder value:(self selectionIndexHolder value 
       
  2210                                         collect:[:idx | self archiveFileList at:idx ifAbsent:nil]).
       
  2211         ^ self
       
  2212     ].
       
  2213 
  2140     changedObject == self archiveFileList ifTrue:[
  2214     changedObject == self archiveFileList ifTrue:[
  2141         self hasListEntriesHolder value:(changedObject notEmpty).
  2215         self hasListEntriesHolder value:(changedObject notEmpty).
  2142         ^ self
  2216         ^ self
  2143     ].
  2217     ].
  2144     super update:something with:aParameter from:changedObject
  2218     super update:something with:aParameter from:changedObject
       
  2219 
       
  2220     "Modified: / 21-06-2018 / 15:15:17 / Claus Gittinger"
  2145 !
  2221 !
  2146 
  2222 
  2147 viewErrorListChanged
  2223 viewErrorListChanged
  2148 
  2224 
  2149     | viewListValue|
  2225     | viewListValue|
  2414 extractSelectionTo:aDirectory askForExtractOptions:askForExtractOptionsBoolean
  2490 extractSelectionTo:aDirectory askForExtractOptions:askForExtractOptionsBoolean
  2415     |  sel index extractWithDirectoryPart extractAllFilesInSelectedDirectories extractFiles|
  2491     |  sel index extractWithDirectoryPart extractAllFilesInSelectedDirectories extractFiles|
  2416 
  2492 
  2417     extractWithDirectoryPart := true.
  2493     extractWithDirectoryPart := true.
  2418     extractAllFilesInSelectedDirectories := false.
  2494     extractAllFilesInSelectedDirectories := false.
  2419     sel := self selectionHolder value.
  2495     sel := self selection.
  2420     (sel isEmptyOrNil) ifTrue:[
  2496     (sel isEmptyOrNil) ifTrue:[
  2421         sel := self archiveFileList value.
  2497         sel := self archiveFileList value.
  2422     ].
  2498     ].
  2423     sel := sel do:[:item|
  2499     sel := sel do:[:item|
  2424         item fileName: item fileName
  2500         item fileName: item fileName
  2442         self extractWithOutDirectoryPartTo:aDirectory with:extractFiles.
  2518         self extractWithOutDirectoryPartTo:aDirectory with:extractFiles.
  2443     ].
  2519     ].
  2444     ^ true
  2520     ^ true
  2445 
  2521 
  2446     "Modified (format): / 29-11-2011 / 18:57:54 / cg"
  2522     "Modified (format): / 29-11-2011 / 18:57:54 / cg"
       
  2523     "Modified: / 21-06-2018 / 15:05:20 / Claus Gittinger"
  2447 !
  2524 !
  2448 
  2525 
  2449 extractWithDirectoryPartTo:aDirectory with:extractFiles
  2526 extractWithDirectoryPartTo:aDirectory with:extractFiles
  2450     self archiver 
  2527     self archiver 
  2451         outStream:nil 
  2528         outStream:nil 
  2507 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands remove'!
  2584 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands remove'!
  2508 
  2585 
  2509 removeFilesFromArchive
  2586 removeFilesFromArchive
  2510     |sel realSel list firtsPre stringCol stringRealSel|
  2587     |sel realSel list firtsPre stringCol stringRealSel|
  2511 
  2588 
  2512     sel := self selectionHolder value.
  2589     sel := self selection.
  2513     stringCol := sel collect:[:item | item fileName].
  2590     stringCol := sel collect:[:item | item fileName].
  2514     firtsPre := stringCol at:1.
  2591     firtsPre := stringCol at:1.
  2515     stringCol from:2 do:[:el | firtsPre := firtsPre commonPrefixWith:el].
  2592     stringCol from:2 do:[:el | firtsPre := firtsPre commonPrefixWith:el].
  2516     list := self archiveFileList value.
  2593     list := self archiveFileList value.
  2517 "/    realSel := OrderedCollection new.
  2594 "/    realSel := OrderedCollection new.
  2529         synchron:true.
  2606         synchron:true.
  2530     self 
  2607     self 
  2531         makeProcessFor:[ self archiver removeFilesFromArchive:stringCol ]
  2608         makeProcessFor:[ self archiver removeFilesFromArchive:stringCol ]
  2532         with:'Remove files'.
  2609         with:'Remove files'.
  2533     self archiveFileList value removeAllFoundIn:realSel
  2610     self archiveFileList value removeAllFoundIn:realSel
       
  2611 
       
  2612     "Modified: / 21-06-2018 / 15:05:58 / Claus Gittinger"
  2534 ! !
  2613 ! !
  2535 
  2614 
  2536 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'drag & drop'!
  2615 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'drag & drop'!
  2537 
  2616 
  2538 canDrop:aContext
  2617 canDrop:aContext
  2585 getDisplayObjects:anArgument
  2664 getDisplayObjects:anArgument
  2586     "retrieve the objects displayed during a drag"
  2665     "retrieve the objects displayed during a drag"
  2587 
  2666 
  2588     | sel string size fnName stream|
  2667     | sel string size fnName stream|
  2589 
  2668 
  2590     sel := self selectionHolder value.
  2669     sel := self selection.
  2591     size := sel size.
  2670     size := sel size.
  2592     size == 0  ifTrue:[^ ''].
  2671     size == 0  ifTrue:[^ ''].
  2593 
  2672 
  2594     stream := CharacterWriteStream new.
  2673     stream := CharacterWriteStream new.
  2595     stream nextPutAll:(sel first fileName asFilename baseName asString).
  2674     stream nextPutAll:(sel first fileName asFilename baseName asString).
  2603     string := stream contents.
  2682     string := stream contents.
  2604 
  2683 
  2605     ^ Array with:(LabelAndIcon icon:(Image fromFile:fnName) string:(string allBold))
  2684     ^ Array with:(LabelAndIcon icon:(Image fromFile:fnName) string:(string allBold))
  2606 
  2685 
  2607     "Modified: / 20-06-2017 / 08:18:07 / cg"
  2686     "Modified: / 20-06-2017 / 08:18:07 / cg"
       
  2687     "Modified: / 21-06-2018 / 15:05:39 / Claus Gittinger"
  2608 !
  2688 !
  2609 
  2689 
  2610 getDropObjects:anArgument
  2690 getDropObjects:anArgument
  2611     "common code, used in subclasses"
  2691     "common code, used in subclasses"
  2612 
  2692 
  2613     |sel|
  2693     |sel|
  2614 
  2694 
  2615     sel := self selectionHolder value.
  2695     sel := self selection.
  2616     ^ sel collect:[:el| DropObject newFileInArchive:(el fileName asFilename) ].
  2696     ^ sel collect:[:el| DropObject newFileInArchive:(el fileName asFilename) ].
       
  2697 
       
  2698     "Modified: / 21-06-2018 / 15:05:45 / Claus Gittinger"
  2617 ! !
  2699 ! !
  2618 
  2700 
  2619 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'event handling'!
  2701 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'event handling'!
  2620 
  2702 
  2621 processEvent:anEvent 
  2703 processEvent:anEvent 
  2622     "filter keyboard events.
  2704     "filter keyboard events.
  2623      Return true, if I have eaten the event"
  2705      Return true, if I have eaten the event"
  2624 
  2706 
  2625     <resource: #keyboard (#Delete )>
  2707     <resource: #keyboard (#Delete #Find)>
  2626 
  2708 
  2627     |focusView key rawKey|
  2709     |focusView key rawKey|
  2628 
  2710 
  2629     anEvent isKeyPressEvent ifTrue:[
  2711     anEvent isKeyPressEvent ifTrue:[
  2630         focusView := anEvent targetView.
  2712         focusView := anEvent targetView.
  2631         key := anEvent key.
  2713         key := anEvent key.
  2632         rawKey := anEvent rawKey.
  2714         rawKey := anEvent rawKey.
       
  2715         
  2633         (focusView isSameOrComponentOf:self window) ifTrue:[
  2716         (focusView isSameOrComponentOf:self window) ifTrue:[
  2634             (key == #Delete) ifTrue:[
  2717             (key == #Delete) ifTrue:[
  2635                 self removeFilesFromArchive.
  2718                 self removeFilesFromArchive.
  2636                 ^ true
  2719                 ^ true
       
  2720             ].
       
  2721             (key == #Find) ifTrue:[
       
  2722                 self findInName.
       
  2723                 ^ true
  2637             ]
  2724             ]
  2638         ]
  2725         ]
  2639     ].
  2726     ].
  2640     ^ false
  2727     ^ false
       
  2728 
       
  2729     "Modified: / 21-06-2018 / 15:20:57 / Claus Gittinger"
  2641 ! !
  2730 ! !
  2642 
  2731 
  2643 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'initialization & release'!
  2732 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'initialization & release'!
  2644 
  2733 
  2645 postBuildFileTable:aWidget
  2734 postBuildFileTable:aWidget
  2684 release
  2773 release
  2685     self archiver release.
  2774     self archiver release.
  2686     super release.
  2775     super release.
  2687 ! !
  2776 ! !
  2688 
  2777 
       
  2778 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'menus'!
       
  2779 
       
  2780 fileListMenu
       
  2781     ^ [ self class fileListMenu ].
       
  2782 
       
  2783     "Created: / 21-06-2018 / 15:01:53 / Claus Gittinger"
       
  2784 ! !
       
  2785 
  2689 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'queries'!
  2786 !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'queries'!
  2690 
  2787 
  2691 canDelete
  2788 canDelete
  2692 
  2789 
  2693     ^ (self hasOneSelectionInList and:[archiver class canRemoveFiles])
  2790     ^ (self hasOneSelectionInList and:[archiver class canRemoveFiles])
  2708 !
  2805 !
  2709 
  2806 
  2710 hasOneSelectionInList
  2807 hasOneSelectionInList
  2711 
  2808 
  2712     | sel |
  2809     | sel |
  2713     sel := self selectionHolder value.
  2810     sel := self selection.
  2714     ^ (sel notNil and:[sel notEmpty and:[sel size = 1]])
  2811     ^ (sel notNil and:[sel notEmpty and:[sel size = 1]])
       
  2812 
       
  2813     "Modified: / 21-06-2018 / 15:05:50 / Claus Gittinger"
  2715 !
  2814 !
  2716 
  2815 
  2717 selRemoveFilesForDirs:aSel
  2816 selRemoveFilesForDirs:aSel
  2718 
  2817 
  2719     |stringCol newSel string|
  2818     |stringCol newSel string|