mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 11:00:04 +07:00
Cheaper ProgressManager.checkCanceled(). Mostly, it's call to abstract method eliminated.
This commit is contained in:
@@ -255,7 +255,7 @@ public class CodeInsightUtil {
|
||||
|
||||
return new Processor<PsiClass>() {
|
||||
public boolean process(final PsiClass inheritor) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
public Boolean compute() {
|
||||
|
||||
@@ -178,7 +178,7 @@ public class AllClassesGetter {
|
||||
private static String getPackagePrefix(final PsiElement context, final int offset) {
|
||||
final String fileText = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
|
||||
public String compute() {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
return context.getContainingFile().getText();
|
||||
}
|
||||
});
|
||||
@@ -200,7 +200,7 @@ public class AllClassesGetter {
|
||||
//noinspection AutoUnboxing
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
public Boolean compute() {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
if (!context.isValid() || !psiClass.isValid()) return false;
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
|
||||
|
||||
Set<PsiMethod> methods = new HashSet<PsiMethod>();
|
||||
for (PsiElement element : elements) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (element instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)element;
|
||||
if (PsiUtil.canBeOverriden(method)) {
|
||||
@@ -183,7 +183,7 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
|
||||
final Set<PsiMethod> overridden = new HashSet<PsiMethod>();
|
||||
Set<PsiClass> classes = new THashSet<PsiClass>();
|
||||
for (PsiMethod method : methods) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
final PsiClass parentClass = method.getContainingClass();
|
||||
if (!"java.lang.Object".equals(parentClass.getQualifiedName())) {
|
||||
classes.add(parentClass);
|
||||
|
||||
@@ -47,8 +47,8 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.*;
|
||||
@@ -229,7 +229,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
return;
|
||||
}
|
||||
for (PsiElement element : elements) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
if (unusedSymbolEnabled && element instanceof PsiIdentifier) {
|
||||
PsiIdentifier identifier = (PsiIdentifier)element;
|
||||
@@ -241,7 +241,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
else if (unusedImportEnabled && element instanceof PsiImportList) {
|
||||
final PsiImportStatementBase[] imports = ((PsiImportList)element).getAllImportStatements();
|
||||
for (PsiImportStatementBase statement : imports) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
final HighlightInfo info = processImport(statement, unusedImportKey);
|
||||
if (info != null) {
|
||||
result.add(info);
|
||||
@@ -318,7 +318,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
private boolean isImplicitUsage(final PsiModifierListOwner element) {
|
||||
if (UnusedSymbolLocalInspection.isInjected(element, myUnusedSymbolInspection)) return true;
|
||||
for (ImplicitUsageProvider provider : myImplicitUsageProviders) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (provider.isImplicitUsage(element)) {
|
||||
return true;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
|
||||
private boolean isImplicitRead(final PsiVariable element) {
|
||||
for(ImplicitUsageProvider provider: myImplicitUsageProviders) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (provider.isImplicitRead(element)) {
|
||||
return true;
|
||||
}
|
||||
@@ -339,7 +339,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
|
||||
private boolean isImplicitWrite(final PsiVariable element) {
|
||||
for(ImplicitUsageProvider provider: myImplicitUsageProviders) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (provider.isImplicitWrite(element)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
@@ -334,7 +334,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
}
|
||||
|
||||
@Override public void visitExpression(PsiExpression expression) {
|
||||
ProgressManager.getInstance().checkCanceled(); // visitLiteralExpression is invoked very often in array initializers
|
||||
ProgressManager.checkCanceled(); // visitLiteralExpression is invoked very often in array initializers
|
||||
|
||||
super.visitExpression(expression);
|
||||
if (myHolder.add(HighlightUtil.checkMustBeBoolean(expression))) return;
|
||||
|
||||
+1
-2
@@ -21,7 +21,6 @@ import com.intellij.codeInsight.daemon.QuickFixBundle;
|
||||
import static com.intellij.codeInsight.daemon.impl.quickfix.CreateClassKind.*;
|
||||
import com.intellij.codeInsight.intention.impl.CreateClassDialog;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupItem;
|
||||
import com.intellij.codeInsight.lookup.LookupItemUtil;
|
||||
import com.intellij.codeInsight.template.*;
|
||||
import com.intellij.ide.fileTemplates.FileTemplate;
|
||||
@@ -714,7 +713,7 @@ public class CreateFromUsageUtils {
|
||||
ExpectedTypesProvider provider = ExpectedTypesProvider.getInstance(manager.getProject());
|
||||
JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject());
|
||||
for (int i = 0; i < Math.min(MAX_GUESSED_MEMBERS_COUNT, members.length); i++) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
PsiMember member = members[i];
|
||||
PsiClass aClass = member.getContainingClass();
|
||||
if (aClass instanceof PsiAnonymousClass) continue;
|
||||
|
||||
+2
-2
@@ -20,13 +20,13 @@ import com.intellij.codeInsight.completion.JavaCompletionUtil;
|
||||
import com.intellij.codeInsight.daemon.QuickFixBundle;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.ide.util.MethodCellRenderer;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.PopupChooserBuilder;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.PsiShortNamesCache;
|
||||
@@ -94,7 +94,7 @@ public class StaticImportMethodFix implements IntentionAction {
|
||||
PsiMethod[] methods = cache.getMethodsByNameIfNotMoreThan(name, scope, 20);
|
||||
List<PsiMethod> applicableList = new ArrayList<PsiMethod>();
|
||||
for (PsiMethod method : methods) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
PsiClass aClass = method.getContainingClass();
|
||||
if (aClass != null && JavaCompletionUtil.isInExcludedPackage(aClass)) continue;
|
||||
if (!method.hasModifierProperty(PsiModifier.STATIC)) continue;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class JavaFoldingBuilder extends FoldingBuilderEx implements DumbAware {
|
||||
|
||||
PsiClass[] classes = file.getClasses();
|
||||
for (PsiClass aClass : classes) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
addElementsToFold(result, aClass, document, true, quick);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class JavaFoldingBuilder extends FoldingBuilderEx implements DumbAware {
|
||||
|
||||
PsiElement[] children = aClass.getChildren();
|
||||
for (PsiElement child : children) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
if (child instanceof PsiMethod) {
|
||||
PsiMethod method = (PsiMethod)child;
|
||||
|
||||
@@ -94,7 +94,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
private boolean myRecursionStopper = false;
|
||||
|
||||
private void addInstruction(Instruction instruction) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
if (!myRecursionStopper) {
|
||||
myRecursionStopper = true;
|
||||
|
||||
@@ -124,7 +124,7 @@ public class DataFlowRunner {
|
||||
final long before = System.currentTimeMillis();
|
||||
while (!queue.isEmpty()) {
|
||||
if (!unitTestMode && System.currentTimeMillis() - before > timeLimit) return RunnerResult.TOO_COMPLEX;
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
DfaInstructionState instructionState = queue.remove(0);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
|
||||
@@ -686,7 +686,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
|
||||
for (int i = 0; i < varClass.size(); i++) {
|
||||
if ((++interruptCount & 0xf) == 0) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
}
|
||||
int cl = varClass.get(i);
|
||||
DfaValue value = myFactory.getValue(cl);
|
||||
|
||||
@@ -382,7 +382,7 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
|
||||
progress.setText(FindBundle.message("find.searching.for.references.to.class.progress", aClass.getName()));
|
||||
}
|
||||
for (PsiFile file : files) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
ReferencesSearch.search(aClass, new LocalSearchScope(file), false).forEach(new ReadActionProcessor<PsiReference>() {
|
||||
public boolean processInReadAction(final PsiReference psiReference) {
|
||||
return addResult(results, psiReference, options, aClass);
|
||||
|
||||
@@ -22,8 +22,8 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.jsp.JspFile;
|
||||
import com.intellij.psi.jsp.JavaJspElementVisitor;
|
||||
import com.intellij.psi.jsp.JspFile;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
@@ -202,7 +202,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
|
||||
// register all sub ranges
|
||||
for (Map.Entry<PsiElement, ControlFlowSubRange> entry : mySubRanges.entrySet()) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
ControlFlowSubRange subRange = entry.getValue();
|
||||
PsiElement element = entry.getKey();
|
||||
myControlFlowFactory.registerSubRange(element, subRange, myEvaluateConstantIfConfition, myPolicy);
|
||||
@@ -211,13 +211,13 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
|
||||
private void startElement(PsiElement element) {
|
||||
for (PsiElement child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (child instanceof PsiErrorElement && !Comparing.strEqual(((PsiErrorElement)child).getErrorDescription(), JavaErrorMessages.message("expected.semicolon"))) {
|
||||
// do not perform control flow analysis for incomplete code
|
||||
throw new AnalysisCanceledSoftException(element);
|
||||
}
|
||||
}
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
myCurrentFlow.startElement(element);
|
||||
|
||||
generateUncheckedExceptionJumpsIfNeeded(element, true);
|
||||
@@ -249,7 +249,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
}
|
||||
|
||||
for (int i = myUnhandledExceptionCatchBlocks.size() - 1; i >= 0; i--) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
PsiElement block = myUnhandledExceptionCatchBlocks.get(i);
|
||||
// cannot jump to outer catch blocks (belonging to outer try stmt) if current try{} has finally block
|
||||
if (block == null) {
|
||||
@@ -286,7 +286,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
//}
|
||||
Collection<PsiClassType> unhandledExceptions = ExceptionUtil.collectUnhandledExceptions(element, element.getParent());
|
||||
for (PsiClassType unhandledException : unhandledExceptions) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
generateThrow(unhandledException, element);
|
||||
}
|
||||
}
|
||||
@@ -294,7 +294,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
private void generateThrow(PsiClassType unhandledException, PsiElement throwingElement) {
|
||||
final List<PsiElement> catchBlocks = findThrowToBlocks(unhandledException);
|
||||
for (PsiElement block : catchBlocks) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
ConditionalThrowToInstruction instruction = new ConditionalThrowToInstruction(0);
|
||||
myCurrentFlow.addInstruction(instruction);
|
||||
if (!patchCheckedThrowInstructionIfInsideFinally(instruction, throwingElement, block)) {
|
||||
@@ -352,7 +352,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
int prevOffset = myCurrentFlow.getSize();
|
||||
PsiElement[] children = codeFragment.getChildren();
|
||||
for (PsiElement child : children) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
child.accept(this);
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
int prevOffset = myCurrentFlow.getSize();
|
||||
PsiStatement[] statements = block.getStatements();
|
||||
for (PsiStatement statement : statements) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
statement.accept(this);
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
int pc = myCurrentFlow.getSize();
|
||||
PsiElement[] elements = statement.getDeclaredElements();
|
||||
for (PsiElement element : elements) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (element instanceof PsiClass) {
|
||||
element.accept(this);
|
||||
}
|
||||
@@ -568,7 +568,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
expression.accept(this);
|
||||
|
||||
for (PsiParameter catchParameter : myCatchParameters) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
PsiType type = catchParameter.getType();
|
||||
if (type instanceof PsiClassType) {
|
||||
generateThrow((PsiClassType)type, statement);
|
||||
@@ -581,7 +581,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
startElement(statement);
|
||||
PsiExpression[] expressions = statement.getExpressionList().getExpressions();
|
||||
for (PsiExpression expr : expressions) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
expr.accept(this);
|
||||
}
|
||||
finishElement(statement);
|
||||
@@ -849,7 +849,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
PsiStatement[] statements = body.getStatements();
|
||||
PsiSwitchLabelStatement defaultLabel = null;
|
||||
for (PsiStatement aStatement : statements) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (aStatement instanceof PsiSwitchLabelStatement) {
|
||||
if (((PsiSwitchLabelStatement)aStatement).isDefaultCase()) {
|
||||
defaultLabel = (PsiSwitchLabelStatement)aStatement;
|
||||
@@ -911,7 +911,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < blocks.size(); i++) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
element = blocks.get(i);
|
||||
BranchingInstruction instruction = i == blocks.size() - 1
|
||||
? new ThrowToInstruction(0)
|
||||
@@ -943,7 +943,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
private List<PsiElement> findThrowToBlocks(PsiClassType throwType) {
|
||||
List<PsiElement> blocks = new ArrayList<PsiElement>();
|
||||
for (int i = myCatchParameters.size() - 1; i >= 0; i--) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
PsiParameter parameter = myCatchParameters.get(i);
|
||||
final PsiType type = parameter.getType();
|
||||
PsiClass catchedClass = PsiUtil.resolveClassInType(type);
|
||||
@@ -1004,7 +1004,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
int catchNum = Math.min(catchBlocks.length, catchBlockParameters.length);
|
||||
myUnhandledExceptionCatchBlocks.push(null);
|
||||
for (int i = catchNum - 1; i >= 0; i--) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
myCatchParameters.push(catchBlockParameters[i]);
|
||||
myCatchBlocks.push(catchBlocks[i]);
|
||||
|
||||
@@ -1044,7 +1044,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
}
|
||||
|
||||
for (int i = catchNum - 1; i >= 0; i--) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (myPolicy.isParameterAccepted(catchBlockParameters[i])) {
|
||||
generateWriteInstruction(catchBlockParameters[i]);
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
// checked exception throwing completion. need to dispatch to the correct catch clause
|
||||
final List<PsiElement> unhandledExceptionCatchBlocks = finallyBlockToUnhandledExceptions.remove(finallyBlock);
|
||||
for (int i = 0; unhandledExceptionCatchBlocks != null && i < unhandledExceptionCatchBlocks.size(); i++) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
PsiElement catchBlock = unhandledExceptionCatchBlocks.get(i);
|
||||
|
||||
final ReturnInstruction returnInstruction = new ReturnInstruction(0, myStack, callInstruction);
|
||||
@@ -1192,7 +1192,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
@Override public void visitExpressionList(PsiExpressionList list) {
|
||||
PsiExpression[] expressions = list.getExpressions();
|
||||
for (final PsiExpression expression : expressions) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
myStartStatementStack.pushStatement(expression, false);
|
||||
myEndStatementStack.pushStatement(expression, false);
|
||||
|
||||
@@ -1219,7 +1219,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
|
||||
PsiExpression[] initializers = expression.getInitializers();
|
||||
for (PsiExpression initializer : initializers) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
initializer.accept(this);
|
||||
}
|
||||
|
||||
@@ -1374,7 +1374,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
|
||||
PsiElement[] children = element.getChildren();
|
||||
for (PsiElement child : children) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
child.accept(this);
|
||||
}
|
||||
|
||||
@@ -1427,7 +1427,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
int pc = myCurrentFlow.getSize();
|
||||
PsiElement[] children = expression.getChildren();
|
||||
for (PsiElement child : children) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
child.accept(this);
|
||||
}
|
||||
generateCheckedExceptionJumps(expression);
|
||||
@@ -1543,7 +1543,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
List<PsiVariable> array = new ArrayList<PsiVariable>();
|
||||
addUsedVariables(array, aClass);
|
||||
for (PsiVariable var : array) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
generateReadInstruction(var);
|
||||
}
|
||||
finishElement(aClass);
|
||||
@@ -1561,7 +1561,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
|
||||
|
||||
PsiElement[] children = scope.getChildren();
|
||||
for (PsiElement child : children) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
addUsedVariables(array, child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class DefUseUtil {
|
||||
Set<PsiVariable> readVariables = new THashSet<PsiVariable>();
|
||||
for (int i = 0; i < instructions.size(); i++) {
|
||||
Instruction instruction = instructions.get(i);
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (instruction instanceof WriteVariableInstruction) {
|
||||
WriteVariableInstruction writeInstruction = (WriteVariableInstruction)instruction;
|
||||
PsiElement context = flow.getElement(i);
|
||||
@@ -189,7 +189,7 @@ public class DefUseUtil {
|
||||
queue.add(outerState);
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
InstructionState state = queue.remove(0);
|
||||
state.markVisited();
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ class PsiShortNamesCacheImpl extends PsiShortNamesCache {
|
||||
});
|
||||
|
||||
for (T member : members) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
if (!scope.contains(member.getContainingFile().getVirtualFile())) continue;
|
||||
if (!set.add(member)) continue;
|
||||
|
||||
@@ -69,14 +69,14 @@ public class AllClassesSearchExecutor implements QueryExecutor<PsiClass, AllClas
|
||||
for (final String name : names) {
|
||||
if (!parameters.nameMatches(name)) continue;
|
||||
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
final PsiClass[] classes = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass[]>() {
|
||||
public PsiClass[] compute() {
|
||||
return cache.getClassesByName(name, scope);
|
||||
}
|
||||
});
|
||||
for (PsiClass psiClass : classes) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (!processor.process(psiClass)) {
|
||||
return false;
|
||||
}
|
||||
@@ -105,4 +105,4 @@ public class AllClassesSearchExecutor implements QueryExecutor<PsiClass, AllClas
|
||||
|
||||
return !stopped[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class JavaDirectInheritorsSearcher implements QueryExecutor<PsiClass, Dir
|
||||
});
|
||||
|
||||
for (PsiReferenceList referenceList : candidates) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
PsiClass candidate = (PsiClass)referenceList.getParent();
|
||||
if (!consumer.process(candidate)) return false;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class JavaDirectInheritorsSearcher implements QueryExecutor<PsiClass, Dir
|
||||
});
|
||||
|
||||
for (PsiAnonymousClass candidate : anonymousCandidates) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (!consumer.process(candidate)) return false;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -21,8 +21,8 @@ import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
@@ -88,7 +88,7 @@ public class JavaClassListReferenceProvider extends JavaClassReferenceProvider {
|
||||
return true;
|
||||
}
|
||||
}.getAllReferences()));
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
}
|
||||
}
|
||||
return results.toArray(new PsiReference[results.size()]);
|
||||
|
||||
@@ -248,7 +248,7 @@ public class InlineUtil {
|
||||
public void run() {
|
||||
ReferencesSearch.search(method).forEach(new Processor<PsiReference>() {
|
||||
public boolean process(final PsiReference psiReference) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (getTailCallType(psiReference) == TailCallType.None) {
|
||||
nonTailCallUsages.add(psiReference);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user