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 |
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." |
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 ! |
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:[ |
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 |
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. |
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 |