Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.ui.IconManager;
import com.intellij.util.PlatformIcons;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.lang.dart.DartBundle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ protected void doAction() {
close(DialogWrapper.OK_EXIT_CODE);
}

@Override
protected String getBorderTitle() {
return RefactoringBundle.message("inline.method.border.title"); // not used actually
}

@Override
protected String getInlineAllText() {
return DartBundle.message("radio.inline.all.references.remove.method");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* LTK wrapper around Analysis Server 'Inline Local' refactoring.
*/
public class ServerInlineLocalRefactoring extends ServerRefactoring {
private String variableName;
private int occurrences;

public ServerInlineLocalRefactoring(final @NotNull Project project, final @NotNull VirtualFile file, final int offset, final int length) {
Expand All @@ -25,10 +24,6 @@ public int getOccurrences() {
return occurrences;
}

public String getVariableName() {
return variableName;
}

@Override
protected RefactoringOptions getOptions() {
return null;
Expand All @@ -37,7 +32,6 @@ protected RefactoringOptions getOptions() {
@Override
protected void setFeedback(@NotNull RefactoringFeedback _feedback) {
InlineLocalVariableFeedback feedback = (InlineLocalVariableFeedback)_feedback;
variableName = feedback.getName();
occurrences = feedback.getOccurrences();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ private void performOnExpression(DartExpression expression) {
final int[] occurrencesOffsets = refactoring.getOccurrencesOffsets();
final int[] occurrencesLengths = refactoring.getOccurrencesLengths();
occurrences = getDartExpressions(occurrencesOffsets, occurrencesLengths);
if (occurrences == null) {
return;
}
}
// handle occurrences
OccurrencesChooser.<DartExpression>simpleChooser(editor).showChooser(expression, occurrences, new Pass<>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,6 @@ public void addWarning(@NotNull String msg, @Nullable RefactoringStatusContext c
addEntry(new RefactoringStatusEntry(RefactoringStatusSeverity.WARNING, msg, context));
}

/**
* @return the copy of this {@link RefactoringStatus} with {@link RefactoringStatusSeverity#ERROR}
* replaced with {@link RefactoringStatusSeverity#FATAL}.
*/
public @NotNull RefactoringStatus escalateErrorToFatal() {
RefactoringStatus result = new RefactoringStatus();
for (RefactoringStatusEntry entry : entries) {
RefactoringStatusSeverity severity = entry.getSeverity();
if (severity == RefactoringStatusSeverity.ERROR) {
severity = RefactoringStatusSeverity.FATAL;
}
result.addEntry(new RefactoringStatusEntry(severity, entry.getMessage(), entry.getContext()));
}
return result;
}

/**
* @return the {@link RefactoringStatusEntry}s.
*/
public @NotNull List<RefactoringStatusEntry> getEntries() {
return entries;
}

/**
* @return the RefactoringStatusEntry with the highest severity, or {@code null} if no
* entries are present.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
import org.jetbrains.annotations.Nullable;

public final class DartElementGenerator {
public static @Nullable DartReference createReferenceFromText(Project myProject, String text) {
final DartExpression expression = createExpressionFromText(myProject, text);
return expression instanceof DartReference ? (DartReference)expression : null;
}

public static @Nullable DartExpression createExpressionFromText(Project myProject, String text) {
final PsiFile file = createDummyFile(myProject, "var dummy = " + text + ";");
final PsiElement child = file.getFirstChild();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.lang.dart.util;

import com.intellij.codeInsight.PsiEquivalenceUtil;
import com.intellij.lang.ASTNode;
import com.intellij.navigation.NavigationItem;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiWhiteSpace;
import com.intellij.psi.ResolveState;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.lang.dart.DartComponentType;
import com.jetbrains.lang.dart.DartTokenTypes;
import com.jetbrains.lang.dart.psi.*;
import com.jetbrains.lang.dart.resolve.ComponentNameScopeProcessor;
Expand All @@ -32,41 +28,6 @@ public static Set<DartComponentName> collectUsedComponents(PsiElement context) {
return usedComponentNames;
}

public static @Nullable DartExpression getSelectedExpression(final @NotNull Project project,
@NotNull PsiFile file,
final @NotNull PsiElement element1,
final @NotNull PsiElement element2) {
PsiElement parent = PsiTreeUtil.findCommonParent(element1, element2);
if (parent == null) {
return null;
}
if (parent instanceof DartExpression) {
return (DartExpression)parent;
}
return PsiTreeUtil.getParentOfType(parent, DartExpression.class);
}

public static @NotNull List<PsiElement> getOccurrences(final @NotNull PsiElement pattern, final @Nullable PsiElement context) {
if (context == null) {
return Collections.emptyList();
}
final List<PsiElement> occurrences = new SmartList<>();
context.acceptChildren(new DartRecursiveVisitor() {
@Override
public void visitElement(final @NotNull PsiElement element) {
if (DartComponentType.typeOf(element) == DartComponentType.PARAMETER) {
return;
}
if (PsiEquivalenceUtil.areElementsEquivalent(element, pattern)) {
occurrences.add(element);
return;
}
super.visitElement(element);
}
});
return occurrences;
}

public static PsiElement @NotNull [] findStatementsInRange(PsiFile file, int startOffset, int endOffset) {
PsiElement element1 = file.findElementAt(startOffset);
PsiElement element2 = file.findElementAt(endOffset - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,12 +866,6 @@ public void visitElement(@NotNull PsiElement element) {
return null;
}

public static boolean aloneOrFirstInChain(DartReference reference) {
return PsiTreeUtil.getChildrenOfType(reference, DartReference.class) == null &&
getLeftReference(reference) == null &&
getLeftReference(reference.getParent()) == null;
}

public static ResolveResult @NotNull [] toCandidateInfoArray(@Nullable List<? extends PsiElement> elements) {
if (elements == null) {
return ResolveResult.EMPTY_ARRAY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.Function;
import com.jetbrains.lang.dart.DartTokenTypes;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public final class UsefulPsiTreeUtil {
public static ASTNode[] findChildrenRange(ASTNode[] elements, int startOffset, int endOffset) {
Expand Down Expand Up @@ -57,22 +53,6 @@ public static boolean isWhitespaceOrComment(PsiElement element) {
return element instanceof PsiWhiteSpace || element instanceof PsiComment;
}

public static @Nullable List<PsiElement> getPathToParentOfType(@Nullable PsiElement element,
@NotNull Class<? extends PsiElement> aClass) {
if (element == null) return null;
final List<PsiElement> result = new ArrayList<>();
while (element != null) {
result.add(element);
if (aClass.isInstance(element)) {
return result;
}
if (element instanceof PsiFile) return null;
element = element.getParent();
}

return null;
}

public static @Nullable PsiElement getNextSiblingSkippingWhiteSpacesAndComments(PsiElement sibling) {
return getSiblingSkippingCondition(
sibling,
Expand Down Expand Up @@ -115,13 +95,4 @@ public static boolean isWhitespaceOrComment(PsiElement element) {
}
return result;
}

public static boolean isAncestor(@NotNull PsiElement element, List<? extends PsiElement> children, boolean strict) {
for (PsiElement child : children) {
if (child != null && !PsiTreeUtil.isAncestor(element, child, strict)) {
return false;
}
}
return true;
}
}
Loading