Tools__LintRuleDetail.st
branchjv
changeset 12125 0c49a3b13e43
parent 12123 4bde08cebd48
child 12128 a7ff7d66ee85
--- a/Tools__LintRuleDetail.st	Sun Jan 29 12:56:58 2012 +0000
+++ b/Tools__LintRuleDetail.st	Sun Jan 29 15:33:37 2012 +0000
@@ -28,7 +28,7 @@
 "{ NameSpace: Tools }"
 
 ApplicationModel subclass:#LintRuleDetail
-	instanceVariableNames:'ruleHolder rationaleVisibleHolder'
+	instanceVariableNames:'ruleHolder rationaleVisibleHolder rationalView'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Lint'
@@ -64,6 +64,31 @@
 "
 ! !
 
+!LintRuleDetail class methodsFor:'help specs'!
+
+flyByHelpSpec
+    "This resource specification was automatically generated
+     by the UIHelpTool of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIHelpTool may not be able to read the specification."
+
+    "
+     UIHelpTool openOnClass:Tools::LintRuleDetail    
+    "
+
+    <resource: #help>
+
+    ^ super flyByHelpSpec addPairsFrom:#(
+
+#ruleName
+'Click to browse the lint rule'
+
+)
+
+    "Created: / 07-09-2011 / 04:08:11 / cg"
+! !
+
 !LintRuleDetail class methodsFor:'interface specs'!
 
 windowSpec
@@ -101,6 +126,7 @@
               verticalLayout: topSpaceFit
               horizontalSpace: 0
               verticalSpace: 0
+              ignoreInvisibleComponents: false
               component: 
              (SpecCollection
                 collection: (
@@ -109,13 +135,14 @@
                     component: 
                    (SpecCollection
                       collection: (
-                       (LabelSpec
-                          label: 'Name...'
-                          name: 'Name'
-                          layout: (LayoutFrame 15 0 0 0 -150 1 30 0)
+                       (LinkButtonSpec
+                          name: 'Button1'
+                          layout: (LayoutFrame 0 0 0 0 -150 1 30 0)
+                          activeHelpKey: ruleName
                           translateLabel: true
                           labelChannel: ruleNameAspect
                           adjust: left
+                          model: browseLintRule
                         )
                        (CheckBoxSpec
                           label: 'Show Rationale'
@@ -135,6 +162,7 @@
                     visibilityChannel: rationaleVisibleHolder
                     hasHorizontalScrollBar: true
                     hasVerticalScrollBar: true
+                    backgroundColor: (Color 86.9993133440146 86.9993133440146 86.9993133440146)
                     htmlText: ruleRationaleAspect
                     extent: (Point 560 270)
                     postBuildCallback: setupHTMLView:
@@ -163,11 +191,28 @@
      (if this app is embedded in a subCanvas)."
 
     ^ #(
-	#ruleHolder
+        #ruleHolder
       ).
 
 ! !
 
+!LintRuleDetail methodsFor:'actions'!
+
+browseLintRule
+    |rule ruleClass sel|
+
+    rule := self ruleHolder value.
+    rule isNil ifTrue:[^ self].
+    ruleClass := rule class.
+    (ruleClass implements:#rationale) ifTrue:[
+        sel := #rationale.
+    ].
+    UserPreferences current systemBrowserClass
+       openInClass:ruleClass selector:sel
+
+    "Created: / 07-09-2011 / 04:09:38 / cg"
+! !
+
 !LintRuleDetail methodsFor:'aspects'!
 
 rationaleVisibleHolder
@@ -235,14 +280,18 @@
     |holder|
 
     (holder := builder bindingAt:#ruleNameAspect) isNil ifTrue:[
-	holder := (AspectAdaptor forAspect: #displayString) subjectChannel: self ruleHolder.
-	builder aspectAt:#ruleNameAspect put:holder.
-"/       holder addDependent:self.
-"/       holder onChangeSend:#ruleNameAspectChanged to:self.
+        holder := BlockValue
+                    with:[:h | 
+                        "/ h displayString , ' ' , (('[browse]' actionForAll:[ self browseLintRule]) colorizeAllWith:Color blue) 
+                        h displayString actionForAll:[ self browseLintRule] 
+                    ]
+                    argument: self ruleHolder.
+        builder aspectAt:#ruleNameAspect put:holder.
     ].
     ^ holder.
 
     "Modified: / 05-02-2010 / 12:51:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 07-09-2011 / 04:54:24 / cg"
 !
 
 ruleRationaleAspect
@@ -251,14 +300,13 @@
     |holder|
 
     (holder := builder bindingAt:#ruleRationaleAspect) isNil ifTrue:[
-	holder := (AspectAdaptor forAspect: #rationale) subjectChannel: self ruleHolder.
-	builder aspectAt:#ruleRationaleAspect put:holder.
-"/       holder addDependent:self.
-"/       holder onChangeSend:#ruleRationaleAspectChanged to:self.
+        holder := (AspectAdaptor forAspect: #rationale) subjectChannel: self ruleHolder.
+        builder aspectAt:#ruleRationaleAspect put:holder.
     ].
     ^ holder.
 
     "Modified: / 05-02-2010 / 12:51:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 07-09-2011 / 04:12:16 / cg"
 ! !
 
 !LintRuleDetail methodsFor:'change & update'!
@@ -282,25 +330,38 @@
 updateVisibility
 
     self ruleHolder value notNil
-	ifTrue:[self show]
-	ifFalse:[self hide]
+        ifTrue:[self show]
+        ifFalse:[self hide].
 
     "Created: / 04-08-2011 / 16:39:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-09-2011 / 20:18:48 / cg"
 ! !
 
 !LintRuleDetail methodsFor:'initialization'!
 
 setupHTMLView:aView
+    rationalView := aView.
     aView painter
-	leftMargin:20;
-	topMargin:5.
+        leftMargin:20;
+        topMargin:5.
 
     "Created: / 04-08-2011 / 18:00:36 / cg"
-
 ! !
 
 !LintRuleDetail methodsFor:'private'!
 
+heightWhenNotShowingRationale
+    ^ 30
+
+    "Created: / 07-09-2011 / 04:02:34 / cg"
+!
+
+heightWhenShowingRationale
+    ^ 100
+
+    "Created: / 07-09-2011 / 04:02:24 / cg"
+!
+
 hide
 
     self visibility: false height: 0
@@ -309,40 +370,50 @@
 !
 
 show
-
-    self visibility: true height: (self rationaleVisibleHolder value ifTrue:[130] ifFalse:[30])
+    self 
+        visibility: true 
+        height: (self rationaleVisibleHolder value 
+                    ifTrue:[ self heightWhenShowingRationale ] 
+                    ifFalse:[ self heightWhenNotShowingRationale ])
 
     "Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 07-09-2011 / 04:03:07 / cg"
 !
 
 visibility: visibility height: height
     | container list detail h |
-    (container := self window container) ifNil:[^self].
+
+    (container := self window container) isNil ifTrue:[^self].
     h := visibility ifFalse:[0] ifTrue:[height].
 
-    container isVisible == visibility ifFalse:
-        [container isVisible: visibility].
-
+    container isVisible == visibility ifFalse: [
+        container isVisible: visibility
+    ].
 
     list := container container subViews first.
     detail := container container subViews second.
 
-    (list layout bottomOffset ~= height negated) ifTrue:
-        [list layout:
-            (list layout bottomOffset: height negated; yourself)].
-    (detail layout topOffset ~= height negated) ifTrue:
-        [detail layout:
-            (detail layout topOffset: height negated; yourself)].
+    (list layout bottomOffset ~= height negated) ifTrue:[
+        list layout: (list layout bottomOffset: height negated; yourself)
+    ].
+    (detail layout topOffset ~= height negated) ifTrue:[
+        detail layout: (detail layout topOffset: height negated; yourself)
+    ].
 
     "Created: / 11-03-2010 / 09:51:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-09-2011 / 20:15:40 / cg"
 ! !
 
 !LintRuleDetail class methodsFor:'documentation'!
 
+version
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.10 2011/09/07 02:54:47 cg Exp $'
+!
+
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.6 2011/08/05 12:36:26 vrany Exp §'
+    ^ '§Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.10 2011/09/07 02:54:47 cg Exp §'
 !
 
 version_SVN
     ^ '$Id: Tools__LintRuleDetail.st 7617 2010-08-25 12:56:19Z vranyj1 $'
-! !
\ No newline at end of file
+! !