Move "Introduce..." classes to separate package
Rename Jet -> Kotlin
This commit is contained in:
@@ -24,7 +24,7 @@ import org.jetbrains.jet.lang.psi.JetPsiUtil
|
||||
import org.jetbrains.jet.lexer.JetTokens
|
||||
import org.jetbrains.jet.lang.psi.JetPsiFactory
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import org.jetbrains.jet.plugin.refactoring.introduceVariable.JetIntroduceVariableHandler
|
||||
import org.jetbrains.jet.plugin.refactoring.introduce.introduceVariable.KotlinIntroduceVariableHandler
|
||||
import org.jetbrains.jet.lang.psi.JetSafeQualifiedExpression
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext
|
||||
import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache
|
||||
@@ -107,7 +107,7 @@ fun JetExpression.convertToIfNotNullExpression(conditionLhs: JetExpression, then
|
||||
fun JetIfExpression.introduceValueForCondition(occurrenceInThenClause: JetExpression, editor: Editor) {
|
||||
val project = this.getProject()
|
||||
val occurrenceInConditional = (this.getCondition() as JetBinaryExpression).getLeft()!!
|
||||
JetIntroduceVariableHandler.doRefactoring(project, editor, occurrenceInConditional, listOf(occurrenceInConditional, occurrenceInThenClause))
|
||||
KotlinIntroduceVariableHandler.doRefactoring(project, editor, occurrenceInConditional, listOf(occurrenceInConditional, occurrenceInThenClause))
|
||||
}
|
||||
|
||||
fun PsiElement.replace(expressionAsString: String): PsiElement =
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.plugin.refactoring.changeSignature.JetChangeSignatureHandler;
|
||||
import org.jetbrains.jet.plugin.refactoring.introduceVariable.JetIntroduceVariableHandler;
|
||||
import org.jetbrains.jet.plugin.refactoring.introduce.introduceVariable.KotlinIntroduceVariableHandler;
|
||||
import org.jetbrains.jet.plugin.refactoring.safeDelete.SafeDeletePackage;
|
||||
|
||||
public class JetRefactoringSupportProvider extends RefactoringSupportProvider {
|
||||
@@ -35,7 +35,7 @@ public class JetRefactoringSupportProvider extends RefactoringSupportProvider {
|
||||
|
||||
@Override
|
||||
public RefactoringActionHandler getIntroduceVariableHandler() {
|
||||
return new JetIntroduceVariableHandler();
|
||||
return new KotlinIntroduceVariableHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.refactoring;
|
||||
package org.jetbrains.jet.plugin.refactoring.introduce;
|
||||
|
||||
import com.intellij.refactoring.RefactoringActionHandler;
|
||||
|
||||
public abstract class JetIntroduceHandlerBase implements RefactoringActionHandler {
|
||||
public abstract class KotlinIntroduceHandlerBase implements RefactoringActionHandler {
|
||||
}
|
||||
+3
-3
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.refactoring.introduceVariable;
|
||||
package org.jetbrains.jet.plugin.refactoring.introduce.introduceVariable;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiFactory;
|
||||
|
||||
public class JetChangePropertyActions {
|
||||
private JetChangePropertyActions() {
|
||||
public class KotlinChangePropertyActions {
|
||||
private KotlinChangePropertyActions() {
|
||||
}
|
||||
|
||||
public static void declareValueOrVariable(Project project, boolean isVariable, JetProperty property) {
|
||||
+11
-11
@@ -14,10 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.refactoring.introduceVariable;
|
||||
package org.jetbrains.jet.plugin.refactoring.introduce.introduceVariable;
|
||||
|
||||
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
|
||||
import com.intellij.codeInsight.template.impl.TemplateState;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
@@ -45,7 +43,7 @@ import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class JetInplaceVariableIntroducer extends InplaceVariableIntroducer<JetExpression> {
|
||||
public class KotlinInplaceVariableIntroducer extends InplaceVariableIntroducer<JetExpression> {
|
||||
|
||||
private final boolean myReplaceOccurrence;
|
||||
private final JetProperty myProperty;
|
||||
@@ -56,11 +54,13 @@ public class JetInplaceVariableIntroducer extends InplaceVariableIntroducer<JetE
|
||||
private JCheckBox myVarCheckbox;
|
||||
private JCheckBox myExprTypeCheckbox;
|
||||
|
||||
public JetInplaceVariableIntroducer(PsiNamedElement elementToRename, Editor editor, Project project,
|
||||
String title, JetExpression[] occurrences,
|
||||
@Nullable JetExpression expr, boolean replaceOccurrence,
|
||||
JetProperty property, boolean isVar, boolean doNotChangeVar,
|
||||
@Nullable JetType exprType, boolean noTypeInference) {
|
||||
public KotlinInplaceVariableIntroducer(
|
||||
PsiNamedElement elementToRename, Editor editor, Project project,
|
||||
String title, JetExpression[] occurrences,
|
||||
@Nullable JetExpression expr, boolean replaceOccurrence,
|
||||
JetProperty property, boolean isVar, boolean doNotChangeVar,
|
||||
@Nullable JetType exprType, boolean noTypeInference
|
||||
) {
|
||||
super(elementToRename, editor, project, title, occurrences, expr);
|
||||
this.myReplaceOccurrence = replaceOccurrence;
|
||||
myProperty = property;
|
||||
@@ -84,8 +84,8 @@ public class JetInplaceVariableIntroducer extends InplaceVariableIntroducer<JetE
|
||||
@Override
|
||||
protected void run(Result result) throws Throwable {
|
||||
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
|
||||
JetChangePropertyActions.declareValueOrVariable(myProject, myVarCheckbox.isSelected(),
|
||||
myProperty);
|
||||
KotlinChangePropertyActions.declareValueOrVariable(myProject, myVarCheckbox.isSelected(),
|
||||
myProperty);
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
+5
-4
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.refactoring.introduceVariable;
|
||||
package org.jetbrains.jet.plugin.refactoring.introduce.introduceVariable;
|
||||
|
||||
import com.intellij.codeInsight.PsiEquivalenceUtil;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -52,11 +52,12 @@ import org.jetbrains.jet.plugin.codeInsight.ShortenReferences;
|
||||
import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache;
|
||||
import org.jetbrains.jet.plugin.project.ResolveSessionForBodies;
|
||||
import org.jetbrains.jet.plugin.refactoring.*;
|
||||
import org.jetbrains.jet.plugin.refactoring.introduce.KotlinIntroduceHandlerBase;
|
||||
import org.jetbrains.jet.renderer.DescriptorRenderer;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase {
|
||||
public class KotlinIntroduceVariableHandler extends KotlinIntroduceHandlerBase {
|
||||
|
||||
private static final String INTRODUCE_VARIABLE = JetRefactoringBundle.message("introduce.variable");
|
||||
|
||||
@@ -211,8 +212,8 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase {
|
||||
PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
|
||||
PsiDocumentManager.getInstance(project).
|
||||
doPostponedOperationsAndUnblockDocument(editor.getDocument());
|
||||
JetInplaceVariableIntroducer variableIntroducer =
|
||||
new JetInplaceVariableIntroducer(property, editor, project, INTRODUCE_VARIABLE,
|
||||
KotlinInplaceVariableIntroducer variableIntroducer =
|
||||
new KotlinInplaceVariableIntroducer(property, editor, project, INTRODUCE_VARIABLE,
|
||||
references.toArray(new JetExpression[references.size()]),
|
||||
reference.get(), finalReplaceOccurrence,
|
||||
property, /*todo*/false, /*todo*/false,
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.refactoring.introduceVariable;
|
||||
package org.jetbrains.jet.plugin.refactoring.introduce.introduceVariable;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -160,7 +160,7 @@ public class JetIntroduceVariableTest extends LightCodeInsightFixtureTestCase {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new JetIntroduceVariableHandler().invoke(getProject(), myFixture.getEditor(), file,
|
||||
new KotlinIntroduceVariableHandler().invoke(getProject(), myFixture.getEditor(), file,
|
||||
DataManager.getInstance().getDataContext(myFixture.getEditor().
|
||||
getComponent()));
|
||||
}
|
||||
Reference in New Issue
Block a user