HierarchicalList.st
author Claus Gittinger <cg@exept.de>
Fri, 28 Jun 2019 09:21:50 +0200
changeset 6078 08c9e2a47dc5
parent 6001 15a9b4bd3190
child 6222 83324268c4d7
permissions -rw-r--r--
#OTHER by cg self class name -> self className
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5845
748062fd3dbe #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5836
diff changeset
     1
"{ Encoding: utf8 }"
748062fd3dbe #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5836
diff changeset
     2
1431
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     3
"
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     4
 COPYRIGHT (c) 1999 by eXept Software AG
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     5
              All Rights Reserved
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     6
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     7
 This software is furnished under a license and may be used
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     8
 only in accordance with the terms of that license and with the
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    10
 be provided or otherwise made available to, or used by, any
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    11
 other person.  No title to or ownership of the software is
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    12
 hereby transferred.
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    13
"
1751
bcba7dd03cbd move isHierarchicalItem to Object
ca
parents: 1733
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
bcba7dd03cbd move isHierarchicalItem to Object
ca
parents: 1733
diff changeset
    15
5216
50b4b75edc7b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
    16
"{ NameSpace: Smalltalk }"
50b4b75edc7b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
    17
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
List subclass:#HierarchicalList
5866
aa8328055393 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5859
diff changeset
    19
	instanceVariableNames:'root showRoot application monitoringTask monitoringTaskDelay
aa8328055393 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5859
diff changeset
    20
		additionalItemsToMonitorSemaphore'
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	classVariableNames:''
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	poolDictionaries:''
1430
ae9e48cc7b9d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
    23
	category:'Views-Support'
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
!HierarchicalList class methodsFor:'documentation'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
1431
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    28
copyright
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    29
"
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    30
 COPYRIGHT (c) 1999 by eXept Software AG
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    31
              All Rights Reserved
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    32
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    33
 This software is furnished under a license and may be used
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    34
 only in accordance with the terms of that license and with the
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    36
 be provided or otherwise made available to, or used by, any
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    37
 other person.  No title to or ownership of the software is
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    38
 hereby transferred.
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    39
"
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    40
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    41
!
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    42
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
documentation
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    Hierarchical Lists are mostly like List, but adding and removing
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    elements are handled by the items itself.
5289
4c068297c990 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5216
diff changeset
    47
    Special change notifications are emitted, 
4c068297c990 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5216
diff changeset
    48
    whenever the list is changed.
4c068297c990 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5216
diff changeset
    49
    I am used mostly by the HierarchicalListView widget;
4c068297c990 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5216
diff changeset
    50
    see comments there.    
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    [Instance variables:]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
        root        <HierarchicalItem>  first item into list
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
        showRoot    <Boolean>           show or hide root item
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
        application <Application>       the user is able to set an application
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
                                        which can be accessed by an item.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    [author:]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
        Claus Atzkern
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    [see also:]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
        HierarchicalItem
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
        HierarchicalListView
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1751
diff changeset
    66
!HierarchicalList methodsFor:'accessing-look'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
showRoot
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    "show or hide root item
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    "
2430
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
    71
    showRoot isNil ifTrue:[
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
    72
        showRoot := true
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
    73
    ].
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
    74
    ^ showRoot
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
showRoot:aBoolean
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    "show or hide root item
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    aBoolean ~~ self showRoot ifTrue:[
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
        showRoot := aBoolean.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
        root notNil ifTrue:[
1869
2d7fbc8d5429 expand root if not visible
ca
parents: 1818
diff changeset
    84
            showRoot ifTrue:[
2d7fbc8d5429 expand root if not visible
ca
parents: 1818
diff changeset
    85
                super addFirst:root
2d7fbc8d5429 expand root if not visible
ca
parents: 1818
diff changeset
    86
            ] ifFalse:[
2d7fbc8d5429 expand root if not visible
ca
parents: 1818
diff changeset
    87
                super removeFirst.
2d7fbc8d5429 expand root if not visible
ca
parents: 1818
diff changeset
    88
                root expand
2d7fbc8d5429 expand root if not visible
ca
parents: 1818
diff changeset
    89
            ]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
        ]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    ]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1751
diff changeset
    95
!HierarchicalList methodsFor:'accessing-monitoring task'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
monitoringTaskDelay
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    "get the delay time of the monitoring task measured  in seconds
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
     or nil( monitoring disabled ). The task runs through all items 
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
     of the list performing #monitoringCycle and than at end of the
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
     list the task is suspended for monitoringTaskDelay seconds.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    ^ monitoringTaskDelay
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
monitoringTaskDelay:inSecondsOrNil
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
    "set the delay time of the monitoring task measured  in seconds
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
     or nil( monitoring disabled ). The task runs through all items 
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
     of the list performing #monitoringCycle and than at end of the
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
     list the task is suspended for monitoringTaskDelay seconds.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    inSecondsOrNil isNil ifTrue:[
1439
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   113
        self stopMonitoringTask.
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   114
        monitoringTaskDelay := nil.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    ] ifFalse:[
1439
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   116
        monitoringTaskDelay := inSecondsOrNil.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
        self startMonitoringTask
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1751
diff changeset
   121
!HierarchicalList methodsFor:'accessing-mvc'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
1439
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   123
addDependent:anObject
5373
772578cec4f7 #OTHER by mawalch
mawalch
parents: 5289
diff changeset
   124
    "restart the monitoringTask if necessary
1439
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   125
    "
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   126
    super addDependent:anObject.
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   127
    self  startMonitoringTask.
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   128
!
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   129
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
application
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    "returns the responsible application; if no application is defined,
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
     nil is returned
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    ^ application
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
application:anApplication
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    "set the responsible application
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    "
1733
67c144581e63 add critical semaphore (RecursionLock)
ca
parents: 1616
diff changeset
   140
    application := anApplication.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
applicationsDo:aOneArgBlock
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
    "evaluate the block on each dependent application
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    |appl|
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    dependents notNil ifTrue:[
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
        dependents do:[:aDep|
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
            appl := aDep perform:#application ifNotUnderstood:nil.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
            appl notNil ifTrue:[
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
                aOneArgBlock value:appl
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
            ]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
        ]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    ]
1439
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   157
!
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   158
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   159
removeDependent:anObject
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   160
    "stop the monitoringTask if no more dependencies exists
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   161
    "
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   162
    super removeDependent:anObject.
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   163
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   164
    dependents size == 0 ifTrue:[
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   165
        self stopMonitoringTask
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   166
    ].
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   167
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1751
diff changeset
   170
!HierarchicalList methodsFor:'accessing-root'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
root
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    "get the root item
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    ^ root
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
5216
50b4b75edc7b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   179
root:aRootItem
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    "set the root item
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    "
4676
d793a43a8860 class: HierarchicalList
Claus Gittinger <cg@exept.de>
parents: 3848
diff changeset
   182
    |children|
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    self stopMonitoringTask.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
5216
50b4b75edc7b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   186
    "/ inlink the previous root
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
    root notNil ifTrue:[
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
        root parent:nil.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
        root := nil.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
5216
50b4b75edc7b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   192
    (root := aRootItem) isEmptyOrNil ifTrue:[
4676
d793a43a8860 class: HierarchicalList
Claus Gittinger <cg@exept.de>
parents: 3848
diff changeset
   193
        self removeAll.
d793a43a8860 class: HierarchicalList
Claus Gittinger <cg@exept.de>
parents: 3848
diff changeset
   194
    ] ifFalse:[
1869
2d7fbc8d5429 expand root if not visible
ca
parents: 1818
diff changeset
   195
        self showRoot ifFalse:[root expand].
2d7fbc8d5429 expand root if not visible
ca
parents: 1818
diff changeset
   196
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
        root parent:self.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
        children := OrderedCollection new.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
        self showRoot ifTrue:[children add:root].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
        root addVisibleChildrenTo:children.
4676
d793a43a8860 class: HierarchicalList
Claus Gittinger <cg@exept.de>
parents: 3848
diff changeset
   201
        "/ self removeAll.
d793a43a8860 class: HierarchicalList
Claus Gittinger <cg@exept.de>
parents: 3848
diff changeset
   202
        "/ self addAll:children beforeIndex:1.
d793a43a8860 class: HierarchicalList
Claus Gittinger <cg@exept.de>
parents: 3848
diff changeset
   203
        self contents:children.    
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
    self startMonitoringTask.
3070
c08536fb052f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2902
diff changeset
   206
c08536fb052f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2902
diff changeset
   207
    "Modified: / 12-09-2006 / 18:22:42 / cg"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
!HierarchicalList methodsFor:'private'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
1733
67c144581e63 add critical semaphore (RecursionLock)
ca
parents: 1616
diff changeset
   212
initContents:aSize
5867
ca24d06fbf12 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5866
diff changeset
   213
    "setup defaults"
ca24d06fbf12 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5866
diff changeset
   214
5866
aa8328055393 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5859
diff changeset
   215
    showRoot isNil ifTrue:[ showRoot := true ].
aa8328055393 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5859
diff changeset
   216
    optionalAccessLock isNil ifTrue:[
5867
ca24d06fbf12 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5866
diff changeset
   217
        self beSynchronized
5866
aa8328055393 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5859
diff changeset
   218
    ].
2430
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   219
1733
67c144581e63 add critical semaphore (RecursionLock)
ca
parents: 1616
diff changeset
   220
    ^ super initContents:aSize.
5498
797c3e694be7 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5373
diff changeset
   221
797c3e694be7 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5373
diff changeset
   222
    "Modified: / 23-02-2017 / 12:15:47 / stefan"
5574
47ec3072ecdf #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
   223
    "Modified: / 09-08-2017 / 11:54:58 / cg"
5866
aa8328055393 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5859
diff changeset
   224
    "Modified (format): / 01-08-2018 / 15:00:29 / Claus Gittinger"
5867
ca24d06fbf12 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5866
diff changeset
   225
    "Modified: / 01-08-2018 / 15:18:45 / Stefan Vogel"
1733
67c144581e63 add critical semaphore (RecursionLock)
ca
parents: 1616
diff changeset
   226
!
67c144581e63 add critical semaphore (RecursionLock)
ca
parents: 1616
diff changeset
   227
5997
dda46d10430a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5867
diff changeset
   228
itemAddAll:aListOfItems afterIndex:anIndex
dda46d10430a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5867
diff changeset
   229
    "insert all items after an index"
dda46d10430a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5867
diff changeset
   230
dda46d10430a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5867
diff changeset
   231
    self addAll:aListOfItems afterIndex:anIndex
dda46d10430a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5867
diff changeset
   232
dda46d10430a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5867
diff changeset
   233
    "Created: / 12-02-2019 / 17:19:43 / Claus Gittinger"
dda46d10430a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5867
diff changeset
   234
!
dda46d10430a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5867
diff changeset
   235
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
itemAddAll:aListOfItems beforeIndex:anIndex
5859
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   237
    "insert all items before an index"
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   238
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   239
    self addAll:aListOfItems beforeIndex:anIndex
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   240
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   241
    "Modified: / 30-07-2018 / 11:29:55 / Stefan Vogel"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
itemChanged:what with:aPara from:anItem
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
    "catch notification from item; throw changeNotifications
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
     to dependencies;
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
     **** don't know what to do with a parameter and argument what
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
     **** list protocol ****
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
    "
5859
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   250
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
    |index arrIdx "{ Class: SmallInteger }"|
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
5859
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   253
    (index := self identityIndexOf:anItem) ~~ 0 ifTrue:[
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
        arrIdx := index + firstIndex - 1.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
        contentsArray basicAt:arrIdx put:anItem.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
        dependents size ~~ 0 ifTrue:[
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
            what isNil ifTrue:[self changed:#at: with:index]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
                      ifFalse:[self changed:#at: with:(Array with:index with:what)]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
        ]
5859
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   261
    ].
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   262
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   263
    "Modified: / 30-07-2018 / 14:26:24 / Stefan Vogel"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
itemRemoveFromIndex:start toIndex:stop
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
    "remove the items stored under startIndex up to and including
5859
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   268
     the items under stopIndex."
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   269
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   270
    ^ self removeFromIndex:start toIndex:stop
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   271
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   272
    "Modified: / 30-07-2018 / 11:31:22 / Stefan Vogel"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
parentOrModel
5859
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   276
    "always returns nil"
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   277
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
    ^ nil
5859
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   279
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   280
    "Modified (comment): / 30-07-2018 / 11:31:33 / Stefan Vogel"
6001
15a9b4bd3190 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5997
diff changeset
   281
!
15a9b4bd3190 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5997
diff changeset
   282
15a9b4bd3190 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5997
diff changeset
   283
refreshContents
15a9b4bd3190 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5997
diff changeset
   284
    "for debugging - regenerate a fresh list, in case I am outdated"
15a9b4bd3190 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5997
diff changeset
   285
15a9b4bd3190 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5997
diff changeset
   286
    self root:root.
15a9b4bd3190 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5997
diff changeset
   287
15a9b4bd3190 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5997
diff changeset
   288
    "Created: / 13-02-2019 / 16:21:11 / Claus Gittinger"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
2493
8b70a26f1694 method category rename
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
   291
!HierarchicalList methodsFor:'private-monitoring task'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
1437
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   293
monitoringCycle
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   294
    "the block evaluated
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   295
    "
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   296
    |index item|
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   297
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   298
    item  := root.
2430
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   299
    index := 1.                 "/ on default discard first entry the root
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   300
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   301
    root isNil ifTrue:[
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   302
        item := self at:index ifAbsent:nil.
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   303
    ] ifFalse:[
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   304
        self showRoot ifFalse:[
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   305
            index := 0          "/ read list from begin
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   306
        ]
e50f234bf3fe access showRoot by method
ca
parents: 2412
diff changeset
   307
    ].
1437
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   308
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   309
    [item notNil] whileTrue:[
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   310
        item monitoringCycle.
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   311
        Processor yield.
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   312
        index := index + 1.
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   313
        item  := self at:index ifAbsent:nil.
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   314
    ]
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   315
!
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   316
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
startMonitoringTask
2223
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   318
    "start the monitoring task; backgrund process finishes, when no (more) dependencies exist,
2743
0ddd4c24c02d Remove unused variables
Stefan Vogel <sv@exept.de>
parents: 2493
diff changeset
   319
     and the additionalItemsToMonitorSemaphore is not signalled 
0ddd4c24c02d Remove unused variables
Stefan Vogel <sv@exept.de>
parents: 2493
diff changeset
   320
     (aka: no more background children to read)"
0ddd4c24c02d Remove unused variables
Stefan Vogel <sv@exept.de>
parents: 2493
diff changeset
   321
1439
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   322
    |name|
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   323
2744
21b90562122b Fix monitoring task starting (bug introduced in last version)
Stefan Vogel <sv@exept.de>
parents: 2743
diff changeset
   324
    (monitoringTask isNil
21b90562122b Fix monitoring task starting (bug introduced in last version)
Stefan Vogel <sv@exept.de>
parents: 2743
diff changeset
   325
        and:[self monitoringTaskDelay notNil
2743
0ddd4c24c02d Remove unused variables
Stefan Vogel <sv@exept.de>
parents: 2493
diff changeset
   326
        and:[(dependents size ~~ 0) or:[additionalItemsToMonitorSemaphore notNil]]]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
    ) ifTrue:[
3832
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   328
        monitoringTask := 
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   329
            [
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   330
                [(dependents size ~~ 0) or:[additionalItemsToMonitorSemaphore notNil]] whileTrue:[
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   331
                    self monitoringCycle.
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   332
                    additionalItemsToMonitorSemaphore isNil ifTrue:[
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   333
                        Delay waitForSeconds:self monitoringTaskDelay
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   334
                    ] ifFalse:[
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   335
                        additionalItemsToMonitorSemaphore waitWithTimeout:self monitoringTaskDelay.
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   336
                    ]
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   337
                ].
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   338
            ] newProcess.
2273
1a7a91282d3f priority range for monitoring task
penk
parents: 2258
diff changeset
   339
1a7a91282d3f priority range for monitoring task
penk
parents: 2258
diff changeset
   340
        monitoringTask priorityRange:(Processor userBackgroundPriority to:Processor activePriority).
2412
8c3d2548998e restart process after restart from image
penk
parents: 2273
diff changeset
   341
        monitoringTask restartable:true.
2273
1a7a91282d3f priority range for monitoring task
penk
parents: 2258
diff changeset
   342
        monitoringTask resume.
1437
3ff0d67ec0af separate monitoringCycle from startMonitoringCycle
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   343
1439
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   344
        name := application notNil ifTrue:[application class name] ifFalse:['???'].
ddcd6e87e406 wait for termination monitoringTask before continue
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
   345
        monitoringTask name:'HierarchicalList: ', name.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
    ^ true.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
stopMonitoringTask
2743
0ddd4c24c02d Remove unused variables
Stefan Vogel <sv@exept.de>
parents: 2493
diff changeset
   351
    "stop the monitoring task"
0ddd4c24c02d Remove unused variables
Stefan Vogel <sv@exept.de>
parents: 2493
diff changeset
   352
1616
be5eb8527f82 make stopMonitoring save
ca
parents: 1439
diff changeset
   353
    |task|
be5eb8527f82 make stopMonitoring save
ca
parents: 1439
diff changeset
   354
be5eb8527f82 make stopMonitoring save
ca
parents: 1439
diff changeset
   355
    (task := monitoringTask) notNil ifTrue:[
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
        monitoringTask := nil.
1616
be5eb8527f82 make stopMonitoring save
ca
parents: 1439
diff changeset
   357
3832
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   358
        Error 
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   359
            handle:[:ex| ] 
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   360
            do:[
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   361
                task terminateWithAllSubprocessesInGroup.
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   362
                task waitUntilTerminated.
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   363
            ]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
    ]
2223
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   365
!
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   366
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   367
triggerUpdateCycle
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   368
    additionalItemsToMonitorSemaphore isNil ifTrue:[
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   369
        [
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   370
            additionalItemsToMonitorSemaphore isNil ifTrue:[
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   371
                additionalItemsToMonitorSemaphore := Semaphore new.
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   372
            ].
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   373
        ] valueUninterruptably
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   374
    ].
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   375
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   376
    monitoringTaskDelay isNil ifTrue:[
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   377
        monitoringTaskDelay := 10
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   378
    ].
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   379
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   380
    additionalItemsToMonitorSemaphore signalOnce.
c34e7fd25e53 monitoring; delayed for directories; never for remoteDirectories
penk
parents: 1961
diff changeset
   381
    self startMonitoringTask.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
!HierarchicalList methodsFor:'protocol'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
childrenFor:anItem
5859
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   387
    "returns the children for an item or an empty list"
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   388
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
    ^ #()
5859
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   390
4c43266fca49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5845
diff changeset
   391
    "Modified (comment): / 30-07-2018 / 11:33:09 / Stefan Vogel"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
iconFor:anItem
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
    "returns the icon for an item or nil
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
    ^ nil
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
labelFor:anItem
3848
cf7b2e22806d changed: #labelFor:
Claus Gittinger <cg@exept.de>
parents: 3832
diff changeset
   401
    "returns the label for an item or nil"
cf7b2e22806d changed: #labelFor:
Claus Gittinger <cg@exept.de>
parents: 3832
diff changeset
   402
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
    ^ nil
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
middleButtonMenuFor:anItem
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
    "returns the middleButton menu for an item or nil
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
    ^ nil
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
!HierarchicalList class methodsFor:'documentation'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
version
5216
50b4b75edc7b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   417
    ^ '$Header$'
3832
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   418
!
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   419
602c293b4300 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3070
diff changeset
   420
version_CVS
5216
50b4b75edc7b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   421
    ^ '$Header$'
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
! !
4676
d793a43a8860 class: HierarchicalList
Claus Gittinger <cg@exept.de>
parents: 3848
diff changeset
   423