Skip to content

Commit

Permalink
Minor, use kotlin.Pair instead of intellij
Browse files Browse the repository at this point in the history
  • Loading branch information
udalov committed Apr 24, 2014
1 parent 6066d19 commit de273c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Expand Up @@ -18,11 +18,11 @@

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;
Expand Down Expand Up @@ -122,7 +122,7 @@ public static PsiElement createSemicolon(Project project) {
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
Expand Down
Expand Up @@ -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)
Expand Down
Expand Up @@ -28,7 +28,6 @@
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;
Expand All @@ -43,6 +42,7 @@
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;
Expand Down Expand Up @@ -284,7 +284,7 @@ private static void addFunctionLiteralParameterTypes(@NotNull String parameters,
? 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) {
Expand Down

0 comments on commit de273c0

Please sign in to comment.