Minor, use kotlin.Pair instead of intellij
This commit is contained in:
@@ -18,11 +18,11 @@ package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.LocalTimeCounter;
|
||||
import kotlin.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.resolve.ImportPath;
|
||||
@@ -122,7 +122,7 @@ public class JetPsiFactory {
|
||||
public static Pair<PsiElement, PsiElement> createWhitespaceAndArrow(Project project) {
|
||||
JetFunctionType functionType = (JetFunctionType) createType(project, "() -> Int").getTypeElement();
|
||||
assert functionType != null;
|
||||
return Pair.create(functionType.findElementAt(2), functionType.findElementAt(3));
|
||||
return new Pair<PsiElement, PsiElement>(functionType.findElementAt(2), functionType.findElementAt(3));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -72,8 +72,8 @@ public class MakeTypeExplicitInLambdaIntention : JetSelfTargetingIntention<JetFu
|
||||
val openBraceElement = functionLiteral.getOpenBraceNode().getPsi()
|
||||
val nextSibling = openBraceElement?.getNextSibling()
|
||||
val addNewline = nextSibling is PsiWhiteSpace && "\n" in nextSibling.getText()
|
||||
val whitespaceAndArrow = JetPsiFactory.createWhitespaceAndArrow(element.getProject())
|
||||
functionLiteral.addRangeAfter(whitespaceAndArrow.first, whitespaceAndArrow.second, openBraceElement)
|
||||
val (whitespace, arrow) = JetPsiFactory.createWhitespaceAndArrow(element.getProject())
|
||||
functionLiteral.addRangeAfter(whitespace, arrow, openBraceElement)
|
||||
functionLiteral.addAfter(newParameterList, openBraceElement)
|
||||
if (addNewline) {
|
||||
functionLiteral.addAfter(JetPsiFactory.createNewLine(element.getProject()), openBraceElement)
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.openapi.editor.colors.EditorColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
@@ -43,6 +42,7 @@ import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.refactoring.util.RefactoringMessageDialog;
|
||||
import com.intellij.util.Function;
|
||||
import kotlin.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
@@ -284,7 +284,7 @@ public class KotlinInlineValHandler extends InlineActionHandler {
|
||||
? nextSibling.copy() : null;
|
||||
|
||||
Pair<PsiElement, PsiElement> whitespaceAndArrow = JetPsiFactory.createWhitespaceAndArrow(containingFile.getProject());
|
||||
functionLiteral.addRangeAfter(whitespaceAndArrow.first, whitespaceAndArrow.second, openBraceElement);
|
||||
functionLiteral.addRangeAfter(whitespaceAndArrow.getFirst(), whitespaceAndArrow.getSecond(), openBraceElement);
|
||||
|
||||
functionLiteral.addAfter(newParameterList, openBraceElement);
|
||||
if (whitespaceToAdd != null) {
|
||||
|
||||
Reference in New Issue
Block a user