From c7c47b232c737f658187885ee4517acef9813f85 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 4 Oct 2012 19:20:33 +0400 Subject: [PATCH] gui file type explicit mention removed --- .../daemon/impl/DaemonCodeAnalyzerImpl.java | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java index 279547f26e7b..62294cb1d92d 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java @@ -155,7 +155,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx public void run() { reloadScopes(dependencyValidationManager, namedScopeManager); } - },project.getDisposed()); + }, project.getDisposed()); myInitialized = true; @@ -195,10 +195,8 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx final List result = new ArrayList(); final VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile != null && !virtualFile.getFileType().isBinary()) { + List passes = TextEditorHighlightingPassRegistrarEx.getInstanceEx(myProject).instantiateMainPasses(psiFile, document); - final List passes = TextEditorHighlightingPassRegistrarEx.getInstanceEx(myProject) - .instantiateMainPasses(psiFile, document); - Collections.sort(passes, new Comparator() { @Override public int compare(TextEditorHighlightingPass o1, TextEditorHighlightingPass o2) { @@ -246,7 +244,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx TextEditorBackgroundHighlighter highlighter = (TextEditorBackgroundHighlighter)textEditor.getBackgroundHighlighter(); final List passes = highlighter.getPasses(toIgnore); HighlightingPass[] array = passes.toArray(new HighlightingPass[passes.size()]); - assert array.length != 0: "Highlighting is disabled for the file "+file; + assert array.length != 0 : "Highlighting is disabled for the file " + file; final DaemonProgressIndicator progress = createUpdateProgress(); myPassExecutorService.submitPasses(Collections.singletonMap((FileEditor)textEditor, array), progress, Job.DEFAULT_PRIORITY); @@ -337,6 +335,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx } private final List> myScopes = ContainerUtil.createEmptyCOWList(); + void reloadScopes(@NotNull DependencyValidationManager dependencyValidationManager, @NotNull NamedScopeManager namedScopeManager) { ApplicationManager.getApplication().assertIsDispatchThread(); List> scopeList = new ArrayList>(); @@ -347,7 +346,8 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx dependencyValidationManager.reloadRules(); } - private static void addScopesToList(@NotNull final List> scopeList, @NotNull final NamedScopesHolder holder) { + private static void addScopesToList(@NotNull final List> scopeList, + @NotNull final NamedScopesHolder holder) { NamedScope[] scopes = holder.getScopes(); for (NamedScope scope : scopes) { scopeList.add(Pair.create(scope, holder)); @@ -420,9 +420,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx if (file instanceof PsiCompiledElement) return false; final FileType fileType = file.getFileType(); - if (fileType == StdFileTypes.GUI_DESIGNER_FORM){ - return true; - } + // To enable T.O.D.O. highlighting return !fileType.isBinary(); } @@ -577,21 +575,21 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx public HighlightInfo findHighlightByOffset(@NotNull Document document, final int offset, final boolean includeFixRange) { final List foundInfoList = new SmartList(); processHighlightsNearOffset(document, myProject, HighlightSeverity.INFORMATION, offset, includeFixRange, new Processor() { - @Override - public boolean process(@NotNull HighlightInfo info) { - if (!foundInfoList.isEmpty()) { - HighlightInfo foundInfo = foundInfoList.get(0); - int compare = foundInfo.getSeverity().compareTo(info.getSeverity()); - if (compare < 0) { - foundInfoList.clear(); - } - else if (compare > 0) { - return true; - } + @Override + public boolean process(@NotNull HighlightInfo info) { + if (!foundInfoList.isEmpty()) { + HighlightInfo foundInfo = foundInfoList.get(0); + int compare = foundInfo.getSeverity().compareTo(info.getSeverity()); + if (compare < 0) { + foundInfoList.clear(); + } + else if (compare > 0) { + return true; } - foundInfoList.add(info); - return true; } + foundInfoList.add(info); + return true; + } }); if (foundInfoList.isEmpty()) return null; @@ -632,10 +630,10 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx } void setLastIntentionHint(@NotNull Project project, - @NotNull PsiFile file, - @NotNull Editor editor, - @NotNull ShowIntentionsPass.IntentionsInfo intentions, - boolean hasToRecreate) { + @NotNull PsiFile file, + @NotNull Editor editor, + @NotNull ShowIntentionsPass.IntentionsInfo intentions, + boolean hasToRecreate) { ApplicationManager.getApplication().assertIsDispatchThread(); hideLastIntentionHint(); IntentionHintComponent hintComponent = IntentionHintComponent.showIntentionHint(project, file, editor, intentions, false); @@ -712,7 +710,10 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx Runnable runnable = new Runnable() { @Override public void run() { - PassExecutorService.log(getUpdateProgress(), null, "Update Runnable. myUpdateByTimerEnabled:",myUpdateByTimerEnabled," something disposed:",PowerSaveMode.isEnabled() || myDisposed || !myProject.isInitialized()," activeEditors:",myProject.isDisposed() ? null : getSelectedEditors()); + PassExecutorService.log(getUpdateProgress(), null, "Update Runnable. myUpdateByTimerEnabled:", + myUpdateByTimerEnabled, " something disposed:", + PowerSaveMode.isEnabled() || myDisposed || !myProject.isInitialized(), " activeEditors:", + myProject.isDisposed() ? null : getSelectedEditors()); if (!myUpdateByTimerEnabled) return; if (myDisposed) return; ApplicationManager.getApplication().assertIsDispatchThread(); @@ -779,7 +780,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx @Override public void autoImportReferenceAtCursor(@NotNull Editor editor, @NotNull PsiFile file) { - for(ReferenceImporter importer: Extensions.getExtensions(ReferenceImporter.EP_NAME)) { + for (ReferenceImporter importer : Extensions.getExtensions(ReferenceImporter.EP_NAME)) { if (importer.autoImportReferenceAtCursor(editor, file)) break; } } @@ -790,7 +791,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx @NotNull @TestOnly - public static List getFileLevelHighlights(@NotNull Project project, @NotNull PsiFile file ) { + public static List getFileLevelHighlights(@NotNull Project project, @NotNull PsiFile file) { return UpdateHighlightersUtil.getFileLevelHighlights(project, file); }