EA-37610 - INRE: FileBasedIndexImpl.handleDumbMode
This commit is contained in:
+2
-1
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.plugin.libraries;
|
||||
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.psi.ClsFileDecompiledPsiFileProvider;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiJavaFile;
|
||||
@@ -32,7 +33,7 @@ public class JetClsFileDecompiledPsiFileProvider implements ClsFileDecompiledPsi
|
||||
@Override
|
||||
public PsiFile getDecompiledPsiFile(@NotNull PsiJavaFile psiFile) {
|
||||
ClsFileImpl clsFile = (ClsFileImpl)psiFile;
|
||||
if (JetDecompiledData.isKotlinFile(clsFile)) {
|
||||
if (JetDecompiledData.isKotlinFile(clsFile) && !DumbService.isDumb(psiFile.getProject())) {
|
||||
return JetDecompiledData.getDecompiledData(clsFile).getJetFile();
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
package org.jetbrains.jet.plugin.libraries;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileTypes.ContentBasedClassFileProcessor;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -34,8 +36,22 @@ import org.jetbrains.jet.plugin.highlighter.JetHighlighter;
|
||||
public class JetContentBasedFileSubstitutor implements ContentBasedClassFileProcessor {
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@Nullable Project project, @NotNull VirtualFile file) {
|
||||
return project != null && JetDecompiledData.isKotlinFile(project, file);
|
||||
public boolean isApplicable(@Nullable Project project, @NotNull final VirtualFile file) {
|
||||
if (project == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (DumbService.isDumb(project)) {
|
||||
DumbService.getInstance(project).runWhenSmart(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FileDocumentManager.getInstance().reloadFiles(file);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
return JetDecompiledData.isKotlinFile(project, file);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user