Changeset fca4f13be6a79d9efa6228576a8d231680ac6346

User picture

Commiter: Mirko Stocker

Author: Mirko Stocker

Parent: 799e54613b

(2012/01/19 06:40) About 1 month ago

Set the version numbers in all places, and improvements to Move Class.

Affected files

Updated org.scala-refactoring.feature/feature.xml Download diff

799e54613b3a098cb99a0ecbbd544c44faebfe7afca4f13be6a79d9efa6228576a8d231680ac6346
2
<feature
2
<feature
3
      id="org.scala-refactoring.feature"
3
      id="org.scala-refactoring.feature"
4
      label="Scala Refactoring"
4
      label="Scala Refactoring"
5
      version="0.3.0.qualifier">
5
      version="0.4.0.qualifier">
6
      provider-name="The Scala Refactoring Team">
6
      provider-name="The Scala Refactoring Team">
7
7
8
   <description url="http://scala-refactoring.assembla.com/wiki/show/scala-refactoring">
8
   <description url="http://scala-refactoring.assembla.com/wiki/show/scala-refactoring">

Updated org.scala-refactoring.library/src/main/scala/scala/tools/refactoring/common/TreeTraverser.scala Download diff

799e54613b3a098cb99a0ecbbd544c44faebfe7afca4f13be6a79d9efa6228576a8d231680ac6346
129
            handleAppliedTypeTree(tree, tpe)
129
            handleAppliedTypeTree(tree, tpe)
130
          case (TypeRef(_, sym, _), tree) =>
130
          case (TypeRef(_, sym, _), tree) =>
131
            fakeSelectTree(sym.tpe, sym, tree) foreach traverse
131
            fakeSelectTree(sym.tpe, sym, tree) foreach traverse
132
          case (tpe, tree) =>
133
            // TODO ?
132
        }
134
        }
133
    }
135
    }
134
    
136
    

Updated org.scala-refactoring.library/src/main/scala/scala/tools/refactoring/implementations/MoveClass.scala Download diff

799e54613b3a098cb99a0ecbbd544c44faebfe7afca4f13be6a79d9efa6228576a8d231680ac6346
115
            
115
            
116
        val oi = new OrganizeImports {
116
        val oi = new OrganizeImports {
117
          val global: MoveClass.this.global.type = MoveClass.this.global
117
          val global: MoveClass.this.global.type = MoveClass.this.global
118
            
119
          object NeededImports extends Participant {
120
            def apply(trees: List[Import]) = {
121
              
122
              val imps = neededImports(toMove) filterNot { imp =>
123
                // We don't want to add imports for types that are
124
                // declared in `toMove`.
125
                val declaration = index.declaration(imp.symbol)
126
                declaration map (toMove.pos includes _.pos) getOrElse false
127
              }
128
              mkImportTrees(imps, targetPackageName)
129
            }
130
          }
118
        }
131
        }
119
        
132
        // TODO: Use IDE settings
120
        val imports = scala.Function.chain(new oi.FindNeededImports(toMove, targetPackageName) :: oi.SortImports :: Nil)(existingImports)         
133
        val imports = scala.Function.chain(oi.NeededImports :: oi.SortImports :: Nil)(existingImports)         
134
        // When we move the whole file, we only want to add imports to the originating package
121
        p copy (stats = imports ::: others) replaces p
135
        p copy (stats = imports ::: others) replaces p
122
    }
136
    }
123
  }
137
  }

Updated org.scala-refactoring.library/src/main/scala/scala/tools/refactoring/implementations/OrganizeImports.scala Download diff

799e54613b3a098cb99a0ecbbd544c44faebfe7afca4f13be6a79d9efa6228576a8d231680ac6346
182
  
182
  
183
  class FindNeededImports(root: Tree, enclosingPackage: String) extends Participant {
183
  class FindNeededImports(root: Tree, enclosingPackage: String) extends Participant {
184
    def apply(trees: List[Import]) = {
184
    def apply(trees: List[Import]) = {
185
186
      
187
      mkImportTrees(neededImports(root), enclosingPackage)
185
      mkImportTrees(neededImports(root), enclosingPackage)
188
    }
186
    }
189
  }
187
  }

Updated org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/imports/OrganizeImportsFullyRecomputeTest.scala Download diff

799e54613b3a098cb99a0ecbbd544c44faebfe7afca4f13be6a79d9efa6228576a8d231680ac6346
770
    }
770
    }
771
    """
771
    """
772
  } applyRefactoring organize
772
  } applyRefactoring organize
773
774
  @Test
775
  def typeConstructors = new FileSet {
776
    """
777
    trait Property[+T]
778
    
779
    class A {
780
      type Prop_Tp[+Vl_Tpe] <: Property[Vl_Tpe]
781
      def properties: Set[Prop_Tp[_]] = null.asInstanceOf[Set[Prop_Tp[_]]]
782
    }
783
    """ becomes
784
    """
785
    trait Property[+T]
786
    
787
    class A {
788
      type Prop_Tp[+Vl_Tpe] <: Property[Vl_Tpe]
789
      def properties: Set[Prop_Tp[_]] = null.asInstanceOf[Set[Prop_Tp[_]]]
790
    }
791
    """
792
  } applyRefactoring organize
773
}
793
}

Updated org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/MoveClassTest.scala Download diff

799e54613b3a098cb99a0ecbbd544c44faebfe7afca4f13be6a79d9efa6228576a8d231680ac6346
707
  } applyRefactoring(moveTo("x.y"))
707
  } applyRefactoring(moveTo("x.y"))
708
708
709
  @Test
709
  @Test
710
  def moveMultipleClassesWithInterdependencies = new FileSet {
711
    """
712
    package xyz
713
    
714
    class A {
715
      val B = new {
716
        val y = 2
717
      }
718
    }
719
    
720
    object C {
721
      def m(x: A) {
722
        import x._
723
        println(B.y)
724
      }
725
    }
726
    """ becomes
727
    """
728
    package org.scala-refactoring
729
    
730
    class A {
731
      val B = new {
732
        val y = 2
733
      }
734
    }
735
    
736
    object C {
737
      def m(x: A) {
738
        import x._
739
        println(B.y)
740
      }
741
    }
742
    """
743
  } applyRefactoring(moveTo("org.scala-refactoring"))
744
745
  @Test
710
  def nestedPackageAndImports = new FileSet {
746
  def nestedPackageAndImports = new FileSet {
711
    """
747
    """
712
    package x
748
    package x

Updated org.scala-refactoring.update-site/site.xml Download diff

799e54613b3a098cb99a0ecbbd544c44faebfe7afca4f13be6a79d9efa6228576a8d231680ac6346
3
   <description name="Scala Refactoring Update Site">
3
   <description name="Scala Refactoring Update Site">
4
      The update site for the Scala Refactoring project.
4
      The update site for the Scala Refactoring project.
5
   </description>
5
   </description>
6
   <feature url="features/org.scala-refactoring.feature_0.3.0.qualifier.jar" id="org.scala-refactoring.feature" version="0.3.0.qualifier">
6
   <feature url="features/org.scala-refactoring.feature_0.4.0.qualifier.jar" id="org.scala-refactoring.feature" version="0.4.0.qualifier">
7
      <category name="org.scala-refactoring"/>
7
      <category name="org.scala-refactoring"/>
8
   </feature>
8
   </feature>
9
   <category-def name="org.scala-refactoring" label="Scala Refactoring"/>
9
   <category-def name="org.scala-refactoring" label="Scala Refactoring"/>