Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added indexHints method to IndexedRefactoring to provide subclasses a…

… hook to speed up index building.
  • Loading branch information...
commit f7751e4b3627864d4fb1b3c4963f7b08b2b714e4 1 parent 0f91849
@michih57 michih57 authored
View
13 org.scala-ide.sdt.core/src/scala/tools/eclipse/refactoring/IndexedRefactorings.scala
@@ -29,9 +29,9 @@ abstract class IndexedIdeRefactoring(refactoringName: String, start: Int, end: I
val refactoring: MultiStageRefactoring with GlobalIndexes with Indexed
/**
- * A cleanup handler, will later be set by the refactoring
- * to remove all loaded compilation units from the compiler.
- */
+ * A cleanup handler, will later be set by the refactoring
+ * to remove all loaded compilation units from the compiler.
+ */
var cleanup = () => ()
override def checkInitialConditions(pm: IProgressMonitor): RefactoringStatus = {
@@ -39,7 +39,7 @@ abstract class IndexedIdeRefactoring(refactoringName: String, start: Int, end: I
if (!status.hasError) {
// the hints parameter is not used, this can slow down the refactoring considerably!
- val (index, cleanupIndex) = buildFullProjectIndex(pm, Nil)
+ val (index, cleanupIndex) = buildFullProjectIndex(pm, indexHints)
refactoring.index = index
// will be called after the refactoring has finished
cleanup = cleanupIndex
@@ -51,6 +51,11 @@ abstract class IndexedIdeRefactoring(refactoringName: String, start: Int, end: I
status
}
+
+ /**
+ * Provide hints for index building.
+ */
+ def indexHints(): List[String] = Nil
override def createChange(pm: IProgressMonitor) = {
val change = super.createChange(pm)
View
5 org.scala-ide.sdt.core/src/scala/tools/eclipse/refactoring/MoveConstructorToCompanionObjectAction.scala
@@ -23,5 +23,10 @@ class MoveConstructorToCompanionObjectAction extends RefactoringAction {
}
val refactoringParameters = new refactoring.RefactoringParameters
+
+ override def indexHints() = {
+ val classdef = preparationResult.right.toOption
+ classdef.map(_.symbol.nameString).toList
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.