ProjectProblem.st
changeset 3932 ff45df4a8398
parent 3894 5ace68ac540e
child 3933 f7cd19b621fb
--- a/ProjectProblem.st	Thu Jan 14 20:08:17 2016 +0100
+++ b/ProjectProblem.st	Thu Jan 14 22:08:49 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 2006 by eXept Software AG
               All Rights Reserved
@@ -2107,6 +2105,28 @@
 
 !ProjectProblem::MethodInNoPackage methodsFor:'fixing'!
 
+doMoveAllListedMethodsToClassPackage
+    "move all listed methods to their corresponding classes package.
+     Return false if fix fails, true otherwise"
+
+    | mth cls any |
+
+    any := false.
+    self allUnfixedProblemsOfMyKindDo:[:p |
+        cls := p klass.
+        cls notNil ifTrue:[
+            mth := p method.
+            mth notNil ifTrue:[
+                cls package ~= PackageId noProjectID ifTrue:[
+                    mth package:(cls package).
+                    any := true.
+                ]
+            ]
+        ]
+    ].
+    ^ any
+!
+
 doMoveAllListedMethodsToPackage
     "move all listed methods to the package.
      Return false if fix fails, true otherwise"
@@ -2142,30 +2162,27 @@
 fixes
     "return a list of description-actionBlock pairs for possible fixes"
 
-    |moveThisToPackage moveAllToTheirPackage|
-
-    moveThisToPackage :=
-        {                        
+    |ops|
+
+    ops := OrderedCollection new.
+    
+    ops add:{                        
             ('Move method to package "%1"' bindWith:package) .
             [ self doMoveMethodToPackage ]
         }.
-
+    
     self countOtherProblemsOfThisKind > 0 ifTrue:[
-        moveAllToTheirPackage :=
-            {
+        ops add:{
+                ('Move all listed unpackaged methods to their class package') .
+                [ self doMoveAllListedMethodsToClassPackage ]
+            }.
+            
+        ops add:{
                 ('Move all listed unpackaged methods to package "%1"' bindWith:package) .
                 [ self doMoveAllListedMethodsToPackage ]
             }.
-
-        ^ {
-            moveThisToPackage .
-            moveAllToTheirPackage
-          }
     ].
-
-    ^ {
-        moveThisToPackage
-      }
+    ^ ops
 
     "Created: / 26-07-2012 / 09:53:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !