mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJP-961 allow slow operations in the common cases for the time being
GitOrigin-RevId: 34c4d3a16e01eb560fc9ae284a8e65cedfb9c54c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4a3ef63f04
commit
20be9891bc
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.debugger.impl;
|
||||
|
||||
import com.intellij.debugger.DebugEnvironment;
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugProcessStarter;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
@@ -66,9 +67,9 @@ public class GenericDebuggerRunner implements JvmPatchableProgramRunner<GenericD
|
||||
});
|
||||
}
|
||||
else {
|
||||
executionManager.startRunProfile(environment, state, state1 -> {
|
||||
executionManager.startRunProfile(environment, state, state1 -> SlowOperations.allowSlowOperations(() -> {
|
||||
return doExecute(state, environment);
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.impl;
|
||||
|
||||
import com.intellij.debugger.engine.JavaDebugProcess;
|
||||
@@ -43,6 +43,7 @@ import com.intellij.unscramble.ThreadDumpConsoleFactory;
|
||||
import com.intellij.unscramble.ThreadDumpParser;
|
||||
import com.intellij.unscramble.ThreadState;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
@@ -112,9 +113,9 @@ public class DefaultJavaProgramRunner implements JvmPatchableProgramRunner<Runne
|
||||
});
|
||||
}
|
||||
else {
|
||||
executionManager.startRunProfile(environment, currentState, (ignored) -> {
|
||||
executionManager.startRunProfile(environment, currentState, (ignored) -> SlowOperations.allowSlowOperations(() -> {
|
||||
return doExecute(currentState, environment);
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.ExpectedTypeInfo;
|
||||
@@ -38,6 +38,7 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.ThreeState;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
@@ -316,7 +317,7 @@ public final class ConstructorInsertHandler implements InsertHandler<LookupEleme
|
||||
final PsiAnonymousClass
|
||||
aClass = PsiTreeUtil.findElementOfClassAtOffset(file, editor.getCaretModel().getOffset(), PsiAnonymousClass.class, false);
|
||||
if (aClass == null) return;
|
||||
CommandProcessor.getInstance().executeCommand(project, () -> {
|
||||
CommandProcessor.getInstance().executeCommand(project, () -> SlowOperations.allowSlowOperations(() -> {
|
||||
final Collection<CandidateInfo> candidatesToImplement = OverrideImplementExploreUtil.getMethodsToOverrideImplement(aClass, true);
|
||||
for (Iterator<CandidateInfo> iterator = candidatesToImplement.iterator(); iterator.hasNext(); ) {
|
||||
final CandidateInfo candidate = iterator.next();
|
||||
@@ -343,7 +344,7 @@ public final class ConstructorInsertHandler implements InsertHandler<LookupEleme
|
||||
}
|
||||
});
|
||||
}
|
||||
}, getCommandName(), getCommandName(), UndoConfirmationPolicy.DEFAULT, editor.getDocument());
|
||||
}), getCommandName(), getCommandName(), UndoConfirmationPolicy.DEFAULT, editor.getDocument());
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.projectView.impl.nodes;
|
||||
|
||||
import com.intellij.ide.projectView.PresentationData;
|
||||
@@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.ElementPresentationUtil;
|
||||
import com.intellij.psi.impl.source.jsp.jspJava.JspClass;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -160,7 +161,7 @@ public class ClassTreeNode extends BasePsiMemberNode<PsiClass> {
|
||||
public boolean canRepresent(final Object element) {
|
||||
if (!isValid()) return false;
|
||||
|
||||
return super.canRepresent(element) || canRepresent(getValue(), element);
|
||||
return super.canRepresent(element) || SlowOperations.allowSlowOperations(() -> canRepresent(getValue(), element));
|
||||
}
|
||||
|
||||
private boolean canRepresent(final PsiClass psiClass, final Object element) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.lang.java;
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.templateLanguages.TemplateLanguageUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class JavaImportOptimizer implements ImportOptimizer {
|
||||
@@ -36,6 +37,10 @@ public class JavaImportOptimizer implements ImportOptimizer {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
SlowOperations.allowSlowOperations(() -> doRun());
|
||||
}
|
||||
|
||||
private void doRun() {
|
||||
try {
|
||||
final PsiDocumentManager manager = PsiDocumentManager.getInstance(file.getProject());
|
||||
final Document document = manager.getDocument(file);
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.refactoring.introduceVariable;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightUtil;
|
||||
@@ -60,6 +60,7 @@ import com.intellij.refactoring.util.occurrences.ExpressionOccurrenceManager;
|
||||
import com.intellij.refactoring.util.occurrences.NotInSuperCallOccurrenceFilter;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.siyeh.ig.psiutils.CommentTracker;
|
||||
@@ -692,7 +693,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
|
||||
@Override
|
||||
public void pass(final JavaReplaceChoice choice) {
|
||||
if (choice == null || !tryIntroduceInplace(project, editor, choice, occurrenceManager, originalType)) {
|
||||
if (choice == null || !SlowOperations.allowSlowOperations(() -> tryIntroduceInplace(project, editor, choice, occurrenceManager, originalType))) {
|
||||
CommandProcessor.getInstance().executeCommand(project, () -> introduce(choice), getRefactoringName(), null);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -1,10 +1,11 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.structureView.impl.java;
|
||||
|
||||
import com.intellij.ide.structureView.StructureViewTreeElement;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.impl.light.LightElement;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
@@ -58,6 +59,10 @@ public class JavaClassTreeElement extends JavaClassTreeElementBase<PsiClass> {
|
||||
}
|
||||
|
||||
static LinkedHashSet<PsiElement> getOwnChildren(@NotNull PsiClass aClass) {
|
||||
return SlowOperations.allowSlowOperations(() -> doGetOwnChildren(aClass));
|
||||
}
|
||||
|
||||
private static @NotNull LinkedHashSet<PsiElement> doGetOwnChildren(@NotNull PsiClass aClass) {
|
||||
LinkedHashSet<PsiElement> members = new LinkedHashSet<>();
|
||||
addPhysicalElements(aClass.getFields(), members, aClass);
|
||||
addPhysicalElements(aClass.getMethods(), members, aClass);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.filters;
|
||||
|
||||
import com.intellij.execution.filters.ExceptionAnalysisProvider.StackLine;
|
||||
@@ -28,6 +28,7 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.ui.HyperlinkAdapter;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -406,7 +407,8 @@ public class ExceptionWorker {
|
||||
PsiElement element = file.findElementAt(startOffset);
|
||||
List<PsiElement> candidates = new ArrayList<>();
|
||||
while (element != null && element.getTextRange().getStartOffset() < endOffset) {
|
||||
PsiElement matched = myElementMatcher.matchElement(element);
|
||||
PsiElement finalElement = element;
|
||||
PsiElement matched = SlowOperations.allowSlowOperations(() -> myElementMatcher.matchElement(finalElement));
|
||||
if (matched != null) {
|
||||
candidates.add(matched);
|
||||
if (candidates.size() > 1) return;
|
||||
@@ -417,7 +419,7 @@ public class ExceptionWorker {
|
||||
PsiElement foundElement = candidates.get(0);
|
||||
TextRange range = foundElement.getTextRange();
|
||||
targetEditor.getCaretModel().moveToOffset(range.getStartOffset());
|
||||
displayAnalysisAction(file.getProject(), foundElement, targetEditor, originalEditor);
|
||||
SlowOperations.allowSlowOperations(() -> displayAnalysisAction(file.getProject(), foundElement, targetEditor, originalEditor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-16
@@ -1,22 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -40,7 +27,7 @@ public abstract class ProblemHighlightFilter {
|
||||
}
|
||||
|
||||
public static boolean shouldHighlightFile(@Nullable final PsiFile psiFile) {
|
||||
return shouldProcess(psiFile, true);
|
||||
return SlowOperations.allowSlowOperations(() -> shouldProcess(psiFile, true));
|
||||
}
|
||||
|
||||
public static boolean shouldProcessFileInBatch(@Nullable final PsiFile psiFile) {
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
@@ -6,6 +6,7 @@ import com.intellij.formatting.FormatTextRanges;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.FileASTNode;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.model.ModelBranch;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationListener;
|
||||
@@ -32,7 +33,6 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.ExternalFormatProcessor;
|
||||
import com.intellij.model.ModelBranch;
|
||||
import com.intellij.psi.impl.PsiDocumentManagerBase;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.impl.file.impl.FileManager;
|
||||
@@ -42,6 +42,7 @@ import com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl;
|
||||
import com.intellij.psi.impl.source.codeStyle.IndentHelperImpl;
|
||||
import com.intellij.psi.impl.source.tree.*;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.JBIterable;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
@@ -790,7 +791,7 @@ public final class PostprocessReformattingAspect implements PomModelAspect {
|
||||
}
|
||||
else {
|
||||
final CodeFormatterFacade codeFormatter = getFormatterFacade(viewProvider);
|
||||
codeFormatter.processText(file, textRanges, false);
|
||||
SlowOperations.allowSlowOperations(() -> codeFormatter.processText(file, textRanges, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.ThrowableComputable;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -15,23 +16,43 @@ public final class SlowOperations {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(SlowOperations.class);
|
||||
private static final Set<String> ourReportedTraces = new HashSet<>();
|
||||
private static final String[] misbehavingFrames = {
|
||||
"org.jetbrains.kotlin.idea.refactoring.introduce.introduceVariable.KotlinIntroduceVariableHandler",
|
||||
"org.jetbrains.kotlin.idea.actions.KotlinAddImportAction",
|
||||
"org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor",
|
||||
"com.intellij.apiwatcher.plugin.presentation.bytecode.UsageHighlighter",
|
||||
};
|
||||
private static boolean ourAllowedFlag = false;
|
||||
|
||||
private SlowOperations() {}
|
||||
|
||||
/**
|
||||
* If you get an exception from this method, then you need to move the computation to the background
|
||||
* while also trying to avoid blocking the UI thread as well. It's okay if the API changes in the process,
|
||||
* e.g. instead of wrapping implementation of some extension into {@link #allowSlowOperations},
|
||||
* it's better to admit that the EP semantic as a whole requires index access,
|
||||
* and then move the iteration over all extensions to the background on the platform-side.
|
||||
* <p/>
|
||||
* In cases when it's impossible to do so, the computation should be wrapped into {@code allowSlowOperations} explicitly.
|
||||
* This way it's possible to find all such operations by searching usages of {@code allowSlowOperations}.
|
||||
*
|
||||
* @see com.intellij.openapi.application.NonBlockingReadAction
|
||||
* @see com.intellij.openapi.application.CoroutinesKt#readAction
|
||||
* @see com.intellij.openapi.actionSystem.ex.ActionUtil#underModalProgress
|
||||
*/
|
||||
public static void assertSlowOperationsAreAllowed() {
|
||||
if (Registry.is("ide.enable.slow.operations.in.edt")) {
|
||||
return;
|
||||
}
|
||||
Application application = ApplicationManager.getApplication();
|
||||
if (
|
||||
!application.isUnitTestMode() &&
|
||||
application.isDispatchThread() &&
|
||||
!ourAllowedFlag &&
|
||||
ourReportedTraces.add(ExceptionUtil.currentStackTrace())
|
||||
) {
|
||||
LOG.error("Slow operations are prohibited in the EDT");
|
||||
if (application.isUnitTestMode() || !application.isDispatchThread() || ourAllowedFlag) {
|
||||
return;
|
||||
}
|
||||
String stackTrace = ExceptionUtil.currentStackTrace();
|
||||
if (ContainerUtil.or(misbehavingFrames, stackTrace::contains) || !ourReportedTraces.add(stackTrace)) {
|
||||
return;
|
||||
}
|
||||
LOG.error("Slow operations are prohibited in the EDT");
|
||||
}
|
||||
|
||||
public static <T, E extends Throwable> T allowSlowOperations(@NotNull ThrowableComputable<T, E> computable) throws E {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.util.treeView;
|
||||
|
||||
import com.intellij.ide.projectView.PresentationData;
|
||||
@@ -13,6 +13,7 @@ import com.intellij.openapi.vcs.FileStatus;
|
||||
import com.intellij.openapi.vcs.FileStatusManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.tree.LeafState;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -145,7 +146,7 @@ public abstract class AbstractTreeNode<T> extends PresentableNodeDescriptor<Abst
|
||||
|
||||
public final T getValue() {
|
||||
Object value = getEqualityObject();
|
||||
return value == null ? null : (T)TreeAnchorizer.getService().retrieveElement(value);
|
||||
return value == null ? null : (T)SlowOperations.allowSlowOperations(() -> TreeAnchorizer.getService().retrieveElement(value));
|
||||
}
|
||||
|
||||
public final void setValue(T value) {
|
||||
|
||||
+5
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.impl.statistics;
|
||||
|
||||
import com.intellij.execution.RunManager;
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
@@ -87,7 +88,9 @@ public final class RunConfigurationTypeUsagesCollector extends ProjectUsagesColl
|
||||
addOrIncrement(templates, template);
|
||||
collectRunConfigurationFeatures(runConfiguration, templates);
|
||||
if (runConfiguration instanceof FusAwareRunConfiguration) {
|
||||
List<EventPair<?>> additionalData = ((FusAwareRunConfiguration)runConfiguration).getAdditionalUsageData();
|
||||
List<EventPair<?>> additionalData = SlowOperations.allowSlowOperations(
|
||||
() -> ((FusAwareRunConfiguration)runConfiguration).getAdditionalUsageData()
|
||||
);
|
||||
pairs.add(ADDITIONAL_FIELD.with(new ObjectEventData(additionalData)));
|
||||
}
|
||||
if (runConfiguration instanceof TargetEnvironmentAwareRunProfile) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.actions;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.ChangedRangesInfo;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -105,7 +106,7 @@ public class ReformatCodeProcessor extends AbstractLayoutCodeProcessor {
|
||||
: document.getImmutableCharSequence();
|
||||
|
||||
try {
|
||||
EditorScrollingPositionKeeper.perform(document, true, () -> {
|
||||
EditorScrollingPositionKeeper.perform(document, true, () -> SlowOperations.allowSlowOperations(() -> {
|
||||
if (processChangedTextOnly) {
|
||||
ChangedRangesInfo info = VcsFacade.getInstance().getChangedRangesInfo(fileToProcess);
|
||||
if (info != null) {
|
||||
@@ -117,7 +118,7 @@ public class ReformatCodeProcessor extends AbstractLayoutCodeProcessor {
|
||||
Collection<TextRange> ranges = getRangesToFormat(fileToProcess);
|
||||
CodeStyleManager.getInstance(myProject).reformatText(fileToProcess, ranges);
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
catch (ProcessCanceledException pce) {
|
||||
if (before != null) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -85,6 +86,10 @@ public class ShowAutoImportPass extends TextEditorHighlightingPass {
|
||||
if (DumbService.isDumb(myProject) || !myFile.isValid()) return;
|
||||
if (myEditor.isDisposed() || myEditor instanceof EditorWindow && !((EditorWindow)myEditor).isValid()) return;
|
||||
|
||||
SlowOperations.allowSlowOperations(() -> doShowImports());
|
||||
}
|
||||
|
||||
private void doShowImports() {
|
||||
int caretOffset = myEditor.getCaretModel().getOffset();
|
||||
importUnambiguousImports(caretOffset);
|
||||
if (isImportHintEnabled()) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.editorActions;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -97,7 +98,7 @@ public class CopyHandler extends EditorActionHandler implements CopyAction.Trans
|
||||
|
||||
final List<TextBlockTransferableData> transferableDataList = new ArrayList<>();
|
||||
|
||||
DumbService.getInstance(project).withAlternativeResolveEnabled(() -> {
|
||||
DumbService.getInstance(project).withAlternativeResolveEnabled(() -> SlowOperations.allowSlowOperations(() -> {
|
||||
for (CopyPastePostProcessor<? extends TextBlockTransferableData> processor : CopyPastePostProcessor.EP_NAME.getExtensionList()) {
|
||||
try {
|
||||
transferableDataList.addAll(processor.collectTransferableData(file, editor, startOffsets, endOffsets));
|
||||
@@ -109,7 +110,7 @@ public class CopyHandler extends EditorActionHandler implements CopyAction.Trans
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
String text = editor.getCaretModel().supportsMultipleCarets()
|
||||
? EditorCopyPasteHelperImpl.getSelectedTextForClipboard(editor, transferableDataList)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -32,6 +32,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.util.DocumentUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Producer;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -208,7 +209,9 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser
|
||||
final Ref<Boolean> indented = new Ref<>(Boolean.FALSE);
|
||||
for (Map.Entry<CopyPastePostProcessor, List<? extends TextBlockTransferableData>> e : extraData.entrySet()) {
|
||||
//noinspection unchecked
|
||||
e.getKey().processTransferableData(project, editor, bounds, caretOffset, indented, e.getValue());
|
||||
SlowOperations.allowSlowOperations(
|
||||
() -> e.getKey().processTransferableData(project, editor, bounds, caretOffset, indented, e.getValue())
|
||||
);
|
||||
}
|
||||
|
||||
boolean pastedTextContainsWhiteSpacesOnly =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import com.intellij.codeInsight.AutoPopupController;
|
||||
@@ -47,6 +47,7 @@ import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -142,6 +143,10 @@ public final class TypedHandler extends TypedActionHandlerBase {
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull final Editor originalEditor, final char charTyped, @NotNull final DataContext dataContext) {
|
||||
SlowOperations.allowSlowOperations(()-> doExecute(originalEditor, charTyped, dataContext));
|
||||
}
|
||||
|
||||
private void doExecute(@NotNull Editor originalEditor, char charTyped, @NotNull DataContext dataContext) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
final PsiFile originalFile;
|
||||
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.folding.impl;
|
||||
|
||||
import com.intellij.lang.folding.FoldingDescriptor;
|
||||
@@ -21,6 +21,7 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.SmartPointerManager;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -255,7 +256,7 @@ final class UpdateFoldRegionsOperation implements Runnable {
|
||||
private boolean shouldRemoveRegion(@NotNull FoldRegion region, @NotNull EditorFoldingInfo info,
|
||||
@NotNull Map<TextRange, Boolean> rangeToExpandStatusMap, @NotNull Ref<? super FoldingUpdate.RegionInfo> matchingInfo) {
|
||||
matchingInfo.set(null);
|
||||
PsiElement element = info.getPsiElement(region);
|
||||
PsiElement element = SlowOperations.allowSlowOperations(() -> info.getPsiElement(region));
|
||||
if (element != null) {
|
||||
PsiFile containingFile = element.getContainingFile();
|
||||
boolean isInjected = InjectedLanguageManager.getInstance(myProject).isInjectedFragment(containingFile);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.hint;
|
||||
|
||||
@@ -24,8 +24,8 @@ import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.indexing.DumbModeAccessType;
|
||||
import com.intellij.util.indexing.FileBasedIndex;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.accessibility.AccessibleContextUtil;
|
||||
@@ -319,6 +319,10 @@ public class ParameterInfoComponent extends JPanel {
|
||||
}
|
||||
|
||||
ParameterInfoControllerBase.Model update(boolean singleParameterInfo) {
|
||||
return SlowOperations.allowSlowOperations(() -> doUpdate(singleParameterInfo));
|
||||
}
|
||||
|
||||
private ParameterInfoControllerBase.Model doUpdate(boolean singleParameterInfo) {
|
||||
MyParameterContext context = new MyParameterContext(singleParameterInfo);
|
||||
|
||||
int highlightedComponentIdx = -1;
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.intention.impl;
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -205,7 +206,7 @@ public class IntentionActionWithTextCaching implements Comparable<IntentionActio
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
|
||||
myAction.invoke(project, editor, file);
|
||||
SlowOperations.allowSlowOperations(() -> myAction.invoke(project, editor, file));
|
||||
myMarkInvoked.accept(IntentionActionWithTextCaching.this, myAction);
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.intention.impl;
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.intellij.psi.stubs.StubTextInconsistencyException;
|
||||
import com.intellij.util.PairProcessor;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.ThreeState;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -264,7 +265,9 @@ public class ShowIntentionActionsHandler implements CodeInsightActionHandler {
|
||||
}
|
||||
|
||||
PsiFile injectedFile = InjectedLanguageUtil.findInjectedPsiNoCommit(hostFile, hostEditor.getCaretModel().getOffset());
|
||||
return chooseBetweenHostAndInjected(hostFile, hostEditor, injectedFile,
|
||||
(psiFile, editor) -> availableFor(psiFile, editor, action));
|
||||
return chooseBetweenHostAndInjected(
|
||||
hostFile, hostEditor, injectedFile,
|
||||
(psiFile, editor) -> SlowOperations.allowSlowOperations(() -> availableFor(psiFile, editor, action))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-4
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.lookup.impl.actions;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.LatencyAwareEditorAction;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -68,7 +69,7 @@ public abstract class ChooseItemAction extends EditorAction implements HintManag
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_CONTROL_DOT);
|
||||
}
|
||||
|
||||
lookup.finishLookup(finishingChar);
|
||||
SlowOperations.allowSlowOperations(() -> lookup.finishLookup(finishingChar));
|
||||
}
|
||||
|
||||
|
||||
@@ -116,8 +117,11 @@ public abstract class ChooseItemAction extends EditorAction implements HintManag
|
||||
return true;
|
||||
}
|
||||
|
||||
List<TemplateImpl> templates = TemplateManagerImpl.listApplicableTemplateWithInsertingDummyIdentifier(
|
||||
TemplateActionContext.expanding(file, editor));
|
||||
List<TemplateImpl> templates = SlowOperations.allowSlowOperations(
|
||||
() -> TemplateManagerImpl.listApplicableTemplateWithInsertingDummyIdentifier(
|
||||
TemplateActionContext.expanding(file, editor)
|
||||
)
|
||||
);
|
||||
TemplateImpl template = LiveTemplateCompletionContributor.findFullMatchedApplicableTemplate(editor, offset, templates);
|
||||
if (template != null && shortcutChar == TemplateSettings.getInstance().getShortcutChar(template)) {
|
||||
return true;
|
||||
|
||||
+7
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.preview;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -19,6 +19,7 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -161,7 +162,7 @@ final class ImageOrColorPreviewManager implements Disposable, EditorMouseMotionL
|
||||
if (elements == null && event.getMouseEvent().isShiftDown()) {
|
||||
alarm.addRequest(new PreviewRequest(editor, event.getOffset(), false), 100);
|
||||
}
|
||||
else if (elements != null && !getPsiElementsAt(editor, event.getOffset()).equals(elements)) {
|
||||
else if (elements != null && !SlowOperations.allowSlowOperations(() -> getPsiElementsAt(editor, event.getOffset()).equals(elements))) {
|
||||
myElements = null;
|
||||
for (ElementPreviewProvider provider : ElementPreviewProvider.EP_NAME.getExtensionList()) {
|
||||
try {
|
||||
@@ -189,6 +190,10 @@ final class ImageOrColorPreviewManager implements Disposable, EditorMouseMotionL
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
SlowOperations.allowSlowOperations(() -> doRun());
|
||||
}
|
||||
|
||||
private void doRun() {
|
||||
Collection<PsiElement> elements = getPsiElementsAt(editor, offset);
|
||||
if (elements.equals(myElements)) return;
|
||||
for (PsiElement element : elements) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.find.actions;
|
||||
|
||||
import com.intellij.codeInsight.TargetElementUtil;
|
||||
@@ -63,10 +63,7 @@ import com.intellij.usageView.UsageViewUtil;
|
||||
import com.intellij.usages.*;
|
||||
import com.intellij.usages.impl.*;
|
||||
import com.intellij.usages.rules.UsageFilteringRuleProvider;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.BitUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.concurrency.EdtScheduledExecutorService;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.ui.AsyncProcessIcon;
|
||||
@@ -197,10 +194,10 @@ public class ShowUsagesAction extends AnAction implements PopupAction, HintManag
|
||||
Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
|
||||
RelativePoint popupPosition = JBPopupFactory.getInstance().guessBestPopupLocation(dataContext);
|
||||
SearchScope searchScope = FindUsagesOptions.findScopeByName(project, dataContext, FindSettings.getInstance().getDefaultScopeName());
|
||||
findShowUsages(
|
||||
SlowOperations.allowSlowOperations(() -> findShowUsages(
|
||||
project, dataContext, targetVariants, FindBundle.message("show.usages.ambiguous.title"),
|
||||
createVariantHandler(project, editor, popupPosition, searchScope)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.find.impl;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
@@ -1909,7 +1909,7 @@ public class FindPopupPanel extends JBPanel<FindPopupPanel> implements FindUI {
|
||||
TextChunk[] text = usageAdapter.getPresentation().getText();
|
||||
// line number / file info
|
||||
VirtualFile file = usageAdapter.getFile();
|
||||
String uniqueVirtualFilePath = getFilePath(usageAdapter);
|
||||
String uniqueVirtualFilePath = SlowOperations.allowSlowOperations(() -> getFilePath(usageAdapter));
|
||||
VirtualFile prevFile = findPrevFile(table, row, column);
|
||||
SimpleTextAttributes attributes = Comparing.equal(file, prevFile) ? REPEATED_FILE_ATTRIBUTES : ORDINAL_ATTRIBUTES;
|
||||
append(uniqueVirtualFilePath, attributes);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.psi.SmartPointerManager;
|
||||
import com.intellij.psi.SmartPsiElementPointer;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -297,7 +298,7 @@ public class CreateFileFromTemplateDialog extends DialogWrapper {
|
||||
|
||||
if (isValid && isExtraValid) {
|
||||
popup.closeOk(e);
|
||||
T createdElement = (T) createElement(newElementName, elementCreator);
|
||||
T createdElement = (T)SlowOperations.allowSlowOperations(() -> createElement(newElementName, elementCreator));
|
||||
if (createdElement != null) {
|
||||
elementConsumer.consume(createdElement);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiNameIdentifierOwner;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -89,7 +90,9 @@ public abstract class CreateFromTemplateAction<T extends PsiElement> extends AnA
|
||||
if (offset != -1 && editor != null && !editor.isDisposed()) {
|
||||
editor.getCaretModel().moveToOffset(offset);
|
||||
}
|
||||
postProcess(createdElement, selectedTemplateName.get(), builder.getCustomProperties());
|
||||
SlowOperations.allowSlowOperations(
|
||||
() -> postProcess(createdElement, selectedTemplateName.get(), builder.getCustomProperties())
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.impl;
|
||||
|
||||
import com.intellij.ide.SelectInContext;
|
||||
@@ -22,6 +8,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -86,7 +73,7 @@ public abstract class SelectInTargetPsiWrapper implements SelectInTarget {
|
||||
if (original != null && !original.isValid()) {
|
||||
throw new PsiInvalidElementAccessException(original, "Returned by " + selector + " of " + selector.getClass());
|
||||
}
|
||||
select(original, requestFocus);
|
||||
SlowOperations.allowSlowOperations(() -> select(original, requestFocus));
|
||||
}
|
||||
else {
|
||||
select(selector, file, requestFocus);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.ide.navigationToolbar;
|
||||
|
||||
@@ -18,10 +18,7 @@ import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.CommonProcessors;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.PairProcessor;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -90,6 +87,10 @@ public class NavBarModel {
|
||||
|
||||
if (PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext) instanceof NavBarPanel) return;
|
||||
|
||||
SlowOperations.allowSlowOperations(() -> doUpdateModel(dataContext));
|
||||
}
|
||||
|
||||
private void doUpdateModel(DataContext dataContext) {
|
||||
NavBarModelExtension ownerExtension = null;
|
||||
PsiElement psiElement = null;
|
||||
for (NavBarModelExtension extension : NavBarModelExtension.EP_NAME.getExtensionList()) {
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.projectView.impl;
|
||||
|
||||
import com.intellij.ide.projectView.ProjectViewNode;
|
||||
@@ -7,6 +7,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.ui.tree.AbstractTreeNodeVisitor;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -54,6 +55,6 @@ class ProjectViewNodeVisitor extends AbstractTreeNodeVisitor<PsiElement> {
|
||||
|
||||
@Override
|
||||
protected boolean isAncestor(@NotNull PsiElement content, @NotNull PsiElement element) {
|
||||
return PsiTreeUtil.isAncestor(content, element, true);
|
||||
return SlowOperations.allowSlowOperations(() -> PsiTreeUtil.isAncestor(content, element, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.util;
|
||||
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
@@ -31,6 +31,7 @@ import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.ui.speedSearch.SpeedSearchUtil;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.text.Matcher;
|
||||
import com.intellij.util.text.MatcherHolder;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -214,7 +215,9 @@ public abstract class PsiElementListCellRenderer<T extends PsiElement> extends J
|
||||
Component rightCellRendererComponent = null;
|
||||
JPanel spacer = null;
|
||||
if (rightRenderer != null) {
|
||||
rightCellRendererComponent = rightRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
rightCellRendererComponent = SlowOperations.allowSlowOperations(
|
||||
() -> rightRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus)
|
||||
);
|
||||
add(rightCellRendererComponent, BorderLayout.EAST);
|
||||
spacer = new JPanel();
|
||||
spacer.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
|
||||
@@ -224,7 +227,9 @@ public abstract class PsiElementListCellRenderer<T extends PsiElement> extends J
|
||||
}
|
||||
|
||||
ListCellRenderer<Object> leftRenderer = new LeftRenderer(null, value == null ? new ItemMatchers(null, null) : getItemMatchers(list, value));
|
||||
final Component leftCellRendererComponent = leftRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
final Component leftCellRendererComponent = SlowOperations.allowSlowOperations(
|
||||
() -> leftRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus)
|
||||
);
|
||||
add(leftCellRendererComponent, LEFT);
|
||||
final Color bg = isSelected ? UIUtil.getListSelectionBackground(true) : leftCellRendererComponent.getBackground();
|
||||
setBackground(bg);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.ide.util.gotoByName;
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.intellij.ui.speedSearch.SpeedSearchUtil;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
@@ -386,8 +387,8 @@ public final class GotoActionModel implements ChooseByNameModel, Comparator<Obje
|
||||
@NotNull List<ActionGroup> path,
|
||||
boolean showNonPopupGroups) {
|
||||
DataContext context = myProject == null ? DataContext.EMPTY_CONTEXT : SimpleDataContext.getProjectContext(myProject);
|
||||
AnAction[] actions = group
|
||||
.getChildren(AnActionEvent.createFromDataContext(ActionPlaces.ACTION_SEARCH, null, context));
|
||||
AnActionEvent event = AnActionEvent.createFromDataContext(ActionPlaces.ACTION_SEARCH, null, context);
|
||||
AnAction[] actions = SlowOperations.allowSlowOperations(() -> group.getChildren(event));
|
||||
|
||||
boolean hasMeaningfulChildren = ContainerUtil.exists(actions, action -> myActionManager.getId(action) != null);
|
||||
if (!hasMeaningfulChildren) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.util.scopeChooser;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
@@ -22,6 +22,7 @@ import com.intellij.ui.TitledSeparator;
|
||||
import com.intellij.ui.scale.JBUIScale;
|
||||
import com.intellij.util.BitUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.JBEmptyBorder;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -179,7 +180,7 @@ public class ScopeChooserCombo extends ComboboxWithBrowseButton implements Dispo
|
||||
};
|
||||
for (SearchScopeProvider each : SearchScopeProvider.EP_NAME.getExtensions()) {
|
||||
if (StringUtil.isEmpty(each.getDisplayName())) continue;
|
||||
List<SearchScope> scopes = each.getSearchScopes(project, dataContext);
|
||||
List<SearchScope> scopes = SlowOperations.allowSlowOperations(() -> each.getSearchScopes(project, dataContext));
|
||||
if (scopes.isEmpty()) continue;
|
||||
if (!processor.process(new ScopeSeparator(each.getDisplayName()))) return false;
|
||||
for (SearchScope scope : ContainerUtil.sorted(scopes, comparator)) {
|
||||
|
||||
+1
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.fileEditor.impl;
|
||||
|
||||
import com.intellij.ide.lightEdit.LightEdit;
|
||||
@@ -9,7 +9,6 @@ import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.ModificationTracker;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.ThrowableComputable;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.UniqueNameBuilder;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.refactoring;
|
||||
|
||||
import com.intellij.codeInsight.actions.VcsFacade;
|
||||
@@ -61,6 +61,7 @@ import com.intellij.usages.impl.UnknownUsagesInUnloadedModules;
|
||||
import com.intellij.usages.impl.UsageViewImpl;
|
||||
import com.intellij.usages.rules.PsiElementUsage;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
|
||||
@@ -627,10 +628,10 @@ public abstract class BaseRefactoringProcessor implements Runnable {
|
||||
|
||||
@Override
|
||||
public final void run() {
|
||||
Runnable runnable = this::doRun;
|
||||
if (shouldDisableAccessChecks()) {
|
||||
runnable = () -> NonProjectFileWritingAccessProvider.disableChecksDuring(this::doRun);
|
||||
}
|
||||
Runnable baseRunnable = () -> SlowOperations.allowSlowOperations(this::doRun);
|
||||
Runnable runnable = shouldDisableAccessChecks() ?
|
||||
() -> NonProjectFileWritingAccessProvider.disableChecksDuring(baseRunnable) :
|
||||
baseRunnable;
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
ApplicationManager.getApplication().assertIsWriteThread();
|
||||
runnable.run();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.refactoring.actions;
|
||||
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
@@ -27,6 +27,7 @@ import com.intellij.refactoring.RefactoringActionHandler;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.refactoring.rename.inplace.InplaceRefactoring;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -105,7 +106,7 @@ public abstract class BaseRefactoringAction extends AnAction implements UpdateIn
|
||||
}
|
||||
IdeEventQueue.getInstance().setEventCount(eventCount);
|
||||
|
||||
performRefactoringAction(project, dataContext, handler);
|
||||
SlowOperations.allowSlowOperations(() -> performRefactoringAction(project, dataContext, handler));
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.intellij.refactoring.rename.PsiElementRenameHandler;
|
||||
import com.intellij.refactoring.rename.Renamer;
|
||||
import com.intellij.refactoring.rename.RenamerFactory;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class RenameElementAction extends AnAction implements UpdateInBackground
|
||||
@ApiStatus.Internal
|
||||
public boolean isAvailable(@NotNull DataContext dataContext) {
|
||||
return dataContext.getData(CommonDataKeys.PROJECT) != null
|
||||
&& getAvailableRenamers(dataContext).findAny().isPresent();
|
||||
&& SlowOperations.allowSlowOperations(() -> getAvailableRenamers(dataContext).findAny().isPresent());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,7 +52,7 @@ public class RenameElementAction extends AnAction implements UpdateInBackground
|
||||
return;
|
||||
}
|
||||
|
||||
List<Renamer> renamers = getAvailableRenamers(dataContext).collect(Collectors.toList());
|
||||
List<Renamer> renamers = SlowOperations.allowSlowOperations(() -> getAvailableRenamers(dataContext).collect(Collectors.toList()));
|
||||
if (renamers.isEmpty()) {
|
||||
String message = RefactoringBundle.getCannotRefactorMessage(
|
||||
RefactoringBundle.message("error.wrong.caret.position.symbol.to.refactor")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.refactoring.move;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.refactoring.actions.BaseRefactoringAction;
|
||||
import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesUtil;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -132,13 +133,15 @@ public class MoveHandler implements RefactoringActionHandler {
|
||||
public static void doMove(Project project, PsiElement @NotNull [] elements, PsiElement targetContainer, DataContext dataContext, MoveCallback callback) {
|
||||
if (elements.length == 0) return;
|
||||
|
||||
for (MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
|
||||
if (delegate.canMove(elements, targetContainer, null)) {
|
||||
logDelegate(project, delegate, elements[0].getLanguage());
|
||||
delegate.doMove(project, elements, delegate.adjustTargetForMove(dataContext, targetContainer), callback);
|
||||
break;
|
||||
SlowOperations.allowSlowOperations(() -> {
|
||||
for (MoveHandlerDelegate delegate : MoveHandlerDelegate.EP_NAME.getExtensionList()) {
|
||||
if (delegate.canMove(elements, targetContainer, null)) {
|
||||
logDelegate(project, delegate, elements[0].getLanguage());
|
||||
delegate.doMove(project, elements, delegate.adjustTargetForMove(dataContext, targetContainer), callback);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.refactoring.rename;
|
||||
|
||||
import com.intellij.ide.IdeEventQueue;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.refactoring.actions.BaseRefactoringAction;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -32,7 +33,9 @@ final class RenameHandler2Renamer implements Renamer {
|
||||
|
||||
@Override
|
||||
public void performRename() {
|
||||
IdeEventQueue.getInstance().setEventCount(myEventCount); // Make DataContext valid again.
|
||||
BaseRefactoringAction.performRefactoringAction(myProject, myDataContext, myHandler);
|
||||
SlowOperations.allowSlowOperations(() -> {
|
||||
IdeEventQueue.getInstance().setEventCount(myEventCount); // Make DataContext valid again.
|
||||
BaseRefactoringAction.performRefactoringAction(myProject, myDataContext, myHandler);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.refactoring.rename.inplace;
|
||||
|
||||
import com.intellij.codeInsight.TargetElementUtil;
|
||||
@@ -38,6 +38,7 @@ import com.intellij.refactoring.rename.RenameUtil;
|
||||
import com.intellij.refactoring.rename.naming.AutomaticRenamerFactory;
|
||||
import com.intellij.refactoring.util.TextOccurrencesUtil;
|
||||
import com.intellij.usageView.UsageViewUtil;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -223,7 +224,7 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable performRunnable = () -> {
|
||||
Runnable performRunnable = () -> SlowOperations.allowSlowOperations(() -> {
|
||||
if (DumbService.isDumb(myProject)) {
|
||||
DumbService.getInstance(myProject).showDumbModeNotification(RefactoringBundle.message("refactoring.not.available.indexing"));
|
||||
return;
|
||||
@@ -236,7 +237,7 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
|
||||
performRenameInner(substituted, newName);
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
}, commandName, null);
|
||||
};
|
||||
});
|
||||
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
performRunnable.run();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.actionSystem.ex;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.ComponentUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -166,10 +167,10 @@ public final class ActionUtil {
|
||||
|
||||
try {
|
||||
if (beforeActionPerformed) {
|
||||
action.beforeActionPerformedUpdate(e);
|
||||
SlowOperations.allowSlowOperations(() -> action.beforeActionPerformedUpdate(e));
|
||||
}
|
||||
else {
|
||||
action.update(e);
|
||||
SlowOperations.allowSlowOperations(() -> action.update(e));
|
||||
}
|
||||
presentation.putClientProperty(WOULD_BE_ENABLED_IF_NOT_DUMB_MODE, !allowed && presentation.isEnabled());
|
||||
presentation.putClientProperty(WOULD_BE_VISIBLE_IF_NOT_DUMB_MODE, !allowed && presentation.isVisible());
|
||||
@@ -265,7 +266,7 @@ public final class ActionUtil {
|
||||
|
||||
public static void performActionDumbAware(AnAction action, AnActionEvent e) {
|
||||
try {
|
||||
action.actionPerformed(e);
|
||||
SlowOperations.allowSlowOperations(() -> action.actionPerformed(e));
|
||||
}
|
||||
catch (IndexNotReadyException ex) {
|
||||
LOG.info(ex);
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ui.treeStructure;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.util.treeView.*;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.openapi.ui.Queryable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.tree.TreePathBackgroundSupplier;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.ThreeState;
|
||||
import com.intellij.util.ui.*;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
@@ -330,7 +327,7 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith
|
||||
|
||||
for (int row = firstVisibleRow; row <= lastVisibleRow; row++) {
|
||||
TreePath path = getPathForRow(row);
|
||||
Color color = path == null ? null : getFileColorForPath(path);
|
||||
Color color = path == null ? null : SlowOperations.allowSlowOperations(() -> getFileColorForPath(path));
|
||||
if (color != null) {
|
||||
Rectangle bounds = getRowBounds(row);
|
||||
g.setColor(color);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
@@ -1476,7 +1476,9 @@ public final class Switcher extends AnAction implements DumbAware {
|
||||
@NlsSafe String getNameForRendering() {
|
||||
if (myNameForRendering == null) {
|
||||
// Recently changed files would also be taken into account (not only open 'visible' files)
|
||||
myNameForRendering = EditorTabPresentationUtil.getUniqueEditorTabTitle(myProject, first, second);
|
||||
myNameForRendering = SlowOperations.allowSlowOperations(
|
||||
() -> EditorTabPresentationUtil.getUniqueEditorTabTitle(myProject, first, second)
|
||||
);
|
||||
}
|
||||
return myNameForRendering;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.startup.impl;
|
||||
|
||||
import com.intellij.diagnostic.*;
|
||||
@@ -34,6 +34,7 @@ import com.intellij.openapi.startup.StartupActivity;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
@@ -238,7 +239,9 @@ public class StartupManagerImpl extends StartupManagerEx {
|
||||
|
||||
counter.incrementAndGet();
|
||||
dumbService.unsafeRunWhenSmart(() -> {
|
||||
runActivity(uiFreezeWarned, extension, pluginDescriptor, ProgressIndicatorProvider.getGlobalProgressIndicator());
|
||||
SlowOperations.allowSlowOperations(
|
||||
() -> runActivity(uiFreezeWarned, extension, pluginDescriptor, ProgressIndicatorProvider.getGlobalProgressIndicator())
|
||||
);
|
||||
dumbUnawarePostActivitiesPassed(edtActivity, counter.decrementAndGet());
|
||||
});
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.actionSystem.impl;
|
||||
|
||||
import com.intellij.openapi.actionSystem.TimerListener;
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.fileEditor.impl;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
@@ -41,6 +41,7 @@ import com.intellij.ui.tabs.*;
|
||||
import com.intellij.ui.tabs.impl.*;
|
||||
import com.intellij.ui.tabs.impl.tabsLayout.TabsLayoutInfo;
|
||||
import com.intellij.ui.tabs.impl.tabsLayout.TabsLayoutSettingsManager;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.TimedDeadzone;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -267,7 +268,7 @@ public final class EditorTabbedContainer implements CloseAction.CloseTarget {
|
||||
}
|
||||
|
||||
tab = new TabInfo(component)
|
||||
.setText(EditorTabPresentationUtil.getEditorTabTitle(myProject, file, myWindow))
|
||||
.setText(SlowOperations.allowSlowOperations(() -> EditorTabPresentationUtil.getEditorTabTitle(myProject, file, myWindow)))
|
||||
.setTabColor(EditorTabPresentationUtil.getEditorTabBackgroundColor(myProject, file, myWindow))
|
||||
.setIcon(UISettings.getInstance().getShowFileIconInTabs() ? icon : null)
|
||||
.setTooltipText(tooltip)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.fileEditor.impl;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
@@ -33,6 +33,7 @@ import com.intellij.ui.tabs.impl.JBTabsImpl;
|
||||
import com.intellij.ui.tabs.impl.tabsLayout.TabsLayoutInfo;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.JBIterable;
|
||||
import com.intellij.util.containers.Stack;
|
||||
@@ -764,7 +765,9 @@ public final class EditorWindow {
|
||||
void updateFileName(@NotNull VirtualFile file) {
|
||||
int index = findEditorIndex(findFileComposite(file));
|
||||
if (index != -1) {
|
||||
setTitleAt(index, EditorTabPresentationUtil.getEditorTabTitle(getManager().getProject(), file, this));
|
||||
setTitleAt(index, SlowOperations.allowSlowOperations(
|
||||
() -> EditorTabPresentationUtil.getEditorTabTitle(getManager().getProject(), file, this)
|
||||
));
|
||||
setToolTipTextAt(index, UISettings.getInstance().getShowTabsTooltips()
|
||||
? getManager().getFileTooltipText(file)
|
||||
: null);
|
||||
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.fileEditor.impl;
|
||||
|
||||
import com.intellij.diagnostic.Activity;
|
||||
@@ -37,16 +37,16 @@ import com.intellij.openapi.wm.ex.IdeFrameEx;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
import com.intellij.openapi.wm.impl.*;
|
||||
import com.intellij.testFramework.LightVirtualFileBase;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.ComponentUtil;
|
||||
import com.intellij.ui.DirtyUI;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.OnePixelSplitter;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.ui.docking.DockManager;
|
||||
import com.intellij.ui.tabs.JBTabs;
|
||||
import com.intellij.ui.tabs.impl.JBTabsImpl;
|
||||
import com.intellij.ui.tabs.impl.tabsLayout.TabsLayoutInfo;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.concurrency.NonUrgentExecutor;
|
||||
import com.intellij.util.containers.ArrayListSet;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -483,7 +483,7 @@ public class EditorsSplitters extends IdePanePanel implements UISettingsListener
|
||||
}
|
||||
catch (InvalidPathException ignored) {
|
||||
}
|
||||
fileTitle = FrameTitleBuilder.getInstance().getFileTitle(project, file);
|
||||
fileTitle = SlowOperations.allowSlowOperations(() -> FrameTitleBuilder.getInstance().getFileTitle(project, file));
|
||||
}
|
||||
frame.setFileTitle(fileTitle, ioFile);
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.fileEditor.impl;
|
||||
|
||||
import com.intellij.diagnostic.PluginException;
|
||||
@@ -16,6 +16,7 @@ import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.MapAnnotation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -41,12 +42,12 @@ public final class FileEditorProviderManagerImpl extends FileEditorProviderManag
|
||||
List<FileEditorProvider> sharedProviders = new ArrayList<>();
|
||||
boolean hideDefaultEditor = false;
|
||||
for (final FileEditorProvider provider : FileEditorProvider.EP_FILE_EDITOR_PROVIDER.getExtensionList()) {
|
||||
if (ReadAction.compute(() -> {
|
||||
if (SlowOperations.allowSlowOperations(() -> ReadAction.compute(() -> {
|
||||
if (DumbService.isDumb(project) && !DumbService.isDumbAware(provider)) {
|
||||
return false;
|
||||
}
|
||||
return provider.accept(project, file);
|
||||
})) {
|
||||
}))) {
|
||||
sharedProviders.add(provider);
|
||||
hideDefaultEditor |= provider.getPolicy() == FileEditorPolicy.HIDE_DEFAULT_EDITOR;
|
||||
if (provider.getPolicy() == FileEditorPolicy.HIDE_DEFAULT_EDITOR && !DumbService.isDumbAware(provider)) {
|
||||
|
||||
+4
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.testframework.sm.runner.ui;
|
||||
|
||||
import com.intellij.execution.Location;
|
||||
@@ -6,6 +6,7 @@ import com.intellij.execution.testframework.sm.runner.SMTestLocator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.SlowOperations;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -59,7 +60,8 @@ public class TestStackTraceParser {
|
||||
myErrorMessage = line;
|
||||
}
|
||||
if (myTopLocationLine == null) {
|
||||
List<Location> location = locator.getLocation(line, project, scope);
|
||||
String finalLine = line;
|
||||
List<Location> location = SlowOperations.allowSlowOperations(() -> locator.getLocation(finalLine, project, scope));
|
||||
if (!location.isEmpty()) {
|
||||
myTopLocationLine = line;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.usages.impl;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
@@ -7,7 +7,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.FileStatus;
|
||||
import com.intellij.ui.ColoredTreeCellRenderer;
|
||||
import com.intellij.ui.DarculaColors;
|
||||
@@ -22,6 +21,7 @@ import com.intellij.usages.UsageGroup;
|
||||
import com.intellij.usages.UsageTarget;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import com.intellij.util.FontUtil;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.StartupUiUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -65,6 +65,10 @@ final class UsageViewTreeCellRenderer extends ColoredTreeCellRenderer {
|
||||
return;
|
||||
}
|
||||
|
||||
SlowOperations.allowSlowOperations(() -> doCustomizeCellRenderer(tree, value, expanded, row));
|
||||
}
|
||||
|
||||
private void doCustomizeCellRenderer(@NotNull JTree tree, Object value, boolean expanded, int row) {
|
||||
boolean showAsReadOnly = false;
|
||||
if (value instanceof Node && value != tree.getModel().getRoot()) {
|
||||
Node node = (Node)value;
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.xdebugger.impl.breakpoints;
|
||||
|
||||
import com.intellij.configurationStore.XmlSerializer;
|
||||
@@ -15,6 +15,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.ex.http.HttpFileSystem;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
@@ -118,7 +119,7 @@ public final class XBreakpointManagerImpl implements XBreakpointManager {
|
||||
private void updateBreakpointInFile(final VirtualFile file) {
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
for (XBreakpointBase breakpoint : getAllBreakpoints()) {
|
||||
XSourcePosition position = breakpoint.getSourcePosition();
|
||||
XSourcePosition position = SlowOperations.allowSlowOperations(() -> breakpoint.getSourcePosition());
|
||||
if (position != null && Comparing.equal(position.getFile(), file)) {
|
||||
fireBreakpointChanged(breakpoint);
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.devkit.dom.ide;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
@@ -7,6 +7,7 @@ import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.search.*;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.xml.DomService;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -32,8 +33,9 @@ public class PluginDescriptorDomFileSearchScopeProvider implements SearchScopePr
|
||||
public List<SearchScope> getSearchScopes(@NotNull Project project, @NotNull DataContext dataContext) {
|
||||
if (DumbService.isDumb(project) || !PsiUtil.isIdeaProject(project)) return Collections.emptyList();
|
||||
|
||||
final Collection<VirtualFile> pluginDescriptorFiles =
|
||||
DomService.getInstance().getDomFileCandidates(IdeaPlugin.class, GlobalSearchScopesCore.projectProductionScope(project));
|
||||
final Collection<VirtualFile> pluginDescriptorFiles = SlowOperations.allowSlowOperations(
|
||||
() -> DomService.getInstance().getDomFileCandidates(IdeaPlugin.class, GlobalSearchScopesCore.projectProductionScope(project))
|
||||
);
|
||||
GlobalSearchScope scope = GlobalSearchScope.filesScope(project, pluginDescriptorFiles);
|
||||
return Collections.singletonList(new DelegatingGlobalSearchScope(scope) {
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user