Tools__HierarchicalLintRuleList.st
author Claus Gittinger <cg@exept.de>
Fri, 01 Jul 2011 15:31:35 +0200
changeset 10001 f6cf395b6933
child 10093 fff6d14a5b19
permissions -rw-r--r--
initial checkin

"
 COPYRIGHT (c) 2006 by eXept Software AG
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libtool' }"

"{ NameSpace: Tools }"

LintRuleList subclass:#HierarchicalLintRuleList
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Lint'
!

!HierarchicalLintRuleList class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2006 by eXept Software AG
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
! !

!HierarchicalLintRuleList class methodsFor:'interface specs'!

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:Tools::HierarchicalLintRuleList andSelector:#windowSpec
     Tools::HierarchicalLintRuleList new openInterface:#windowSpec
     Tools::HierarchicalLintRuleList open
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: windowSpec
        window: 
       (WindowSpec
          label: 'SmallLintRuleList'
          name: 'SmallLintRuleList'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 300 300)
        )
        component: 
       (SpecCollection
          collection: (
           (HierarchicalListViewSpec
              name: 'RuleList'
              layout: (LayoutFrame 0 0 23 0 0 1 0 1)
              model: listSelection
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              listModel: listHolder
              useIndex: false
              highlightMode: line
              showLines: false
              useDefaultIcons: false
              postBuildCallback: postBuildList:
            )
           (InputFieldSpec
              name: 'RuleFilter'
              layout: (LayoutFrame 0 0 0 0 0 1 22 0)
              model: filterHolder
              immediateAccept: true
              acceptOnReturn: true
              acceptOnTab: true
              acceptOnPointerLeave: true
              emptyFieldReplacementText: 'Rule Search'
            )
           )
         
        )
      )
! !

!HierarchicalLintRuleList class methodsFor:'plugIn spec'!

aspectSelectors
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this. If it is corrupted,
     the UIPainter may not be able to read the specification."

    "Return a description of exported aspects;
     these can be connected to aspects of an embedding application
     (if this app is embedded in a subCanvas)."

    ^ #(
        #inGeneratorHolder
        #listSelection
        #modeHolder
        #outGeneratorHolder
        #selectionHolder
      ).

! !

!HierarchicalLintRuleList methodsFor:'aspects'!

listHolder
    listHolder isNil ifTrue:[
        listHolder := (HierarchicalList new)
                    showRoot:false;
                    application:self;
                    yourself
    ].
    ^ listHolder

    "Created: / 15-04-2010 / 20:32:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HierarchicalLintRuleList methodsFor:'private'!

updateList
    |inGenerator filterS inRules root|

    inGenerator := self inGeneratorHolder value.
    filterS := self filterHolder value.
    filterS isNilOrEmptyCollection ifFalse:
        [(filterS startsWith: $*) ifFalse:[filterS := '*' , filterS].
         (filterS endsWith:   $*) ifFalse:[filterS := filterS , '*']].
    (inGenerator isNil and: [self mode == #display])
        ifTrue:[inGenerator := RBCompositeLintRule allRules rules ].
    inRules := OrderedCollection new.
    filterS isNilOrEmptyCollection 
        ifTrue:
            [inGenerator do:[:rule | inRules add:rule ]]
        ifFalse:
            [inGenerator do:
                [:rule|
                rule flattened do:
                    [:each|
                    (filterS isNilOrEmptyCollection 
                        or:[each name matches: filterS])
                        ifTrue:
                            [inRules add: each]]]].
    root := (self 
                listEntryFor:(RBCompositeLintRule rules:inRules name:'Rules'))
                parent:self listHolder;
                expand;
                yourself.
    root children do:[:e | 
        e expand
    ].
    self listHolder root:root.
    listValid := true.

    "Created: / 15-04-2010 / 20:39:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 16-04-2010 / 09:51:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 25-08-2010 / 11:56:39 / Jan Vrany <enter your email here>"
! !

!HierarchicalLintRuleList class methodsFor:'documentation'!

version_CVS
    ^ '$Header: /cvs/stx/stx/libtool/Tools__HierarchicalLintRuleList.st,v 1.1 2011-07-01 13:31:35 cg Exp $'
!

version_SVN
    ^ '§Id: Tools__HierarchicalLintRuleList.st 7617 2010-08-25 12:56:19Z vranyj1 §'
! !