From 47634527f321177953ab1077125e16ef6fa67478 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Wed, 1 Apr 2015 19:59:25 +0200 Subject: [PATCH 1/3] fix assertion for references on empty string (e.g. open unresolvedRootTag.fxml) --- .../plugins/javaFX/fxml/refs/FxmlReferencesContributor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/FxmlReferencesContributor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/FxmlReferencesContributor.java index 0a62b69b0d6c..91a5e8dfcad5 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/FxmlReferencesContributor.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/FxmlReferencesContributor.java @@ -21,7 +21,6 @@ import com.intellij.patterns.XmlAttributeValuePattern; import com.intellij.patterns.XmlPatterns; import com.intellij.psi.*; import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; -import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.XmlAttributeValue; import com.intellij.psi.xml.XmlProcessingInstruction; import com.intellij.psi.xml.XmlTag; @@ -128,6 +127,7 @@ public class FxmlReferencesContributor extends PsiReferenceContributor { public PsiReference[] getReferencesByString(String str, @NotNull final PsiElement position, int offsetInPosition) { + if (str.length() == 0) return PsiReference.EMPTY_ARRAY; final PsiReference[] references = super.getReferencesByString(str, position, offsetInPosition); final int offset = position instanceof XmlTag ? 1 : 0; if (references.length <= offset) return PsiReference.EMPTY_ARRAY; From 2a9fd41d91d908f91afdf7f88d496414e97b8a61 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Wed, 1 Apr 2015 20:01:37 +0200 Subject: [PATCH 2/3] extract ours acceptable indexingThreadCount --- .../intellij/openapi/project/CacheUpdateRunner.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java b/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java index 535e0719a333..f611db8016ac 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java @@ -174,10 +174,7 @@ public class CacheUpdateRunner extends DumbModeTask { final AtomicBoolean isFinished = new AtomicBoolean(); try { - int threadsCount = Registry.intValue("caches.indexerThreadsCount"); - if (threadsCount <= 0) { - threadsCount = Math.max(1, Math.min(PROC_COUNT - 1, 4)); - } + int threadsCount = indexingThreadCount(); if (threadsCount == 1 || application.isWriteAccessAllowed()) { Runnable process = new MyRunnable(innerIndicator, queue, isFinished, progressUpdater, processInReadAction, project, fileProcessor); ProgressManager.getInstance().runProcess(process, innerIndicator); @@ -201,6 +198,14 @@ public class CacheUpdateRunner extends DumbModeTask { return isFinished.get(); } + public static int indexingThreadCount() { + int threadsCount = Registry.intValue("caches.indexerThreadsCount"); + if (threadsCount <= 0) { + threadsCount = Math.max(1, Math.min(PROC_COUNT - 1, 4)); + } + return threadsCount; + } + private static boolean waitForAll(@NotNull AtomicBoolean[] finishedRefs, @NotNull Future[] futures) { assert !ApplicationManager.getApplication().isWriteAccessAllowed(); try { From 54d23c1c44f3b5a41a23670b008248e0c379b9c0 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Wed, 1 Apr 2015 20:02:26 +0200 Subject: [PATCH 3/3] use acceptable indexing threads count --- .../intellij/psi/refResolve/RefResolveServiceImpl.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/java/java-impl/src/com/intellij/psi/refResolve/RefResolveServiceImpl.java b/java/java-impl/src/com/intellij/psi/refResolve/RefResolveServiceImpl.java index eef1b79dd2d3..6fb77c31747e 100644 --- a/java/java-impl/src/com/intellij/psi/refResolve/RefResolveServiceImpl.java +++ b/java/java-impl/src/com/intellij/psi/refResolve/RefResolveServiceImpl.java @@ -15,7 +15,6 @@ */ package com.intellij.psi.refResolve; -import com.intellij.concurrency.JobSchedulerImpl; import com.intellij.ide.PowerSaveMode; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationAdapter; @@ -34,10 +33,7 @@ import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator; import com.intellij.openapi.progress.impl.ProgressManagerImpl; import com.intellij.openapi.progress.util.ProgressIndicatorBase; import com.intellij.openapi.progress.util.ProgressIndicatorUtils; -import com.intellij.openapi.project.DumbService; -import com.intellij.openapi.project.IndexNotReadyException; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ProjectCoreUtil; +import com.intellij.openapi.project.*; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.startup.StartupManager; import com.intellij.openapi.util.Computable; @@ -529,7 +525,7 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable // fine but grabs all CPUs //return JobLauncher.getInstance().invokeConcurrentlyUnderProgress(fileList, indicator, false, false, processor); - int parallelism = Math.min(4, JobSchedulerImpl.CORES_COUNT); + int parallelism = CacheUpdateRunner.indexingThreadCount(); final Callable processFileFromSet = new Callable() { @Override public Boolean call() throws Exception {