mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -179,6 +179,10 @@ public class ProblemsHolder {
|
||||
return myOnTheFly;
|
||||
}
|
||||
|
||||
public PsiFile getFile() {
|
||||
return myFile;
|
||||
}
|
||||
|
||||
public final Project getProject() {
|
||||
return myManager.getProject();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author cdr
|
||||
*/
|
||||
public abstract class WalkingState<T> {
|
||||
public class WalkingState<T> {
|
||||
public interface TreeGuide<T> {
|
||||
T getNextSibling(@NotNull T element);
|
||||
T getPrevSibling(@NotNull T element);
|
||||
@@ -33,9 +33,9 @@ public abstract class WalkingState<T> {
|
||||
private final TreeGuide<T> myWalker;
|
||||
private boolean stopped;
|
||||
|
||||
public abstract void elementFinished(@NotNull T element);
|
||||
public void elementFinished(@NotNull T element) {}
|
||||
|
||||
protected WalkingState(@NotNull TreeGuide<T> delegate) {
|
||||
public WalkingState(@NotNull TreeGuide<T> delegate) {
|
||||
myWalker = delegate;
|
||||
}
|
||||
|
||||
@@ -100,4 +100,4 @@ public abstract class WalkingState<T> {
|
||||
public void stopWalking() {
|
||||
stopped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ public class DaemonTooltipUtil {
|
||||
public static void showInfoTooltip(@NotNull final HighlightInfo info, final Editor editor, final int defaultOffset, final int currentWidth) {
|
||||
if (info.toolTip == null) return;
|
||||
Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
|
||||
int endOffset = info.highlighter.getEndOffset();
|
||||
int startOffset = info.highlighter.getStartOffset();
|
||||
int startOffset = info.getActualStartOffset();
|
||||
int endOffset = info.getActualEndOffset();
|
||||
|
||||
Point top = editor.logicalPositionToXY(editor.offsetToLogicalPosition(startOffset));
|
||||
Point bottom = editor.logicalPositionToXY(editor.offsetToLogicalPosition(endOffset));
|
||||
|
||||
+3
-10
@@ -21,8 +21,6 @@ import com.intellij.openapi.editor.ex.ErrorStripeEvent;
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ErrorStripeHandler extends ErrorStripeAdapter {
|
||||
private final Project myProject;
|
||||
|
||||
@@ -39,14 +37,9 @@ public class ErrorStripeHandler extends ErrorStripeAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
private HighlightInfo findInfo(RangeHighlighter highlighter) {
|
||||
List<HighlightInfo> highlights = DaemonCodeAnalyzerImpl.getHighlights(highlighter.getDocument(), myProject);
|
||||
if (highlights == null) return null;
|
||||
for (HighlightInfo info : highlights) {
|
||||
if (info.highlighter == highlighter) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
private static HighlightInfo findInfo(final RangeHighlighter highlighter) {
|
||||
Object o = highlighter.getErrorStripeTooltip();
|
||||
if (o instanceof HighlightInfo) return (HighlightInfo)o;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,12 +22,12 @@ import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory;
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.ex.InspectionProfileWrapper;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.AbstractProjectComponent;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.profile.Profile;
|
||||
import com.intellij.profile.ProfileChangeAdapter;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
@@ -106,4 +106,4 @@ public class WholeFileLocalInspectionsPassFactory extends AbstractProjectCompone
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,6 +253,11 @@ public class UndoManagerImpl extends UndoManager implements ProjectComponent, Ap
|
||||
clearUndoRedoQueue(DocumentReferenceManager.getInstance().create(file));
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public void clearUndoRedoQueueInTests(Document document) {
|
||||
clearUndoRedoQueue(DocumentReferenceManager.getInstance().create(document));
|
||||
}
|
||||
|
||||
protected void compact() {
|
||||
if (myCurrentOperationState == NONE && myCommandTimestamp % COMMAND_TO_RUN_COMPACT == 0) {
|
||||
doCompact();
|
||||
|
||||
@@ -70,7 +70,7 @@ public class FoldRegionImpl extends RangeMarkerImpl implements FoldRegion {
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return super.isValid() && getStartOffset() + 1 < getEndOffset();
|
||||
return super.isValid() && myStart + 1 < myEnd;
|
||||
}
|
||||
|
||||
public void setExpandedInternal(boolean toExpand) {
|
||||
|
||||
+15
-14
@@ -21,8 +21,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.RangeMarker;
|
||||
import com.intellij.openapi.editor.ex.DocumentEx;
|
||||
import com.intellij.openapi.editor.impl.PersistentRangeMarker;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -58,7 +56,10 @@ import org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringBundle;
|
||||
import org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringUtil;
|
||||
import org.jetbrains.plugins.groovy.refactoring.NameValidator;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
@@ -85,10 +86,10 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
|
||||
Map<PsiElement, String> conflicts = new HashMap<PsiElement, String>();
|
||||
|
||||
for (GroovyInlineMethodUtil.ReferenceExpressionInfo info : infos) {
|
||||
if (!(PsiUtil.isAccessible(call, info.declaration))) {
|
||||
if (!PsiUtil.isAccessible(call, info.declaration)) {
|
||||
if (info.declaration instanceof PsiMethod) {
|
||||
String className = info.containingClass.getName();
|
||||
String signature = GroovyRefactoringUtil.getMethodSignature(((PsiMethod) info.declaration));
|
||||
String signature = GroovyRefactoringUtil.getMethodSignature((PsiMethod) info.declaration);
|
||||
String name = CommonRefactoringUtil.htmlEmphasize(className + "." + signature);
|
||||
conflicts.put(info.declaration, GroovyRefactoringBundle.message("method.is.not.accessible.form.context.0", name));
|
||||
} else if (info.declaration instanceof PsiField) {
|
||||
@@ -147,9 +148,9 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
|
||||
qualifier = ((GrParenthesizedExpression) qualifier).getOperand();
|
||||
}
|
||||
qualifierDeclaration = factory.createVariableDeclaration(ArrayUtil.EMPTY_STRING_ARRAY, qualifier, null, qualName);
|
||||
innerQualifier = ((GrReferenceExpression) factory.createExpressionFromText(qualName));
|
||||
innerQualifier = (GrReferenceExpression) factory.createExpressionFromText(qualName);
|
||||
} else {
|
||||
innerQualifier = ((GrReferenceExpression) qualifier);
|
||||
innerQualifier = (GrReferenceExpression) qualifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,7 +160,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
|
||||
if (result != null) {
|
||||
GrExpression expression = call.replaceWithExpression(result, false);
|
||||
TextRange range = expression.getTextRange();
|
||||
return editor != null ? new PersistentRangeMarker((DocumentEx)editor.getDocument(), range.getStartOffset(), range.getEndOffset()) : null;
|
||||
return editor != null ? editor.getDocument().createRangeMarker(range.getStartOffset(), range.getEndOffset(), true) : null;
|
||||
}
|
||||
|
||||
String resultName = InlineMethodConflictSolver.suggestNewName("result", newMethod, call);
|
||||
@@ -245,13 +246,13 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
|
||||
assert replaced != null;
|
||||
|
||||
TextRange range = replaced.getTextRange();
|
||||
RangeMarker marker = editor != null ? new PersistentRangeMarker((DocumentEx)editor.getDocument(), range.getStartOffset(), range.getEndOffset()) : null;
|
||||
RangeMarker marker = editor != null ? editor.getDocument().createRangeMarker(range.getStartOffset(), range.getEndOffset(), true) : null;
|
||||
reformatOwner(owner);
|
||||
return marker;
|
||||
} else {
|
||||
GrStatement stmt;
|
||||
if (isTailMethodCall && enclosingExpr.getParent() instanceof GrReturnStatement) {
|
||||
stmt = ((GrReturnStatement) enclosingExpr.getParent());
|
||||
stmt = (GrReturnStatement) enclosingExpr.getParent();
|
||||
} else {
|
||||
stmt = enclosingExpr;
|
||||
}
|
||||
@@ -332,7 +333,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
|
||||
if (statement instanceof GrReturnStatement) {
|
||||
expr = ((GrReturnStatement) statement).getReturnValue();
|
||||
} else {
|
||||
expr = ((GrExpression) statement);
|
||||
expr = (GrExpression) statement;
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
@@ -382,7 +383,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
|
||||
if (element == null) return;
|
||||
for (PsiElement child : element.getChildren()) {
|
||||
if (child instanceof GrVariable && !(child instanceof GrParameter)) {
|
||||
defintions.add(((GrVariable) child));
|
||||
defintions.add((GrVariable) child);
|
||||
}
|
||||
if (!(child instanceof GrClosableBlock)) {
|
||||
collectInnerDefinitions(child, defintions);
|
||||
@@ -401,10 +402,10 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
|
||||
assert body != null;
|
||||
GrStatement[] statements = body.getStatements();
|
||||
if (statements.length == 1) {
|
||||
if (statements[0] instanceof GrExpression) return ((GrExpression) statements[0]);
|
||||
if (statements[0] instanceof GrExpression) return (GrExpression) statements[0];
|
||||
if (statements[0] instanceof GrReturnStatement) {
|
||||
GrExpression value = ((GrReturnStatement) statements[0]).getReturnValue();
|
||||
if (value == null && (PsiUtil.getSmartReturnType(method) != PsiType.VOID)) {
|
||||
if (value == null && PsiUtil.getSmartReturnType(method) != PsiType.VOID) {
|
||||
return GroovyPsiElementFactory.getInstance(method.getProject()).createExpressionFromText("null");
|
||||
}
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user