-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'Introduce Parameter...' code action
Signed-off-by: Snjezana Peco <[email protected]>
- Loading branch information
Showing
19 changed files
with
5,251 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...ipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/BodyUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2005, 2008 IBM Corporation and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Originally copied from org.eclipse.jdt.internal.corext.refactoring.structure.BodyUpdater | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.jdt.ls.core.internal.corext.refactoring; | ||
|
||
import org.eclipse.core.runtime.CoreException; | ||
import org.eclipse.jdt.core.dom.MethodDeclaration; | ||
import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; | ||
import org.eclipse.ltk.core.refactoring.RefactoringStatus; | ||
|
||
|
||
public abstract class BodyUpdater { | ||
|
||
/** | ||
* Updates the body of a method declaration. This method is called by the | ||
* {@link ChangeSignatureProcessor} and allows implementors to refactor the body | ||
* of the given method declaration. | ||
* | ||
* @param methodDeclaration | ||
* @param cuRewrite | ||
* @param result | ||
* @throws CoreException | ||
*/ | ||
public abstract void updateBody(MethodDeclaration methodDeclaration, CompilationUnitRewrite cuRewrite, RefactoringStatus result) throws CoreException; | ||
|
||
/** | ||
* Returns whether {@link ChangeSignatureProcessor} should check if | ||
* deleted parameters are currently used in the method body. | ||
* | ||
* @return <code>true</code> by default, subclasses can override | ||
*/ | ||
public boolean needsParameterUsedCheck() { | ||
return true; | ||
} | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
...jdt/ls/core/internal/corext/refactoring/ChangeMethodSignatureRefactoringContribution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2005, 2011 IBM Corporation and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copied from org.eclipse.jdt.internal.corext.refactoring.scripting.ChangeMethodSignatureRefactoringContribution | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.jdt.ls.core.internal.corext.refactoring; | ||
|
||
import java.util.Map; | ||
|
||
import org.eclipse.core.runtime.CoreException; | ||
import org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringContribution; | ||
import org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor; | ||
import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory; | ||
import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; | ||
import org.eclipse.ltk.core.refactoring.Refactoring; | ||
import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; | ||
import org.eclipse.ltk.core.refactoring.RefactoringStatus; | ||
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; | ||
|
||
/** | ||
* Refactoring contribution for the change method signature refactoring. | ||
* | ||
* @since 3.2 | ||
*/ | ||
public final class ChangeMethodSignatureRefactoringContribution extends JavaRefactoringContribution { | ||
|
||
@Override | ||
public Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException { | ||
JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor)); | ||
ChangeSignatureProcessor processor= new ChangeSignatureProcessor(arguments, status); | ||
return new ProcessorBasedRefactoring(processor); | ||
} | ||
|
||
@Override | ||
public RefactoringDescriptor createDescriptor() { | ||
return RefactoringSignatureDescriptorFactory.createChangeMethodSignatureDescriptor(); | ||
} | ||
|
||
@Override | ||
public RefactoringDescriptor createDescriptor(String id, String project, String description, String comment, Map<String, String> arguments, int flags) { | ||
return RefactoringSignatureDescriptorFactory.createChangeMethodSignatureDescriptor(project, description, comment, arguments, flags); | ||
} | ||
|
||
} |
Oops, something went wrong.