Show also builtin rules in Lint rule settings dialog.
--- a/Tools__LintRuleSettingsApplication.st Mon Nov 10 23:34:53 2014 +0100
+++ b/Tools__LintRuleSettingsApplication.st Tue Nov 11 15:17:09 2014 +0100
@@ -14,7 +14,8 @@
"{ NameSpace: Tools }"
AbstractSettingsApplication subclass:#LintRuleSettingsApplication
- instanceVariableNames:'rulesetList rulesetSelectionHolder hasSelectionHolder'
+ instanceVariableNames:'rulesetList rulesetSelectionHolder hasSelectionHolder
+ hasSelectionAndUserDefinedHolder'
classVariableNames:'LastFileName'
poolDictionaries:''
category:'Interface-Lint'
@@ -202,16 +203,18 @@
selection
- ^self selectionHolder value
+ ^self rulesetSelectionHolder value
"Created: / 25-08-2010 / 14:10:03 / Jan Vrany <enter your email here>"
+ "Modified: / 11-11-2014 / 15:11:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
selection: anObject
- self selectionHolder value: anObject
+ self rulesetSelectionHolder value: anObject
"Created: / 25-08-2010 / 14:09:40 / Jan Vrany <enter your email here>"
+ "Modified: / 11-11-2014 / 15:11:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LintRuleSettingsApplication methodsFor:'actions'!
@@ -333,9 +336,10 @@
!
canEditHolder
- ^self hasSelectionHolder
+ ^self hasSelectionAndUserDefinedHolder
"Created: / 27-02-2013 / 11:24:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-11-2014 / 15:12:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
canExportHolder
@@ -345,9 +349,23 @@
!
canRemoveHolder
- ^self hasSelectionHolder
+ ^self hasSelectionAndUserDefinedHolder
"Created: / 27-02-2013 / 11:24:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-11-2014 / 15:12:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hasSelectionAndUserDefinedHolder
+
+
+ hasSelectionAndUserDefinedHolder isNil ifTrue:[
+ hasSelectionAndUserDefinedHolder := PluggableAdaptor on: self rulesetSelectionHolder
+ getter:[ :model | model value notNil and:[model value isBuiltin not ] ]
+
+ ].
+ ^ hasSelectionAndUserDefinedHolder
+
+ "Created: / 11-11-2014 / 15:11:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
hasSelectionHolder
@@ -386,18 +404,31 @@
basicReadSettings
"superclass AbstractSettingsApplication says that I am responsible to implement this method"
- RBCompositeLintRule notNil ifTrue:[
- self rulesetList removeAll; addAll: RBCompositeLintRule rulesetsUserDefined deepCopy
+ RBCompositeLintRule isNil ifTrue:[
+ "/ Not loaded?
+ [
+ Smalltalk loadPackage: #'stx:goodies/refactoryBrowser/lint'.
+ ] on: PackageLoadError do:[:ex |
+ Dialog warn: (resources string: 'SmallLint package could not be loaded!!').
+ ^ self.
+ ]
].
- "Modified: / 14-10-2014 / 17:40:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ RBCompositeLintRule notNil ifTrue:[
+ self rulesetList
+ removeAll;
+ addAll: RBCompositeLintRule rulesetsBuiltin;
+ addAll: RBCompositeLintRule rulesetsUserDefined deepCopy
+ ].
+
+ "Modified: / 11-11-2014 / 15:08:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
basicSaveSettings
| oldRulesets newRulesets toRemove toAdd |
oldRulesets := RBCompositeLintRule rulesetsUserDefined.
- newRulesets := self rulesetList.
+ newRulesets := self rulesetList select:[:e|e isUserDefined].
toAdd := OrderedCollection withAll: newRulesets.
toRemove := Set new.
@@ -416,7 +447,7 @@
oldRulesets addAll:toAdd.
RBCompositeLintRule rulesetsUserDefined: oldRulesets.
- "Modified (format): / 16-10-2014 / 15:55:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-11-2014 / 15:07:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
helpFilename
@@ -452,11 +483,11 @@
!LintRuleSettingsApplication class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.10 2014-10-16 15:09:14 vrany Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.11 2014-11-11 14:17:09 vrany Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.10 2014-10-16 15:09:14 vrany Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.11 2014-11-11 14:17:09 vrany Exp $'
! !