HierarchicalClassRevisionList.st
author ps
Tue, 15 Feb 2000 17:49:32 +0100
changeset 2613 4dd07aefaf20
child 2625 d70f0361a027
permissions -rw-r--r--
initial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2613
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
     1
HierarchicalList subclass:#HierarchicalClassRevisionList
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
     2
	instanceVariableNames:'itemComputationList semaphoreCritical itemTask currentItemInTask
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
     3
		dataColl'
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
     4
	classVariableNames:'Lobby'
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
     5
	poolDictionaries:''
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
     6
	category:'Interface-Browsers-Support'
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
     7
!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
     8
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
     9
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    10
!HierarchicalClassRevisionList class methodsFor:'instance creation'!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    11
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    12
new
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    13
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    14
    ^ super new initialize
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    15
! !
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    16
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    17
!HierarchicalClassRevisionList methodsFor:'accessing'!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    18
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    19
dataColl
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    20
    "return the value of the instance variable 'classRevisionColl' (automatically generated)"
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    21
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    22
    ^ dataColl
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    23
!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    24
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    25
dataColl:something
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    26
    "set the value of the instance variable 'classRevisionColl' (automatically generated)"
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    27
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    28
    dataColl := something.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    29
!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    30
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    31
icons
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    32
"
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    33
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    34
<return: Dictionary of: Symbol->Image>
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    35
"
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    36
    |icons|
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    37
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    38
    icons := Dictionary new.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    39
    icons at:#loadedRevision put:(Smalltalk imageFromFileNamed:'red_ball.xpm' forClass:self class).
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    40
    icons at:#unloadedRevision put:(Smalltalk imageFromFileNamed:'green_ball.xpm' forClass:self class).
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    41
    icons at:#unloadedClassItem put:(Smalltalk imageFromFileNamed:'small_folder_yellow_grey1.xpm' forClass:self class).
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    42
    icons at:#loadingClassItem put:(Smalltalk imageFromFileNamed:'small_folder_yellow_search.xpm' forClass:self class).
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    43
    icons at:#loadedClassItem put:(Smalltalk imageFromFileNamed:'small_folder_yellow.xpm' forClass:self class).
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    44
    ^icons
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    45
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    46
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    47
!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    48
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    49
itemComputationList
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    50
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    51
    ^ itemComputationList ifNil:[itemComputationList := IdentitySet new]
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    52
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    53
!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    54
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    55
semaphoreCritical
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    56
    "return the value of the instance variable 'semaphoreCritical' (automatically generated)"
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    57
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    58
    ^ semaphoreCritical ifNil:[semaphoreCritical := RecursionLock new]
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    59
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    60
! !
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    61
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    62
!HierarchicalClassRevisionList methodsFor:'finalization'!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    63
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    64
disposed
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    65
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    66
    self stopItemTask.    
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    67
    Lobby unregister:self.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    68
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    69
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    70
! !
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    71
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    72
!HierarchicalClassRevisionList methodsFor:'initialization'!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    73
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    74
initialize
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    75
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    76
    self showRoot:false.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    77
    dataColl := OrderedCollection new.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    78
    self root:ClassItemRootForRevision new.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    79
    Lobby ifNil:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    80
        Lobby := Registry new.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    81
    ].
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    82
    Lobby register:self.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    83
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    84
! !
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    85
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    86
!HierarchicalClassRevisionList methodsFor:'protocol'!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    87
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    88
getDataForItem: anItem
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    89
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    90
    self semaphoreCritical critical:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    91
        |theList|
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    92
        currentItemInTask == anItem ifTrue:[^self].
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    93
        (theList := self itemComputationList) removeIdentical:anItem ifAbsent:[nil].
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    94
        theList add:anItem.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    95
        self startItemTask]
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    96
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    97
!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    98
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
    99
itemTaskCycle
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   100
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   101
    |theItem|
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   102
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   103
    [
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   104
        theItem := nil.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   105
        self semaphoreCritical critical:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   106
            self itemComputationList notEmpty
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   107
                ifTrue:[theItem := self itemComputationList remove:(self itemComputationList last) ifAbsent:[nil]]
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   108
        ].
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   109
        (theItem notNil and:[theItem needsChildren])ifTrue:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   110
            currentItemInTask:=theItem.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   111
            theItem computeRevisions.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   112
            currentItemInTask:=nil
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   113
        ].
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   114
        theItem notNil
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   115
    ] whileTrue.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   116
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   117
!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   118
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   119
newData: aClassRevisionColl
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   120
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   121
    dataColl := aClassRevisionColl.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   122
    self root:ClassItemRootForRevision new.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   123
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   124
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   125
!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   126
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   127
startItemTask
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   128
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   129
    self semaphoreCritical critical:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   130
        itemTask ifNil:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   131
            itemTask := Process for:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   132
                                            self itemTaskCycle
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   133
                                        ]
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   134
                               priority:(Processor userBackgroundPriority).
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   135
            itemTask addExitAction:[itemTask := nil].
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   136
            itemTask resume.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   137
        ].
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   138
    ].
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   139
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   140
!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   141
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   142
stopItemTask
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   143
    |task|
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   144
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   145
    self semaphoreCritical critical:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   146
        (task := itemTask) notNil ifTrue:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   147
            itemTask := nil.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   148
            Exception handle:[:ex|] do:[
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   149
                task terminateWithAllSubprocesses.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   150
                task waitUntilTerminated.
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   151
            ]
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   152
        ]
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   153
    ].
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   154
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   155
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   156
! !
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   157
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   158
!HierarchicalClassRevisionList class methodsFor:'documentation'!
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   159
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   160
version
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   161
    ^ '$Header: /cvs/stx/stx/libtool/HierarchicalClassRevisionList.st,v 1.1 2000-02-15 16:49:08 ps Exp $'
4dd07aefaf20 initial checkin
ps
parents:
diff changeset
   162
! !