Tools__ToDoList.st
author Claus Gittinger <cg@exept.de>
Tue, 13 Mar 2007 18:13:02 +0100
changeset 7731 3b6a3bb02598
parent 7458 79c0991c5a2e
child 8236 52b83faee1c1
permissions -rw-r--r--
checkIfValid by reparsing

"{ Package: 'stx:libtool' }"

"{ NameSpace: Tools }"

List subclass:#ToDoList
	instanceVariableNames:'validationPending validationProcess validationInvalid'
	classVariableNames:'TheOneAndOnlyToDoList WarningSeverity ErrorSeverity InfoSeverity'
	poolDictionaries:''
	category:'Interface-Smalltalk-ToDo'
!


!ToDoList class methodsFor:'accessing'!

theOneAndOnlyToDoList
    TheOneAndOnlyToDoList isNil ifTrue:[
        TheOneAndOnlyToDoList := self new.
    ].
    ^ TheOneAndOnlyToDoList

    "
     TheOneAndOnlyToDoList := nil
    "

    "Created: / 21-10-2006 / 20:57:48 / cg"
    "Modified: / 21-10-2006 / 23:06:27 / cg"
! !

!ToDoList class methodsFor:'class initialization'!

initialize
    WarningSeverity := 1.
    ErrorSeverity := 2.
    InfoSeverity := 0.

    "
     TheOneAndOnlyToDoList := nil.
     self initialize
    "

    "Created: / 21-10-2006 / 19:43:37 / cg"
    "Modified: / 21-10-2006 / 22:11:40 / cg"
! !

!ToDoList class methodsFor:'constants'!

errorSeverity
    ^ ErrorSeverity
!

highPriority
    ^ 75

    "Created: / 21-10-2006 / 20:43:56 / cg"
!

highestPriority
    ^ 100

    "Created: / 21-10-2006 / 20:43:24 / cg"
!

infoSeverity
    ^ InfoSeverity
!

lowPriority
    ^ 25

    "Created: / 21-10-2006 / 20:43:42 / cg"
!

mediumPriority
    ^ 50

    "Created: / 21-10-2006 / 20:43:37 / cg"
!

warningSeverity
    ^ WarningSeverity
! !

!ToDoList methodsFor:'accessing'!

add:anEntry
    (anEntry isAlreadyPresentIn:self) ifFalse:[
        anEntry list:self.
        super add:anEntry.
        Smalltalk addDependent:self.
    ].

    "Created: / 21-10-2006 / 21:14:42 / cg"
    "Modified: / 21-10-2006 / 23:03:13 / cg"
! !

!ToDoList methodsFor:'change & update'!

revalidate
    |wasPending|

    [
        wasPending := validationPending ? false.
        validationPending := true.
        wasPending ifTrue:[
            validationInvalid := true
        ].
    ] valueUninterruptably.
    wasPending ifTrue:[^ self].

    validationProcess := 
        [
            [
                |index entry|

                validationInvalid := false.
                index := 1.
                [index <= self size] whileTrue:[
                    entry := self at:index.
                    entry revalidate.
                    index <= self size ifTrue:[
                        ((self at:index) sameAs:entry) ifTrue:[
                            "/ it did not remove itself
                            index := index + 1
                        ]
                    ].
                    validationInvalid ifTrue:[
                        validationInvalid := false.
                        index := 1.
                    ].
                ].
            ] ensure:[
                validationPending := false.
                validationProcess := nil.
                validationInvalid := false.
            ].
        ] fork.

    "Created: / 21-10-2006 / 23:02:34 / cg"
    "Modified: / 23-10-2006 / 22:40:11 / cg"
!

update:something with:aParameter from:changedObject
     changedObject == Smalltalk ifTrue:[
        something == #methodTrap ifTrue:[^ self].
        self revalidate.
        ^ self.
    ].
    ^ super update:something with:aParameter from:changedObject

    "Created: / 21-10-2006 / 23:02:05 / cg"
    "Modified: / 23-10-2006 / 22:20:52 / cg"
! !

!ToDoList class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/Tools__ToDoList.st,v 1.3 2007-03-13 17:13:02 cg Exp $'
! !

ToDoList initialize!