equal
deleted
inserted
replaced
11 " |
11 " |
12 |
12 |
13 |
13 |
14 |
14 |
15 SelectionInTreeView subclass:#FileSelectionTree |
15 SelectionInTreeView subclass:#FileSelectionTree |
16 instanceVariableNames:'monitoringTask monitoringDelayTime fileIcons itemClass' |
16 instanceVariableNames:'triggerMonitorBlock monitoringDelayTime fileIcons itemClass' |
17 classVariableNames:'' |
17 classVariableNames:'' |
18 poolDictionaries:'' |
18 poolDictionaries:'' |
19 category:'Views-Text' |
19 category:'Views-Text' |
20 ! |
20 ! |
21 |
21 |
446 !FileSelectionTree methodsFor:'accessing monitoring'! |
446 !FileSelectionTree methodsFor:'accessing monitoring'! |
447 |
447 |
448 monitoring |
448 monitoring |
449 "returns true if monitor process is running |
449 "returns true if monitor process is running |
450 " |
450 " |
451 ^ monitoringTask notNil |
451 ^ triggerMonitorBlock notNil |
452 ! |
452 ! |
453 |
453 |
454 monitoring:aState |
454 monitoring:aState |
455 "enable or disable monitoring |
455 "enable or disable monitoring |
456 " |
456 " |
457 aState ifTrue:[ |
457 aState ifTrue:[ |
458 monitoringTask isNil ifTrue:[ |
458 triggerMonitorBlock notNil ifTrue:[^ self]. |
459 monitoringTask := [ [true] whileTrue:[ |
459 triggerMonitorBlock := [self sensor pushUserEvent:#monitorCycle for:self]. |
460 Delay waitForSeconds:(self monitoringDelayTime). |
460 Processor addTimedBlock:triggerMonitorBlock afterSeconds:(self monitoringDelayTime). |
461 self monitorCycle. |
|
462 ] |
|
463 ] forkAt:8. "/ to block parent task during running |
|
464 |
|
465 monitoringTask exitAction:[ monitoringTask := nil ]. |
|
466 ] |
|
467 ] ifFalse:[ |
461 ] ifFalse:[ |
468 monitoringTask notNil ifTrue:[ |
462 triggerMonitorBlock isNil ifTrue:[^ self]. |
469 monitoringTask terminate. |
463 Processor removeTimedBlock:triggerMonitorBlock. |
470 monitoringTask := nil. |
464 triggerMonitorBlock := nil. |
471 ] |
|
472 ]. |
465 ]. |
473 ! |
466 ! |
474 |
467 |
475 monitoringDelayTime |
468 monitoringDelayTime |
476 "delay time of monitoring task in seconds |
469 "delay time of monitoring task in seconds |
496 |
489 |
497 !FileSelectionTree methodsFor:'initialization'! |
490 !FileSelectionTree methodsFor:'initialization'! |
498 |
491 |
499 destroy |
492 destroy |
500 |
493 |
501 monitoringTask notNil ifTrue:[ |
494 triggerMonitorBlock notNil ifTrue:[ |
502 monitoringTask terminate |
495 Processor removeTimedBlock:triggerMonitorBlock. |
|
496 triggerMonitorBlock := nil |
503 ]. |
497 ]. |
504 super destroy. |
498 super destroy. |
505 |
499 |
506 ! |
500 ! |
507 |
501 |
642 monitorCycle |
636 monitorCycle |
643 "run monitor cycle |
637 "run monitor cycle |
644 " |
638 " |
645 |sz root sel new old| |
639 |sz root sel new old| |
646 |
640 |
647 (root := model root) isNil ifTrue:[ |
641 (root := model root) isNil ifFalse:[ |
648 ^ self |
642 root hasObsoleteNodes ifTrue:[ |
649 ]. |
643 (root repairObsoleteNodes) ifTrue:[ |
650 |
644 sz := self numberOfSelections. |
651 root hasObsoleteNodes ifFalse:[ |
645 |
652 ^ self |
646 sz ~~ 0 ifTrue:[ |
653 ]. |
647 old := self selection. |
654 (root repairObsoleteNodes) ifFalse:[ |
648 |
655 ^ self |
649 sz == 1 ifTrue:[ |
656 ]. |
650 sel := self selectedNode |
657 sz := self numberOfSelections. |
651 ] ifFalse:[ |
658 |
652 sel := OrderedCollection new. |
659 sz ~~ 0 ifTrue:[ |
653 self selectionDo:[:i| sel add:(listOfNodes at:i) ]. |
660 old := self selection. |
654 ]. |
661 |
655 selection := nil. |
662 sz == 1 ifTrue:[ |
656 ]. |
663 sel := self selectedNode |
657 selection := old. |
664 ] ifFalse:[ |
658 model root:root. |
665 sel := OrderedCollection new. |
659 |
666 self selectionDo:[:i| sel add:(listOfNodes at:i) ]. |
660 sz ~~ 0 ifTrue:[ |
667 ]. |
661 sz == 1 ifTrue:[ Transcript showCR:'lll'. |
668 selection := nil. |
662 self selectNode:sel. |
669 ]. |
663 ] ifFalse:[ |
670 model root:root. |
664 new := OrderedCollection new. |
671 |
665 |
672 sz ~~ 0 ifTrue:[ |
666 sel do:[:n||i| |
673 selection := old. |
667 (i := self indexOfNode:n) ~~ 0 ifTrue:[new add:i] |
674 |
668 ]. |
675 sz == 1 ifTrue:[ |
669 self selection:new |
676 self selectNode:sel |
670 ] |
677 ] ifFalse:[ |
671 ]. |
678 new := OrderedCollection new. |
672 ] |
679 |
|
680 sel do:[:n||i| |
|
681 (i := self indexOfNode:n) ~~ 0 ifTrue:[new add:i] |
|
682 ]. |
|
683 self selection:new |
|
684 ] |
673 ] |
685 ] |
674 ]. |
|
675 |
|
676 Processor addTimedBlock:triggerMonitorBlock afterSeconds:(self monitoringDelayTime). |
|
677 |
686 ! |
678 ! |
687 |
679 |
688 showFile:aPathname |
680 showFile:aPathname |
689 "show a file |
681 "show a file |
690 " |
682 " |
751 ! ! |
743 ! ! |
752 |
744 |
753 !FileSelectionTree class methodsFor:'documentation'! |
745 !FileSelectionTree class methodsFor:'documentation'! |
754 |
746 |
755 version |
747 version |
756 ^ '$Header: /cvs/stx/stx/libwidg2/FileSelectionTree.st,v 1.7 1997-10-22 13:26:06 ca Exp $' |
748 ^ '$Header: /cvs/stx/stx/libwidg2/FileSelectionTree.st,v 1.8 1997-10-22 15:47:35 ca Exp $' |
757 ! ! |
749 ! ! |