Tools__LintRuleSelectionDialog.st
changeset 14758 214db44dab86
parent 14753 ed3aa84a71ed
child 14760 928fe4cf43ff
equal deleted inserted replaced
14757:6b6d158a629b 14758:214db44dab86
    28 "{ NameSpace: Tools }"
    28 "{ NameSpace: Tools }"
    29 
    29 
    30 SimpleDialog subclass:#LintRuleSelectionDialog
    30 SimpleDialog subclass:#LintRuleSelectionDialog
    31 	instanceVariableNames:'selectionHolder variablePanel relativeCorners detailsShown
    31 	instanceVariableNames:'selectionHolder variablePanel relativeCorners detailsShown
    32 		listSelection rulesetList rulesetHolder rulesetNameList
    32 		listSelection rulesetList rulesetHolder rulesetNameList
    33 		rulesetNameHolder'
    33 		rulesetNameHolder canAcceptHolder'
    34 	classVariableNames:''
    34 	classVariableNames:''
    35 	poolDictionaries:''
    35 	poolDictionaries:''
    36 	category:'Interface-Lint'
    36 	category:'Interface-Lint'
    37 !
    37 !
    38 
    38 
    99 ! !
    99 ! !
   100 
   100 
   101 !LintRuleSelectionDialog class methodsFor:'interface specs'!
   101 !LintRuleSelectionDialog class methodsFor:'interface specs'!
   102 
   102 
   103 windowSpec
   103 windowSpec
       
   104     "This resource specification was automatically generated
       
   105      by the UIPainter of ST/X."
       
   106 
       
   107     "Do not manually edit this!! If it is corrupted,
       
   108      the UIPainter may not be able to read the specification."
       
   109 
       
   110     "
       
   111      UIPainter new openOnClass:Tools::LintRuleSelectionDialog andSelector:#windowSpec
       
   112      Tools::LintRuleSelectionDialog new openInterface:#windowSpec
       
   113      Tools::LintRuleSelectionDialog open
       
   114     "
       
   115 
       
   116     <resource: #canvas>
       
   117 
       
   118     ^ 
       
   119     #(FullSpec
       
   120        name: windowSpec
       
   121        window: 
       
   122       (WindowSpec
       
   123          label: 'Select Lint Rules'
       
   124          name: 'Select Lint Rules'
       
   125          min: (Point 10 10)
       
   126          bounds: (Rectangle 0 0 466 403)
       
   127        )
       
   128        component: 
       
   129       (SpecCollection
       
   130          collection: (
       
   131           (LinkButtonSpec
       
   132              label: 'Configure Rule Sets...'
       
   133              name: 'Button1'
       
   134              layout: (LayoutFrame -250 1 0 0 -3 1 24 0)
       
   135              translateLabel: true
       
   136              labelChannel: configureRulesetsButtonLabel
       
   137              adjust: right
       
   138              model: doConfigureRulesets
       
   139            )
       
   140           (HorizontalPanelViewSpec
       
   141              name: 'BottonPanel'
       
   142              layout: (LayoutFrame 0 0.0 -40 1 0 1.0 0 1)
       
   143              horizontalLayout: right
       
   144              verticalLayout: center
       
   145              horizontalSpace: 3
       
   146              verticalSpace: 3
       
   147              reverseOrderIfOKAtLeft: true
       
   148              component: 
       
   149             (SpecCollection
       
   150                collection: (
       
   151                 (ActionButtonSpec
       
   152                    label: 'Cancel'
       
   153                    name: 'CancelButton'
       
   154                    translateLabel: true
       
   155                    model: doCancel
       
   156                    extent: (Point 120 25)
       
   157                  )
       
   158                 (ActionButtonSpec
       
   159                    label: 'OK'
       
   160                    name: 'OKButton'
       
   161                    translateLabel: true
       
   162                    model: doAccept
       
   163                    enableChannel: canAcceptHolder
       
   164                    isDefault: true
       
   165                    defaultable: true
       
   166                    extent: (Point 120 25)
       
   167                  )
       
   168                 )
       
   169               
       
   170              )
       
   171            )
       
   172           (LabelSpec
       
   173              label: 'Select Ruleset'
       
   174              name: 'Label1'
       
   175              layout: (LayoutFrame 3 0 0 0 -250 1 24 0)
       
   176              translateLabel: true
       
   177              adjust: left
       
   178            )
       
   179           (SelectionInListModelViewSpec
       
   180              name: 'SelectionInListModelView1'
       
   181              layout: (LayoutFrame 3 0 30 0 -3 1 -40 1)
       
   182              model: rulesetHolder
       
   183              hasHorizontalScrollBar: true
       
   184              hasVerticalScrollBar: true
       
   185              listModel: rulesetList
       
   186              useIndex: false
       
   187              highlightMode: line
       
   188            )
       
   189           )
       
   190         
       
   191        )
       
   192      )
       
   193 !
       
   194 
       
   195 windowSpec_old
   104     "This resource specification was automatically generated
   196     "This resource specification was automatically generated
   105      by the UIPainter of ST/X."
   197      by the UIPainter of ST/X."
   106 
   198 
   107     "Do not manually edit this!! If it is corrupted,
   199     "Do not manually edit this!! If it is corrupted,
   108      the UIPainter may not be able to read the specification."
   200      the UIPainter may not be able to read the specification."
   237            )
   329            )
   238           )
   330           )
   239         
   331         
   240        )
   332        )
   241      )
   333      )
       
   334 
       
   335     "Created: / 13-10-2014 / 20:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   242 ! !
   336 ! !
   243 
   337 
   244 !LintRuleSelectionDialog methodsFor:'accessing'!
   338 !LintRuleSelectionDialog methodsFor:'accessing'!
   245 
   339 
   246 ruleset: ruleset
   340 ruleset: ruleset
   278     "raise an error: this method should be implemented (TODO)"
   372     "raise an error: this method should be implemented (TODO)"
   279 
   373 
   280     ^AbstractLauncherApplication openSettingsAndSelect: 'Tools/SmallLint'
   374     ^AbstractLauncherApplication openSettingsAndSelect: 'Tools/SmallLint'
   281 
   375 
   282     "Created: / 08-10-2014 / 23:10:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   376     "Created: / 08-10-2014 / 23:10:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   377 !
       
   378 
       
   379 doEditRuleset
       
   380     self doEditRuleset: self rulesetHolder value.
       
   381 
       
   382     "Created: / 13-10-2014 / 21:06:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   383 !
       
   384 
       
   385 doEditRuleset: anRBCompositeLintRule
       
   386     ^ self shouldImplement
       
   387 
       
   388     "Created: / 13-10-2014 / 21:07:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   283 !
   389 !
   284 
   390 
   285 hideResultView
   391 hideResultView
   286 
   392 
   287     detailsShown == true ifFalse:[^self].
   393     detailsShown == true ifFalse:[^self].
   317     ^[(RBCompositeLintRule allRules) rules]
   423     ^[(RBCompositeLintRule allRules) rules]
   318 
   424 
   319     "Created: / 15-04-2010 / 20:09:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   425     "Created: / 15-04-2010 / 20:09:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   320 !
   426 !
   321 
   427 
       
   428 canAcceptHolder
       
   429     <resource: #uiAspect>
       
   430 
       
   431     "automatically generated by UIPainter ..."
       
   432 
       
   433     "*** the code below creates a default model when invoked."
       
   434     "*** (which may not be the one you wanted)"
       
   435     "*** Please change as required and accept it in the browser."
       
   436     "*** (and replace this comment by something more useful ;-)"
       
   437 
       
   438     canAcceptHolder isNil ifTrue:[
       
   439         canAcceptHolder := false asValue.
       
   440 "/ if your app needs to be notified of changes, uncomment one of the lines below:
       
   441 "/       canAcceptHolder addDependent:self.
       
   442 "/       canAcceptHolder onChangeSend:#canAcceptHolderChanged to:self.
       
   443     ].
       
   444     ^ canAcceptHolder.
       
   445 
       
   446     "Modified: / 13-10-2014 / 21:05:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   447 !
       
   448 
   322 configureRulesetsButtonLabel
   449 configureRulesetsButtonLabel
   323     ^'Configure Rule Sets...' asText
   450     ^'Configure...' asText
   324         colorizeAllWith: Color blue;
   451         colorizeAllWith: Color blue;
   325         actionForAll:[ self doConfigureRulesets ];
   452         actionForAll:[ self doConfigureRulesets ];
   326         yourself
   453         yourself
   327 
   454 
   328     "Created: / 08-10-2014 / 23:10:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   455     "Created: / 08-10-2014 / 23:10:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   456     "Modified: / 13-10-2014 / 20:55:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   329 !
   457 !
   330 
   458 
   331 listSelection
   459 listSelection
   332     "return/create the 'listSelection' value holder (automatically generated)"
   460     "return/create the 'listSelection' value holder (automatically generated)"
   333 
   461 
   413 
   541 
   414 rulesetNameHolder
   542 rulesetNameHolder
   415     "return/create the 'rulesetNameHolder' value holder (automatically generated)"
   543     "return/create the 'rulesetNameHolder' value holder (automatically generated)"
   416 
   544 
   417     rulesetNameHolder isNil ifTrue:[
   545     rulesetNameHolder isNil ifTrue:[
   418         rulesetNameHolder := self rulesetHolder value name asValue.
   546         | ruleset |
       
   547 
       
   548         ruleset := self rulesetHolder value.
       
   549         rulesetNameHolder := ValueHolder with: (ruleset notNil ifTrue:[ ruleset displayString ] ifFalse:[ nil ]).
   419         rulesetNameHolder addDependent:self.
   550         rulesetNameHolder addDependent:self.
   420     ].
   551     ].
   421     ^ rulesetNameHolder
   552     ^ rulesetNameHolder
   422 
   553 
   423     "Modified: / 27-02-2013 / 23:42:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   554     "Modified: / 13-10-2014 / 20:49:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   424 !
   555 !
   425 
   556 
   426 rulesetNameHolder:something
   557 rulesetNameHolder:something
   427     "set the 'rulesetNameHolder' value holder (automatically generated)"
   558     "set the 'rulesetNameHolder' value holder (automatically generated)"
   428 
   559 
   485     changedObject == rulesetList ifTrue:[
   616     changedObject == rulesetList ifTrue:[
   486         self updateRulesetNameList.
   617         self updateRulesetNameList.
   487          ^ self.
   618          ^ self.
   488     ].
   619     ].
   489     changedObject == rulesetHolder ifTrue:[
   620     changedObject == rulesetHolder ifTrue:[
   490         self rulesetNameHolder value: self rulesetHolder value name.
   621         | ruleset |
   491         self selection: self rulesetHolder value flattened.
   622 
       
   623         ruleset := self rulesetHolder value.
       
   624         ruleset notNil ifTrue:[
       
   625             self rulesetNameHolder value: ruleset value name withoutNotifying: self.
       
   626             self selection: ruleset value flattened.
       
   627             self canAcceptHolder value: true.
       
   628         ] ifFalse:[ 
       
   629             self rulesetNameHolder value: nil withoutNotifying: self.
       
   630             self selection: nil.
       
   631             self canAcceptHolder value: false.
       
   632         ].
   492          ^ self.
   633          ^ self.
   493     ].
   634     ].
   494     changedObject == rulesetNameHolder ifTrue:[
   635     changedObject == rulesetNameHolder ifTrue:[
   495         self updateRulesetHolder.
   636         self updateRulesetHolder.
   496          ^ self.
   637          ^ self.
   497     ].
   638     ].
   498     super update:something with:aParameter from:changedObject
   639     super update:something with:aParameter from:changedObject
   499 
   640 
   500     "Modified: / 27-02-2013 / 23:27:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   641     "Modified: / 13-10-2014 / 21:05:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   501 !
   642 !
   502 
   643 
   503 updateRulesetHolder
   644 updateRulesetHolder
   504     | ruleset |    
   645     | ruleset |    
   505 
   646 
   524 !
   665 !
   525 
   666 
   526 updateRulesetNameList
   667 updateRulesetNameList
   527 
   668 
   528     self rulesetNameList value: 
   669     self rulesetNameList value: 
   529         ((self rulesetList collect:[:e|e name])
   670         ((self rulesetList collect:[:e|e displayString])
   530             add: 'New Ruleset...' asText allItalic;
   671 "/            add: 'New Ruleset...' asText allItalic;
   531             yourself)
   672             yourself)
   532 
   673 
   533     "Created: / 27-02-2013 / 23:08:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   674     "Created: / 27-02-2013 / 23:08:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   675     "Modified: / 13-10-2014 / 20:46:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   534 ! !
   676 ! !
   535 
   677 
   536 !LintRuleSelectionDialog methodsFor:'hooks'!
   678 !LintRuleSelectionDialog methodsFor:'hooks'!
   537 
   679 
   538 commonPostBuild
   680 commonPostBuild
   539     self updateRulesetNameList.
   681     self updateRulesetNameList.
       
   682     self canAcceptHolder value: self rulesetHolder value notNil
   540 
   683 
   541     "Created: / 27-02-2013 / 23:10:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   684     "Created: / 27-02-2013 / 23:10:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   685     "Modified: / 13-10-2014 / 21:05:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   542 ! !
   686 ! !
   543 
   687 
   544 !LintRuleSelectionDialog class methodsFor:'documentation'!
   688 !LintRuleSelectionDialog class methodsFor:'documentation'!
   545 
   689 
   546 version
   690 version
   547     ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSelectionDialog.st,v 1.7 2014-10-08 22:58:27 vrany Exp $'
   691     ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSelectionDialog.st,v 1.8 2014-10-13 20:09:35 vrany Exp $'
   548 !
   692 !
   549 
   693 
   550 version_CVS
   694 version_CVS
   551     ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSelectionDialog.st,v 1.7 2014-10-08 22:58:27 vrany Exp $'
   695     ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSelectionDialog.st,v 1.8 2014-10-13 20:09:35 vrany Exp $'
   552 !
   696 !
   553 
   697 
   554 version_SVN
   698 version_SVN
   555     ^ '$Id: Tools__LintRuleSelectionDialog.st,v 1.7 2014-10-08 22:58:27 vrany Exp $'
   699     ^ '$Id: Tools__LintRuleSelectionDialog.st,v 1.8 2014-10-13 20:09:35 vrany Exp $'
   556 ! !
   700 ! !
   557 
   701