Tools__LintRuleSettingsApplication.st
changeset 14770 6a3d59666ca8
parent 14769 8fbf2cc4645d
child 14774 9337fd51b990
--- a/Tools__LintRuleSettingsApplication.st	Tue Oct 14 17:33:08 2014 +0200
+++ b/Tools__LintRuleSettingsApplication.st	Tue Oct 14 18:53:35 2014 +0200
@@ -259,20 +259,25 @@
 doEdit
     <resource: #uiCallback>
 
-    | rule editedRule|    
-    rule := self rulesetSelectionHolder value.
+    self doEdit: self rulesetSelectionHolder value.
+
+    "Modified: / 14-10-2014 / 16:48:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+doEdit: rule
+    | edited dialog |    
 
-    editedRule := LintRuleEditDialog new
-        rule: rule deepCopy;
-        open.
-
-    editedRule ~~ false ifTrue:[
-        self rulesetSelectionHolder value:editedRule.
-        self rulesetList replaceAllIdentical:rule with:editedRule.
+    dialog := LintRuleEditDialog new.
+    edited := rule deepCopy.
+    dialog rule: edited.
+    dialog open.
+    dialog accepted ifTrue:[ 
+        rule name: edited name.
+        rule rules: edited rules.
         self updateModifiedChannel.
     ].
 
-    "Modified: / 27-02-2013 / 11:57:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 14-10-2014 / 16:47:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 doExport
@@ -380,18 +385,35 @@
     "superclass AbstractSettingsApplication says that I am responsible to implement this method"
 
     RBCompositeLintRule notNil ifTrue:[
-        self rulesetList removeAll; addAll: RBCompositeLintRule rulesets
+        self rulesetList removeAll; addAll: RBCompositeLintRule rulesets deepCopy
     ].
 
-    "Modified: / 27-02-2013 / 11:15:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-10-2014 / 17:40:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 basicSaveSettings
-    "superclass AbstractSettingsApplication says that I am responsible to implement this method"
+    | oldRulesets newRulesets toRemove toAdd |
+
+    oldRulesets := RBCompositeLintRule rulesets.
+    newRulesets := self rulesetList.
+
+    toAdd := OrderedCollection withAll: newRulesets.
+    toRemove := Set new.
+    RBCompositeLintRule rulesets do:[:oldRuleset | 
+        | newRuleset |
 
-    RBCompositeLintRule rulesets: self rulesetList asOrderedCollection
+        newRuleset := newRulesets detect:[:each | each name = oldRuleset name ] ifNone: nil.
+        newRuleset isNil ifTrue:[ 
+            toRemove add: oldRuleset.
+        ] ifFalse:[ 
+            toAdd remove: newRuleset.
+            oldRuleset rules: newRuleset rules.
+        ].
+    ].
+    oldRulesets removeAll:toRemove.
+    oldRulesets addAll:toAdd.
 
-    "Modified: / 27-02-2013 / 11:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-10-2014 / 17:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 helpFilename
@@ -427,11 +449,11 @@
 !LintRuleSettingsApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.7 2014-10-14 15:33:08 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.8 2014-10-14 16:53:35 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.7 2014-10-14 15:33:08 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.8 2014-10-14 16:53:35 vrany Exp $'
 ! !