Tools__LintRuleList.st
changeset 16872 0d08caca5471
parent 16589 dd0be6051d87
child 16875 7f9ac5b997bc
equal deleted inserted replaced
16871:7c2db6fb9563 16872:0d08caca5471
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
     4  Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
     3  Copyright (c) 2009-2010 eXept Software AG
     5  Copyright (c) 2009-2010 eXept Software AG
     4 
     6 
     5  Permission is hereby granted, free of charge, to any person
     7  Permission is hereby granted, free of charge, to any person
   618             ifTrue:[
   620             ifTrue:[
   619                 newList add: (self listEntryFor:rule)
   621                 newList add: (self listEntryFor:rule)
   620             ]
   622             ]
   621         ]
   623         ]
   622     ].
   624     ].
   623     newList sort:[:a :b | a name < b name].
   625     newList 
       
   626         sort:[:a :b |
       
   627             |sevA sevB|
       
   628             
       
   629             sevA := a rule severityAsInteger.
       
   630             sevB := b rule severityAsInteger.
       
   631             (sevA > sevB) 
       
   632             or:[ (sevA == sevB) and:[a rule name < b rule name]].
       
   633         ].
       
   634     "/ newList sort:[:a :b | a name < b name].
   624     self listHolder value:newList.
   635     self listHolder value:newList.
   625     self setListValid:true.
   636     self setListValid:true.
   626 
   637 
   627     "Modified: / 22-07-2009 / 15:58:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
   638     "Modified: / 22-07-2009 / 15:58:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
   628     "Modified: / 25-08-2010 / 13:35:58 / Jan Vrany <enter your email here>"
   639     "Modified: / 25-08-2010 / 13:35:58 / Jan Vrany <enter your email here>"
   782 
   793 
   783     "Created: / 15-04-2010 / 19:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   794     "Created: / 15-04-2010 / 19:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   784 !
   795 !
   785 
   796 
   786 label
   797 label
   787 
   798     |s severity|
   788     ^rule displayString.
   799     
       
   800     s := rule displayString.
       
   801     (severity := rule severity) == #warning ifTrue:[
       
   802         ^ s withColor:Color orange.
       
   803     ].    
       
   804     severity == #error ifTrue:[
       
   805         ^ s withColor:Color red.
       
   806     ].    
       
   807     severity == #information ifFalse:[
       
   808         self halt.
       
   809     ].    
       
   810     ^ s
   789 
   811 
   790     "Modified: / 15-04-2010 / 18:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   812     "Modified: / 15-04-2010 / 18:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   791 !
   813 !
   792 
   814 
   793 name
   815 name
   827 ! !
   849 ! !
   828 
   850 
   829 !LintRuleList::ListEntry methodsFor:'displaying'!
   851 !LintRuleList::ListEntry methodsFor:'displaying'!
   830 
   852 
   831 displayLabel:aLabel h:lH on:aGC x:newX y:y h:h 
   853 displayLabel:aLabel h:lH on:aGC x:newX y:y h:h 
       
   854     self displayLabel:aLabel h:lH on:aGC x:newX y:y h:h isHighlightedAsSelected:false
       
   855 !
       
   856 
       
   857 displayLabel:aLabel h:lH on:aGC x:newX y:y h:h isHighlightedAsSelected:isHighlightedAsSelected
   832     | cx icon app mode |
   858     | cx icon app mode |
   833 
   859 
   834     cx := x := newX.
   860     cx := x := newX.
   835     app := self application.
   861     app := self application.
   836     mode := app mode.
   862     mode := app mode.
   846         ].
   872         ].
   847         icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2).
   873         icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2).
   848         cx := cx + 22."experimental value - this looks good"
   874         cx := cx + 22."experimental value - this looks good"
   849     ].
   875     ].
   850 
   876 
   851     super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h
       
   852 
       
   853     "Modified (format): / 07-03-2012 / 20:08:02 / cg"
       
   854     "Modified: / 08-10-2014 / 22:56:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   855 !
       
   856 
       
   857 displayLabel:aLabel h:lH on:aGC x:newX y:y h:h isHighlightedAsSelected:isHighlightedAsSelected
       
   858     | cx icon app mode |
       
   859 
       
   860     cx := x := newX.
       
   861     app := self application.
       
   862     mode := app mode.
       
   863     mode ~~ #display ifTrue:[
       
   864         mode == #select ifTrue:[        
       
   865             icon := self checked 
       
   866                         ifTrue:[app class checkedIcon] 
       
   867                         ifFalse:[app class uncheckedIcon].
       
   868         ] ifFalse:[ 
       
   869             icon := self checked 
       
   870                         ifTrue:[app class checkedIconDisabled] 
       
   871                         ifFalse:[app class uncheckedIconDisabled].
       
   872         ].
       
   873         icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2).
       
   874         cx := cx + 22."experimental value - this looks good"
       
   875     ].
       
   876 
       
   877     super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h isHighlightedAsSelected:isHighlightedAsSelected
   877     super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h isHighlightedAsSelected:isHighlightedAsSelected
   878 
   878 
   879     "Modified (format): / 07-03-2012 / 20:08:02 / cg"
   879     "Modified (format): / 07-03-2012 / 20:08:02 / cg"
   880     "Modified: / 08-10-2014 / 22:56:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   880     "Modified: / 08-10-2014 / 22:56:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   881 !
   881 !