Tools__LintRuleList.st
changeset 16872 0d08caca5471
parent 16589 dd0be6051d87
child 16875 7f9ac5b997bc
--- a/Tools__LintRuleList.st	Thu Sep 29 13:43:54 2016 +0200
+++ b/Tools__LintRuleList.st	Thu Sep 29 14:39:17 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
  Copyright (c) 2009-2010 eXept Software AG
@@ -620,7 +622,16 @@
             ]
         ]
     ].
-    newList sort:[:a :b | a name < b name].
+    newList 
+        sort:[:a :b |
+            |sevA sevB|
+            
+            sevA := a rule severityAsInteger.
+            sevB := b rule severityAsInteger.
+            (sevA > sevB) 
+            or:[ (sevA == sevB) and:[a rule name < b rule name]].
+        ].
+    "/ newList sort:[:a :b | a name < b name].
     self listHolder value:newList.
     self setListValid:true.
 
@@ -784,8 +795,19 @@
 !
 
 label
-
-    ^rule displayString.
+    |s severity|
+    
+    s := rule displayString.
+    (severity := rule severity) == #warning ifTrue:[
+        ^ s withColor:Color orange.
+    ].    
+    severity == #error ifTrue:[
+        ^ s withColor:Color red.
+    ].    
+    severity == #information ifFalse:[
+        self halt.
+    ].    
+    ^ s
 
     "Modified: / 15-04-2010 / 18:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -829,29 +851,7 @@
 !LintRuleList::ListEntry methodsFor:'displaying'!
 
 displayLabel:aLabel h:lH on:aGC x:newX y:y h:h 
-    | cx icon app mode |
-
-    cx := x := newX.
-    app := self application.
-    mode := app mode.
-    mode ~~ #display ifTrue:[
-        mode == #select ifTrue:[        
-            icon := self checked 
-                        ifTrue:[app class checkedIcon] 
-                        ifFalse:[app class uncheckedIcon].
-        ] ifFalse:[ 
-            icon := self checked 
-                        ifTrue:[app class checkedIconDisabled] 
-                        ifFalse:[app class uncheckedIconDisabled].
-        ].
-        icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2).
-        cx := cx + 22."experimental value - this looks good"
-    ].
-
-    super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h
-
-    "Modified (format): / 07-03-2012 / 20:08:02 / cg"
-    "Modified: / 08-10-2014 / 22:56:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    self displayLabel:aLabel h:lH on:aGC x:newX y:y h:h isHighlightedAsSelected:false
 !
 
 displayLabel:aLabel h:lH on:aGC x:newX y:y h:h isHighlightedAsSelected:isHighlightedAsSelected