diff --git a/org.scala-ide.sdt.core/plugin.xml b/org.scala-ide.sdt.core/plugin.xml index dd1ba9a720..8fba556992 100644 --- a/org.scala-ide.sdt.core/plugin.xml +++ b/org.scala-ide.sdt.core/plugin.xml @@ -1058,10 +1058,6 @@ categoryId="org.scalaide.ui.menu.refactoring" id="org.scalaide.refactoring.MoveClass" name="Move Class/Object/Trait"/> - new implementations.ExtractLocal { val global = c }) - - val name = "extractedLocalValue" - - def refactoringParameters = name - } - - override def perform(): Unit = { - - /** - * Inline extracting is implemented by extracting to a new name - * that does not exist and then looking up the position of these - * names in the generated change. - */ - def doInlineExtraction(change: TextChange, name: String) { - EditorUtils.doWithCurrentEditor { editor => - - EditorUtils.applyRefactoringChangeToEditor(change, editor) - - val occurrences = { - val firstOccurrence = change.text.indexOf(name) - val secondOccurrence = change.text.indexOf(name, firstOccurrence + 1) - List(firstOccurrence, secondOccurrence) map (o => (change.from + o, name.length)) - } - - EditorUtils.enterLinkedModeUi(occurrences, selectFirst = true) - } - } - - val shell = PlatformUI.getWorkbench.getActiveWorkbenchWindow.getShell - - createScalaIdeRefactoringForCurrentEditorAndSelection() match { - case Some(r: ExtractLocalScalaIdeRefactoring) => - - r.preparationResult.right.map(_ => r.performRefactoring()) match { - case Right((change: TextChange) :: Nil) => - doInlineExtraction(change, r.name) - case _ => - runRefactoring(createWizardForRefactoring(Some(r)), shell) - } - - case None => runRefactoring(createWizardForRefactoring(None), shell) - } - } -} diff --git a/org.scala-ide.sdt.core/src/org/scalaide/refactoring/internal/ExtractMethod.scala b/org.scala-ide.sdt.core/src/org/scalaide/refactoring/internal/ExtractMethod.scala deleted file mode 100644 index ef81670017..0000000000 --- a/org.scala-ide.sdt.core/src/org/scalaide/refactoring/internal/ExtractMethod.scala +++ /dev/null @@ -1,37 +0,0 @@ -package org.scalaide.refactoring.internal - -import org.scalaide.core.internal.jdt.model.ScalaSourceFile -import org.scalaide.refactoring.internal.ui.NewNameWizardPage -import scala.tools.refactoring.analysis.GlobalIndexes -import scala.tools.refactoring.analysis.NameValidation -import scala.tools.refactoring.implementations - -/** - * Extracts a series of statements into a new method, passing the needed - * parameters and return values. - * - * The implementation found for example in the JDT offers much more configuration - * options, for now, we only require the user to provide a name. - */ -class ExtractMethod extends RefactoringExecutorWithWizard { - - def createRefactoring(selectionStart: Int, selectionEnd: Int, file: ScalaSourceFile) = new ExtractMethodScalaIdeRefactoring(selectionStart, selectionEnd, file) - - class ExtractMethodScalaIdeRefactoring(start: Int, end: Int, file: ScalaSourceFile) extends ScalaIdeRefactoring("Extract Method", file, start, end) { - - val refactoring = file.withSourceFile((sourceFile, compiler) => new implementations.ExtractMethod with GlobalIndexes with NameValidation { - val global = compiler - val index = { - val tree = askLoadedAndTypedTreeForFile(sourceFile).left.get - global.ask(() => GlobalIndex(tree)) - } - }) getOrElse fail() - - var name = "" - - def refactoringParameters = name - - override def getPages = new NewNameWizardPage(s => name = s, refactoring.isValidIdentifier, "extractedMethod", "refactoring_extract_method") :: Nil - - } -}