mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+5
-5
@@ -47,7 +47,7 @@ public class HighlightNamesUtil {
|
||||
public static HighlightInfo highlightMethodName(final PsiMethod method,
|
||||
final PsiElement elementToHighlight,
|
||||
final boolean isDeclaration,
|
||||
final EditorColorsScheme colorsScheme) {
|
||||
@NotNull EditorColorsScheme colorsScheme) {
|
||||
HighlightInfoType type = getMethodNameHighlightType(method, isDeclaration);
|
||||
if (type != null && elementToHighlight != null) {
|
||||
TextAttributes attributes = mergeWithScopeAttributes(method, type, colorsScheme);
|
||||
@@ -59,7 +59,7 @@ public class HighlightNamesUtil {
|
||||
|
||||
private static TextAttributes mergeWithScopeAttributes(final PsiElement element,
|
||||
final HighlightInfoType type,
|
||||
final EditorColorsScheme colorsScheme) {
|
||||
@NotNull EditorColorsScheme colorsScheme) {
|
||||
TextAttributes regularAttributes = HighlightInfo.getAttributesByType(element, type, colorsScheme);
|
||||
if (element == null) return regularAttributes;
|
||||
TextAttributes scopeAttributes = getScopeAttributes(element, colorsScheme);
|
||||
@@ -67,7 +67,7 @@ public class HighlightNamesUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static HighlightInfo highlightClassName(PsiClass aClass, PsiElement elementToHighlight, final EditorColorsScheme colorsScheme) {
|
||||
public static HighlightInfo highlightClassName(PsiClass aClass, PsiElement elementToHighlight, @NotNull EditorColorsScheme colorsScheme) {
|
||||
HighlightInfoType type = getClassNameHighlightType(aClass, elementToHighlight);
|
||||
if (elementToHighlight != null) {
|
||||
TextAttributes attributes = mergeWithScopeAttributes(aClass, type, colorsScheme);
|
||||
@@ -98,7 +98,7 @@ public class HighlightNamesUtil {
|
||||
@Nullable
|
||||
public static HighlightInfo highlightVariableName(final PsiVariable variable,
|
||||
final PsiElement elementToHighlight,
|
||||
final EditorColorsScheme colorsScheme) {
|
||||
@NotNull EditorColorsScheme colorsScheme) {
|
||||
HighlightInfoType varType = getVariableNameHighlightType(variable);
|
||||
if (varType != null) {
|
||||
if (variable instanceof PsiField) {
|
||||
@@ -112,7 +112,7 @@ public class HighlightNamesUtil {
|
||||
|
||||
@Nullable
|
||||
public static HighlightInfo highlightClassNameInQualifier(final PsiJavaCodeReferenceElement element,
|
||||
final EditorColorsScheme colorsScheme) {
|
||||
@NotNull EditorColorsScheme colorsScheme) {
|
||||
PsiExpression qualifierExpression = null;
|
||||
if (element instanceof PsiReferenceExpression) {
|
||||
qualifierExpression = ((PsiReferenceExpression)element).getQualifierExpression();
|
||||
|
||||
+1
-1
@@ -770,7 +770,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
doVisitReferenceElement(ref);
|
||||
}
|
||||
|
||||
private JavaResolveResult doVisitReferenceElement(PsiJavaCodeReferenceElement ref) {
|
||||
private JavaResolveResult doVisitReferenceElement(@NotNull PsiJavaCodeReferenceElement ref) {
|
||||
JavaResolveResult result;
|
||||
try {
|
||||
result = ref.advancedResolve(true);
|
||||
|
||||
@@ -18,6 +18,9 @@ package com.intellij.openapi.editor.ex;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* An iterator you must to {@link #dispose()} after use
|
||||
*/
|
||||
public interface DisposableIterator<T> extends Iterator<T> {
|
||||
void dispose();
|
||||
DisposableIterator EMPTY = new DisposableIterator() {
|
||||
|
||||
@@ -317,6 +317,40 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
|
||||
return (int)(packedOffsets >> 33);
|
||||
}
|
||||
|
||||
// finds previous in the in-order traversal
|
||||
IntervalNode<E> previous() {
|
||||
IntervalNode<E> left = getLeft();
|
||||
if (left != null) {
|
||||
while (left.getRight() != null) {
|
||||
left = left.getRight();
|
||||
}
|
||||
return left;
|
||||
}
|
||||
IntervalNode<E> parent = getParent();
|
||||
while (parent != null) {
|
||||
if (parent.getRight() == this) break;
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
// finds next node in the in-order traversal
|
||||
IntervalNode<E> next() {
|
||||
IntervalNode<E> right = getRight();
|
||||
if (right != null) {
|
||||
while (right.getLeft() != null) {
|
||||
right = right.getLeft();
|
||||
}
|
||||
return right;
|
||||
}
|
||||
IntervalNode<E> parent = getParent();
|
||||
while (parent != null) {
|
||||
if (parent.getLeft() == this) break;
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
@NonNls
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -642,24 +676,6 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
|
||||
return Math.max(start, startOffset) <= Math.min(end, endOffset);
|
||||
}
|
||||
|
||||
// finds previous in the in-order traversal
|
||||
private IntervalNode<T> previous(@NotNull IntervalNode<T> node) {
|
||||
IntervalNode<T> left = node.getLeft();
|
||||
if (left != null) {
|
||||
while (left.getRight() != null) {
|
||||
left = left.getRight();
|
||||
}
|
||||
return left;
|
||||
}
|
||||
IntervalNode<T> parent = node.getParent();
|
||||
while (parent != null) {
|
||||
if (parent.getRight() == node) break;
|
||||
node = parent;
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
protected IntervalNode<T> findOrInsert(@NotNull IntervalNode<T> node) {
|
||||
assertUnderWriteLock();
|
||||
node.color = Color.RED;
|
||||
|
||||
@@ -213,7 +213,7 @@ public class ModuleUtil {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static boolean visitMeAndDependentModules(final @NotNull Module module, final ModuleVisitor visitor) {
|
||||
public static boolean visitMeAndDependentModules(@NotNull final Module module, final ModuleVisitor visitor) {
|
||||
if (!visitor.visit(module)) {
|
||||
return false;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ public class ModuleUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean moduleContainsFile(final Module module, VirtualFile file, boolean isLibraryElement) {
|
||||
public static boolean moduleContainsFile(@NotNull final Module module, VirtualFile file, boolean isLibraryElement) {
|
||||
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
|
||||
if (isLibraryElement) {
|
||||
OrderEntry orderEntry = moduleRootManager.getFileIndex().getOrderEntryForFile(file);
|
||||
|
||||
@@ -46,9 +46,9 @@ public abstract class WolfTheProblemSolver implements ProjectComponent {
|
||||
public abstract void weHaveGotProblems(@NotNull VirtualFile virtualFile, @NotNull List<Problem> problems);
|
||||
public abstract void clearProblems(@NotNull VirtualFile virtualFile);
|
||||
|
||||
public abstract boolean hasProblemFilesBeneath(Condition<VirtualFile> condition);
|
||||
public abstract boolean hasProblemFilesBeneath(@NotNull Condition<VirtualFile> condition);
|
||||
|
||||
public abstract boolean hasProblemFilesBeneath(Module scope);
|
||||
public abstract boolean hasProblemFilesBeneath(@NotNull Module scope);
|
||||
|
||||
@Nullable
|
||||
public abstract Problem convertToProblem(final VirtualFile virtualFile, final HighlightSeverity severity,
|
||||
@@ -66,13 +66,13 @@ public abstract class WolfTheProblemSolver implements ProjectComponent {
|
||||
public void problemsDisappeared(VirtualFile file) {}
|
||||
}
|
||||
|
||||
public abstract void addProblemListener(ProblemListener listener);
|
||||
public abstract void addProblemListener(ProblemListener listener, Disposable parentDisposable);
|
||||
public abstract void removeProblemListener(ProblemListener listener);
|
||||
public abstract void addProblemListener(@NotNull ProblemListener listener);
|
||||
public abstract void addProblemListener(@NotNull ProblemListener listener, @NotNull Disposable parentDisposable);
|
||||
public abstract void removeProblemListener(@NotNull ProblemListener listener);
|
||||
|
||||
/**
|
||||
* @deprecated register extensions to {@link #FILTER_EP_NAME} instead
|
||||
*/
|
||||
public abstract void registerFileHighlightFilter(Condition<VirtualFile> filter, Disposable parentDisposable);
|
||||
public abstract void registerFileHighlightFilter(@NotNull Condition<VirtualFile> filter, @NotNull Disposable parentDisposable);
|
||||
public abstract void queue(VirtualFile suspiciousFile);
|
||||
}
|
||||
|
||||
+1
-22
@@ -26,7 +26,6 @@ import com.intellij.codeInsight.daemon.LineMarkerInfo;
|
||||
import com.intellij.codeInsight.daemon.ReferenceImporter;
|
||||
import com.intellij.codeInsight.hint.HintManager;
|
||||
import com.intellij.codeInsight.intention.impl.IntentionHintComponent;
|
||||
import com.intellij.codeInspection.ex.InspectionProfileWrapper;
|
||||
import com.intellij.concurrency.Job;
|
||||
import com.intellij.ide.PowerSaveMode;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
@@ -54,7 +53,6 @@ import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.packageDependencies.DependencyValidationManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.PsiCompiledElement;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -234,7 +232,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
|
||||
if (callbackWhileWaiting != null) {
|
||||
callbackWhileWaiting.run();
|
||||
}
|
||||
progress.waitFor(100);
|
||||
progress.waitFor(50);
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
Throwable savedException = PassExecutorService.getSavedException(progress);
|
||||
if (savedException != null) throw savedException;
|
||||
@@ -757,25 +755,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
|
||||
runnable.run();
|
||||
}
|
||||
else {
|
||||
final InspectionProfileWrapper profile = InspectionProjectProfileManager.getInstance(myProject).getProfileWrapper();
|
||||
final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(activeEditor.getDocument());
|
||||
if (psiFile != null && profile != null && !profile.areToolsInstantiated()) {
|
||||
// optimization: do expensive classloading outside readaction
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (!psiFile.getManager().isDisposed() && !profile.areToolsInstantiated()) {
|
||||
profile.preInstantiateTools(psiFile);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
((PsiDocumentManagerImpl)PsiDocumentManager.getInstance(myProject)).cancelAndRunWhenAllCommitted(
|
||||
"start daemon when all committed", runnable);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.ProjectTopics;
|
||||
import com.intellij.codeHighlighting.Pass;
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.codeInsight.hint.TooltipController;
|
||||
import com.intellij.codeInspection.ex.InspectionProfileWrapper;
|
||||
import com.intellij.ide.PowerSaveMode;
|
||||
import com.intellij.ide.todo.TodoConfiguration;
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -130,7 +131,7 @@ class DaemonListeners implements Disposable {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
Editor editor = e.getEditor();
|
||||
if ((!editor.getComponent().isShowing() && !ApplicationManager.getApplication().isUnitTestMode()) ||
|
||||
if (!editor.getComponent().isShowing() && !ApplicationManager.getApplication().isUnitTestMode() ||
|
||||
!worthBothering(editor.getDocument(), editor.getProject())) {
|
||||
return; //no need to stop daemon if something happened in the console
|
||||
}
|
||||
@@ -158,6 +159,7 @@ class DaemonListeners implements Disposable {
|
||||
// editor appear in modal context, re-enable the daemon
|
||||
myDaemonCodeAnalyzer.setUpdateByTimerEnabled(true);
|
||||
}
|
||||
preInstantiateTools();
|
||||
}
|
||||
};
|
||||
myEditorTracker.addEditorTrackerListener(editorTrackerListener, this);
|
||||
@@ -294,6 +296,33 @@ class DaemonListeners implements Disposable {
|
||||
LaterInvocator.addModalityStateListener(modalityStateListener,this);
|
||||
}
|
||||
|
||||
private void preInstantiateTools() {
|
||||
final InspectionProfileWrapper profile = InspectionProjectProfileManager.getInstance(myProject).getProfileWrapper();
|
||||
if (profile == null || profile.areToolsInstantiated()) return;
|
||||
Collection<FileEditor> editors = getSelectedEditors();
|
||||
for (FileEditor fe : editors) {
|
||||
if (!(fe instanceof TextEditor)) continue;
|
||||
Editor editor = ((TextEditor)fe).getEditor();
|
||||
final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
|
||||
if (psiFile == null) continue;
|
||||
// optimization: do expensive classloading outside readaction
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!psiFile.getManager().isDisposed() && !profile.areToolsInstantiated()) {
|
||||
try {
|
||||
profile.preInstantiateTools(psiFile);
|
||||
}
|
||||
catch (Throwable ignored) {
|
||||
// app still can be disposed in the middle, ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isUnderIgnoredAction(@Nullable Object action) {
|
||||
return action instanceof DocumentRunnable.IgnoreDocumentRunnable ||
|
||||
ApplicationManager.getApplication().hasWriteAction(DocumentRunnable.IgnoreDocumentRunnable.class);
|
||||
@@ -532,6 +561,7 @@ class DaemonListeners implements Disposable {
|
||||
myDaemonCodeAnalyzer.restart();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
Collection<FileEditor> getSelectedEditors() {
|
||||
// Editors in modal context
|
||||
List<Editor> editors = getActiveEditors();
|
||||
|
||||
+6
-4
@@ -57,6 +57,7 @@ public class DefaultHighlightVisitor implements HighlightVisitor, DumbAware {
|
||||
private final DumbService myDumbService;
|
||||
private HighlightInfoHolder myHolder;
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public DefaultHighlightVisitor(@NotNull Project project) {
|
||||
this(project, true, true);
|
||||
}
|
||||
@@ -166,10 +167,11 @@ public class DefaultHighlightVisitor implements HighlightVisitor, DumbAware {
|
||||
myHolder.add(info);
|
||||
}
|
||||
|
||||
private static HighlightInfo createErrorElementInfo(final PsiErrorElement element) {
|
||||
private static HighlightInfo createErrorElementInfo(@NotNull PsiErrorElement element) {
|
||||
TextRange range = element.getTextRange();
|
||||
String errorDescription = element.getErrorDescription();
|
||||
if (!range.isEmpty()) {
|
||||
final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, range, element.getErrorDescription());
|
||||
final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, range, errorDescription);
|
||||
for(ErrorQuickFixProvider provider: Extensions.getExtensions(ErrorQuickFixProvider.EP_NAME)) {
|
||||
provider.registerErrorQuickFix(element, highlightInfo);
|
||||
}
|
||||
@@ -183,7 +185,7 @@ public class DefaultHighlightVisitor implements HighlightVisitor, DumbAware {
|
||||
String text = elementAtOffset == null ? null : elementAtOffset.getText();
|
||||
HighlightInfo info;
|
||||
if (offset < fileLength && text != null && !StringUtil.startsWithChar(text, '\n') && !StringUtil.startsWithChar(text, '\r')) {
|
||||
info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, offset, offset + 1, element.getErrorDescription());
|
||||
info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, offset, offset + 1, errorDescription);
|
||||
}
|
||||
else {
|
||||
int start;
|
||||
@@ -196,7 +198,7 @@ public class DefaultHighlightVisitor implements HighlightVisitor, DumbAware {
|
||||
start = offset;
|
||||
end = offset < fileLength ? offset + 1 : offset;
|
||||
}
|
||||
info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, element, start, end, element.getErrorDescription(),element.getErrorDescription(), true, null);
|
||||
info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, element, start, end, errorDescription, errorDescription, true, null);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
+27
-130
@@ -185,10 +185,10 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
|
||||
|
||||
DaemonCodeAnalyzer daemonCodeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
|
||||
HighlightVisitor[] highlightVisitors = getHighlightVisitors();
|
||||
final HighlightVisitor[] filteredVisitors = filterVisitors(highlightVisitors, myFile);
|
||||
final List<PsiElement> inside = new ArrayList<PsiElement>();
|
||||
final List<PsiElement> outside = new ArrayList<PsiElement>();
|
||||
try {
|
||||
final HighlightVisitor[] filteredVisitors = filterVisitors(highlightVisitors, myFile);
|
||||
Divider.divideInsideAndOutside(myFile, myStartOffset, myEndOffset, myPriorityRange, inside, outside,
|
||||
HighlightLevelUtil.AnalysisLevel.HIGHLIGHT,false);
|
||||
|
||||
@@ -570,6 +570,26 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
|
||||
|
||||
final int chunkSize = Math.max(1, (elements1.size()+elements2.size()) / 100); // one percent precision is enough
|
||||
|
||||
final Map<TextRange, RangeMarker> ranges2markersCache = new THashMap<TextRange, RangeMarker>();
|
||||
final TransferToEDTQueue<HighlightInfo> myTransferToEDTQueue
|
||||
= new TransferToEDTQueue<HighlightInfo>("Apply highlighting results", new Processor<HighlightInfo>() {
|
||||
@Override
|
||||
public boolean process(HighlightInfo info) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
final EditorColorsScheme colorsScheme = getColorsScheme();
|
||||
UpdateHighlightersUtil.addHighlighterToEditorIncrementally(myProject, myDocument, myFile, myStartOffset, myEndOffset,
|
||||
info, colorsScheme, Pass.UPDATE_ALL, ranges2markersCache);
|
||||
|
||||
return true;
|
||||
}
|
||||
}, new Condition<Object>() {
|
||||
@Override
|
||||
public boolean value(Object o) {
|
||||
return myProject.isDisposed() || progress.isCanceled();
|
||||
}
|
||||
}, 200);
|
||||
|
||||
|
||||
final Runnable action = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -630,7 +650,7 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
|
||||
}
|
||||
myErrorFound = true;
|
||||
}
|
||||
myTransferToEDTQueue.offer(Pair.create(info, progress));
|
||||
myTransferToEDTQueue.offer(info);
|
||||
}
|
||||
}
|
||||
advanceProgress(elements.size() - (nextLimit-chunkSize));
|
||||
@@ -642,130 +662,6 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
|
||||
analyzeByVisitors(progress, visitors, holder, 0, action);
|
||||
}
|
||||
|
||||
//private void collectHighlights(@NotNull final List<PsiElement> elements1,
|
||||
// @NotNull final Runnable after1,
|
||||
// @NotNull final List<PsiElement> elements2,
|
||||
// @NotNull final ProgressIndicator progress,
|
||||
// @NotNull final HighlightVisitor[] visitors,
|
||||
// @NotNull final Set<HighlightInfo> gotHighlights,
|
||||
// final boolean forceHighlightParents) {
|
||||
// final HighlightInfoHolder holder = createInfoHolder(myFile);
|
||||
//
|
||||
// final int chunkSize = Math.max(1, (elements1.size()+elements2.size()) / 100); // one percent precision is enough
|
||||
//
|
||||
// final Runnable action = new Runnable() {
|
||||
// public void run() {
|
||||
// //noinspection unchecked
|
||||
// boolean failed = false;
|
||||
// PsiNodeTask task = createPsiTask(myFile);
|
||||
// JobSchedulerImpl.submitTask(task);
|
||||
//
|
||||
// for (List<PsiElement> elements : new List[]{elements1, elements2}) {
|
||||
// int nextLimit = chunkSize;
|
||||
// for (int i = 0; i < elements.size(); i++) {
|
||||
// PsiElement element = elements.get(i);
|
||||
// progress.checkCanceled();
|
||||
//
|
||||
// if (element != myFile && !skipParentsSet.isEmpty() && element.getFirstChild() != null && skipParentsSet.contains(element)) {
|
||||
// skipParentsSet.add(element.getParent());
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (element instanceof PsiErrorElement) {
|
||||
// myHasErrorElement = true;
|
||||
// }
|
||||
// kjlhkjh
|
||||
// if (i == nextLimit) {
|
||||
// advanceProgress(chunkSize);
|
||||
// nextLimit = i + chunkSize;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// advanceProgress(elements.size() - (nextLimit-chunkSize));
|
||||
// if (elements == elements1) after1.run();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private PsiNodeTask createPsiTask(@NotNull PsiElement root) {
|
||||
// return new PsiNodeTask(root) {
|
||||
// @Override
|
||||
// public void onEnter(@NotNull PsiElement element) {
|
||||
// if (element instanceof PsiErrorElement) {
|
||||
// myHasErrorElement = true;
|
||||
// }
|
||||
// super.onEnter(element);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected PsiNodeTask forkNode(@NotNull PsiElement child) {
|
||||
// return createPsiTask(child);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected boolean highlight(PsiElement element) {
|
||||
// holder.clear();
|
||||
//
|
||||
// for (final HighlightVisitor visitor : visitors) {
|
||||
// try {
|
||||
// visitor.visit(element);
|
||||
// }
|
||||
// catch (ProcessCanceledException e) {
|
||||
// throw e;
|
||||
// }
|
||||
// catch (IndexNotReadyException e) {
|
||||
// throw e;
|
||||
// }
|
||||
// catch (WolfTheProblemSolverImpl.HaveGotErrorException e) {
|
||||
// throw e;
|
||||
// }
|
||||
// catch (Exception e) {
|
||||
// LOG.error(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //noinspection ForLoopReplaceableByForEach
|
||||
// for (int j = 0; j < holder.size(); j++) {
|
||||
// final HighlightInfo info = holder.get(j);
|
||||
// assert info != null;
|
||||
// // have to filter out already obtained highlights
|
||||
// if (!gotHighlights.add(info)) continue;
|
||||
// boolean isError = info.getSeverity() == HighlightSeverity.ERROR;
|
||||
// if (isError) {
|
||||
// if (!forceHighlightParents) {
|
||||
// skipParentsSet.add(element.getParent());
|
||||
// }
|
||||
// myErrorFound = true;
|
||||
// }
|
||||
// myTransferToEDTQueue.offer(Pair.create(info, progress));
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// analyzeByVisitors(progress, visitors, holder, 0, action);
|
||||
//}
|
||||
|
||||
private final Map<TextRange, RangeMarker> ranges2markersCache = new THashMap<TextRange, RangeMarker>();
|
||||
private final TransferToEDTQueue<Pair<HighlightInfo,ProgressIndicator>> myTransferToEDTQueue
|
||||
= new TransferToEDTQueue<Pair<HighlightInfo,ProgressIndicator>>("Apply highlighting results", new Processor<Pair<HighlightInfo,ProgressIndicator>>() {
|
||||
@Override
|
||||
public boolean process(Pair<HighlightInfo,ProgressIndicator> pair) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
ProgressIndicator indicator = pair.getSecond();
|
||||
if (indicator.isCanceled()) {
|
||||
return false;
|
||||
}
|
||||
HighlightInfo info = pair.getFirst();
|
||||
final EditorColorsScheme colorsScheme = getColorsScheme();
|
||||
UpdateHighlightersUtil.addHighlighterToEditorIncrementally(myProject, myDocument, myFile, myStartOffset, myEndOffset,
|
||||
info, colorsScheme, Pass.UPDATE_ALL, ranges2markersCache);
|
||||
|
||||
return true;
|
||||
}
|
||||
}, myProject.getDisposed(), 200);
|
||||
|
||||
private void analyzeByVisitors(@NotNull final ProgressIndicator progress,
|
||||
@NotNull final HighlightVisitor[] visitors,
|
||||
@NotNull final HighlightInfoHolder holder,
|
||||
@@ -785,7 +681,8 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
|
||||
}
|
||||
}
|
||||
|
||||
private static HighlightVisitor[] filterVisitors(HighlightVisitor[] highlightVisitors, final PsiFile file) {
|
||||
@NotNull
|
||||
private static HighlightVisitor[] filterVisitors(@NotNull HighlightVisitor[] highlightVisitors, @NotNull PsiFile file) {
|
||||
final List<HighlightVisitor> visitors = new ArrayList<HighlightVisitor>(highlightVisitors.length);
|
||||
List<HighlightVisitor> list = Arrays.asList(highlightVisitors);
|
||||
for (HighlightVisitor visitor : DumbService.getInstance(file.getProject()).filterByDumbAwareness(list)) {
|
||||
@@ -798,7 +695,7 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
|
||||
return visitorArray;
|
||||
}
|
||||
|
||||
static Void cancelAndRestartDaemonLater(ProgressIndicator progress, final Project project, TextEditorHighlightingPass pass) {
|
||||
static void cancelAndRestartDaemonLater(ProgressIndicator progress, final Project project, TextEditorHighlightingPass pass) {
|
||||
PassExecutorService.log(progress, pass, "Cancel and restart");
|
||||
progress.cancel();
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@@ -885,8 +782,8 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
|
||||
return myUpdateAll ? super.getProgress() : -1;
|
||||
}
|
||||
|
||||
private static List<Problem> convertToProblems(final Collection<HighlightInfo> infos,
|
||||
final VirtualFile file,
|
||||
private static List<Problem> convertToProblems(@NotNull Collection<HighlightInfo> infos,
|
||||
@NotNull VirtualFile file,
|
||||
final boolean hasErrorElement) {
|
||||
List<Problem> problems = new SmartList<Problem>();
|
||||
for (HighlightInfo info : infos) {
|
||||
|
||||
@@ -20,7 +20,10 @@ import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInsight.intention.IntentionManager;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.CustomSuppressableInspectionTool;
|
||||
import com.intellij.codeInspection.InspectionProfile;
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.actions.CleanupInspectionIntention;
|
||||
import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
@@ -46,7 +49,6 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
@@ -67,13 +69,41 @@ public class HighlightInfo implements Segment {
|
||||
public final TextAttributes forcedTextAttributes;
|
||||
public final TextAttributesKey forcedTextAttributesKey;
|
||||
|
||||
public final HighlightInfoType type;
|
||||
public int group;
|
||||
public final int startOffset;
|
||||
public final int endOffset;
|
||||
|
||||
public int fixStartOffset;
|
||||
public int fixEndOffset;
|
||||
public RangeMarker fixMarker; // null means it the same as highlighter
|
||||
|
||||
public final String description;
|
||||
public final String toolTip;
|
||||
public final HighlightSeverity severity;
|
||||
|
||||
public final boolean isAfterEndOfLine;
|
||||
public final boolean isFileLevelAnnotation;
|
||||
public int navigationShift = 0;
|
||||
|
||||
public RangeHighlighterEx highlighter;
|
||||
public String text;
|
||||
|
||||
public List<Pair<IntentionActionDescriptor, TextRange>> quickFixActionRanges;
|
||||
public List<Pair<IntentionActionDescriptor, RangeMarker>> quickFixActionMarkers;
|
||||
private boolean hasHint;
|
||||
public boolean fromInjection;
|
||||
|
||||
private GutterIconRenderer gutterIconRenderer;
|
||||
private String myProblemGroup;
|
||||
public boolean bijective;
|
||||
|
||||
public HighlightSeverity getSeverity() {
|
||||
return severity;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TextAttributes getTextAttributes(@Nullable final PsiElement element,
|
||||
@Nullable final EditorColorsScheme editorColorsScheme) {
|
||||
public TextAttributes getTextAttributes(@Nullable final PsiElement element, @Nullable final EditorColorsScheme editorColorsScheme) {
|
||||
if (forcedTextAttributes != null) {
|
||||
return forcedTextAttributes;
|
||||
}
|
||||
@@ -92,7 +122,7 @@ public class HighlightInfo implements Segment {
|
||||
|
||||
public static TextAttributes getAttributesByType(@Nullable final PsiElement element,
|
||||
@NotNull HighlightInfoType type,
|
||||
final EditorColorsScheme colorsScheme) {
|
||||
@NotNull EditorColorsScheme colorsScheme) {
|
||||
final SeverityRegistrar severityRegistrar = SeverityRegistrar.getInstance(element != null ? element.getProject() : null);
|
||||
final TextAttributes textAttributes = severityRegistrar.getTextAttributesBySeverity(type.getSeverity(element));
|
||||
if (textAttributes != null) {
|
||||
@@ -103,7 +133,7 @@ public class HighlightInfo implements Segment {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Color getErrorStripeMarkColor(final PsiElement element,
|
||||
public Color getErrorStripeMarkColor(@NotNull PsiElement element,
|
||||
@Nullable final EditorColorsScheme colorsScheme) { // if null global scheme will be used
|
||||
if (forcedTextAttributes != null && forcedTextAttributes.getErrorStripeColor() != null) {
|
||||
return forcedTextAttributes.getErrorStripeColor();
|
||||
@@ -174,7 +204,8 @@ public class HighlightInfo implements Segment {
|
||||
boolean isEndOfLine,
|
||||
TextAttributes forcedAttributes) {
|
||||
LOG.assertTrue(element != null || ArrayUtil.find(HighlightSeverity.DEFAULT_SEVERITIES, type.getSeverity(element)) != -1, "Custom type demands element to detect its text attributes");
|
||||
HighlightInfo highlightInfo = new HighlightInfo(forcedAttributes, type, start, end, description, toolTip, type.getSeverity(element), isEndOfLine, null, false);
|
||||
HighlightInfo highlightInfo = new HighlightInfo(forcedAttributes, null, type, start, end, description, toolTip,
|
||||
type.getSeverity(element), isEndOfLine, null, false);
|
||||
PsiFile file = element == null ? null : element.getContainingFile();
|
||||
for (HighlightInfoFilter filter : getFilters()) {
|
||||
if (!filter.accept(highlightInfo, file)) {
|
||||
@@ -201,57 +232,19 @@ public class HighlightInfo implements Segment {
|
||||
|
||||
public static HighlightInfo createHighlightInfo(@NotNull HighlightInfoType type, @NotNull TextRange textRange, String description, String toolTip, TextAttributes textAttributes) {
|
||||
// do not use HighlightInfoFilter
|
||||
return new HighlightInfo(textAttributes, type, textRange.getStartOffset(), textRange.getEndOffset(), description, htmlEscapeToolTip(toolTip),type.getSeverity(null), false, null,
|
||||
false);
|
||||
return new HighlightInfo(textAttributes, null, type, textRange.getStartOffset(), textRange.getEndOffset(), description,
|
||||
htmlEscapeToolTip(toolTip), type.getSeverity(null), false, null, false);
|
||||
}
|
||||
|
||||
public boolean needUpdateOnTyping() {
|
||||
return myNeedsUpdateOnTyping;
|
||||
}
|
||||
|
||||
public final HighlightInfoType type;
|
||||
public int group;
|
||||
public final int startOffset;
|
||||
public final int endOffset;
|
||||
|
||||
public int fixStartOffset;
|
||||
public int fixEndOffset;
|
||||
public RangeMarker fixMarker;
|
||||
|
||||
public final String description;
|
||||
public final String toolTip;
|
||||
public final HighlightSeverity severity;
|
||||
|
||||
public final boolean isAfterEndOfLine;
|
||||
public final boolean isFileLevelAnnotation;
|
||||
public int navigationShift = 0;
|
||||
|
||||
public RangeHighlighterEx highlighter;
|
||||
public String text;
|
||||
|
||||
public List<Pair<IntentionActionDescriptor, TextRange>> quickFixActionRanges;
|
||||
public List<Pair<IntentionActionDescriptor, RangeMarker>> quickFixActionMarkers;
|
||||
private boolean hasHint;
|
||||
public boolean fromInjection;
|
||||
|
||||
private GutterIconRenderer gutterIconRenderer;
|
||||
private String myProblemGroup;
|
||||
|
||||
public HighlightInfo(HighlightInfoType type, int startOffset, int endOffset, String description, String toolTip) {
|
||||
this(null, type, startOffset, endOffset, description, toolTip, type.getSeverity(null), false, null, false);
|
||||
public HighlightInfo(@NotNull HighlightInfoType type, int startOffset, int endOffset, String description, String toolTip) {
|
||||
this(null, null, type, startOffset, endOffset, description, toolTip, type.getSeverity(null), false, null, false);
|
||||
}
|
||||
|
||||
public HighlightInfo(@Nullable TextAttributes forcedTextAttributes,
|
||||
@NotNull HighlightInfoType type,
|
||||
int startOffset,
|
||||
int endOffset,
|
||||
@Nullable String description,
|
||||
@Nullable String toolTip,
|
||||
@NotNull HighlightSeverity severity,
|
||||
boolean afterEndOfLine,
|
||||
@Nullable Boolean needsUpdateOnTyping, boolean isFileLevelAnnotation) {
|
||||
this(forcedTextAttributes, null, type, startOffset, endOffset, description, toolTip, severity, afterEndOfLine, needsUpdateOnTyping, isFileLevelAnnotation);
|
||||
}
|
||||
//primary
|
||||
public HighlightInfo(@Nullable TextAttributes forcedTextAttributes,
|
||||
@Nullable TextAttributesKey forcedTextAttributesKey,
|
||||
@NotNull HighlightInfoType type,
|
||||
@@ -261,7 +254,8 @@ public class HighlightInfo implements Segment {
|
||||
@Nullable String toolTip,
|
||||
@NotNull HighlightSeverity severity,
|
||||
boolean afterEndOfLine,
|
||||
@Nullable Boolean needsUpdateOnTyping, boolean isFileLevelAnnotation) {
|
||||
@Nullable Boolean needsUpdateOnTyping,
|
||||
boolean isFileLevelAnnotation) {
|
||||
if (startOffset < 0 || startOffset > endOffset) {
|
||||
LOG.error("Incorrect highlightInfo bounds. description="+description+"; startOffset="+startOffset+"; endOffset="+endOffset+";type="+type);
|
||||
}
|
||||
@@ -353,7 +347,7 @@ public class HighlightInfo implements Segment {
|
||||
}
|
||||
|
||||
public static HighlightInfo createHighlightInfo(@NotNull HighlightInfoType type, @NotNull ASTNode childByRole, String localizedMessage) {
|
||||
return createHighlightInfo(type, SourceTreeToPsiMap.treeElementToPsi(childByRole), localizedMessage);
|
||||
return createHighlightInfo(type, childByRole.getPsi(), localizedMessage);
|
||||
}
|
||||
|
||||
public GutterIconRenderer getGutterIconRenderer() {
|
||||
@@ -379,8 +373,8 @@ public class HighlightInfo implements Segment {
|
||||
final TextAttributes attributes) {
|
||||
TextRange textRange = element.getTextRange();
|
||||
// do not use HighlightInfoFilter
|
||||
return new HighlightInfo(attributes, type, textRange.getStartOffset(), textRange.getEndOffset(), message, htmlEscapeToolTip(message),
|
||||
type.getSeverity(element), false, Boolean.FALSE, false);
|
||||
return new HighlightInfo(attributes, null, type, textRange.getStartOffset(), textRange.getEndOffset(), message,
|
||||
htmlEscapeToolTip(message), type.getSeverity(element), false, Boolean.FALSE, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -548,7 +542,7 @@ public class HighlightInfo implements Segment {
|
||||
@NonNls
|
||||
public String toString() {
|
||||
String text = getAction().getText();
|
||||
return "descriptor: " + (text.length()==0 ? getAction().getClass() : text);
|
||||
return "descriptor: " + (text.isEmpty() ? getAction().getClass() : text);
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
|
||||
+1
-2
@@ -436,8 +436,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
|
||||
final HighlightSeverity severity = highlightInfoType.getSeverity(psiElement);
|
||||
TextAttributes attributes = mySeverityRegistrar.getTextAttributesBySeverity(severity);
|
||||
return new HighlightInfo(attributes, highlightInfoType, textRange.getStartOffset(),
|
||||
textRange.getEndOffset(), message, toolTip,
|
||||
return new HighlightInfo(attributes, null, highlightInfoType, textRange.getStartOffset(), textRange.getEndOffset(), message, toolTip,
|
||||
severity, problemDescriptor.isAfterEndOfLine(), null, isFileLevel);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -384,7 +384,7 @@ public abstract class PassExecutorService implements Disposable {
|
||||
log(myUpdateProgress, myPass, "Finished. ");
|
||||
|
||||
if (!myUpdateProgress.isCanceled()) {
|
||||
applyInformationToEditors(myFileEditors, myPass, myUpdateProgress, myThreadsToStartCountdown);
|
||||
applyInformationToEditorsLater(myFileEditors, myPass, myUpdateProgress, myThreadsToStartCountdown);
|
||||
for (ScheduledPass successor : mySuccessorsOnCompletion) {
|
||||
int predecessorsToRun = successor.myRunningPredecessorsCount.decrementAndGet();
|
||||
if (predecessorsToRun == 0) {
|
||||
@@ -401,10 +401,10 @@ public abstract class PassExecutorService implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyInformationToEditors(@NotNull final List<FileEditor> fileEditors,
|
||||
@NotNull final TextEditorHighlightingPass pass,
|
||||
@NotNull final DaemonProgressIndicator updateProgress,
|
||||
@NotNull final AtomicInteger threadsToStartCountdown) {
|
||||
private void applyInformationToEditorsLater(@NotNull final List<FileEditor> fileEditors,
|
||||
@NotNull final TextEditorHighlightingPass pass,
|
||||
@NotNull final DaemonProgressIndicator updateProgress,
|
||||
@NotNull final AtomicInteger threadsToStartCountdown) {
|
||||
final boolean testMode = ApplicationManager.getApplication().isUnitTestMode();
|
||||
ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {
|
||||
@Override
|
||||
|
||||
+6
-6
@@ -44,7 +44,7 @@ public class MockWolfTheProblemSolver extends WolfTheProblemSolver {
|
||||
if (myDelegate != null) myDelegate.weHaveGotProblems(virtualFile, problems);
|
||||
}
|
||||
|
||||
public boolean hasProblemFilesBeneath(final Condition<VirtualFile> condition) {
|
||||
public boolean hasProblemFilesBeneath(@NotNull final Condition<VirtualFile> condition) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -52,23 +52,23 @@ public class MockWolfTheProblemSolver extends WolfTheProblemSolver {
|
||||
return myDelegate != null && myDelegate.hasSyntaxErrors(file);
|
||||
}
|
||||
|
||||
public boolean hasProblemFilesBeneath(Module scope) {
|
||||
public boolean hasProblemFilesBeneath(@NotNull Module scope) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addProblemListener(ProblemListener listener) {
|
||||
public void addProblemListener(@NotNull ProblemListener listener) {
|
||||
if (myDelegate != null) myDelegate.addProblemListener(listener);
|
||||
}
|
||||
|
||||
public void addProblemListener(ProblemListener listener, Disposable parentDisposable) {
|
||||
public void addProblemListener(@NotNull ProblemListener listener, @NotNull Disposable parentDisposable) {
|
||||
if (myDelegate != null) myDelegate.addProblemListener(listener, parentDisposable);
|
||||
}
|
||||
|
||||
public void removeProblemListener(ProblemListener listener) {
|
||||
public void removeProblemListener(@NotNull ProblemListener listener) {
|
||||
if (myDelegate != null) myDelegate.removeProblemListener(listener);
|
||||
}
|
||||
|
||||
public void registerFileHighlightFilter(Condition<VirtualFile> filter, Disposable parentDisposable) {
|
||||
public void registerFileHighlightFilter(@NotNull Condition<VirtualFile> filter, @NotNull Disposable parentDisposable) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.problems.Problem;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author cdr
|
||||
@@ -29,12 +30,13 @@ public class ProblemImpl implements Problem {
|
||||
private final HighlightInfo highlightInfo;
|
||||
private final boolean isSyntax;
|
||||
|
||||
public ProblemImpl(final VirtualFile virtualFile, final HighlightInfo highlightInfo, final boolean isSyntax) {
|
||||
public ProblemImpl(@NotNull VirtualFile virtualFile, @NotNull HighlightInfo highlightInfo, final boolean isSyntax) {
|
||||
this.isSyntax = isSyntax;
|
||||
this.virtualFile = virtualFile;
|
||||
this.highlightInfo = highlightInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualFile getVirtualFile() {
|
||||
return virtualFile;
|
||||
}
|
||||
|
||||
+74
-67
@@ -21,7 +21,6 @@ import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
@@ -34,14 +33,14 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.FileStatusListener;
|
||||
import com.intellij.openapi.vcs.FileStatusManager;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.ex.StatusBarEx;
|
||||
import com.intellij.problems.Problem;
|
||||
import com.intellij.problems.WolfTheProblemSolver;
|
||||
import com.intellij.psi.*;
|
||||
@@ -66,18 +65,21 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
private final List<Condition<VirtualFile>> myFilters = ContainerUtil.createEmptyCOWList();
|
||||
private boolean myFiltersLoaded = false;
|
||||
private final ProblemListener fireProblemListeners = new ProblemListener() {
|
||||
@Override
|
||||
public void problemsAppeared(VirtualFile file) {
|
||||
for (final ProblemListener problemListener : myProblemListeners) {
|
||||
problemListener.problemsAppeared(file);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void problemsChanged(VirtualFile file) {
|
||||
for (final ProblemListener problemListener : myProblemListeners) {
|
||||
problemListener.problemsChanged(file);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void problemsDisappeared(VirtualFile file) {
|
||||
for (final ProblemListener problemListener : myProblemListeners) {
|
||||
problemListener.problemsDisappeared(file);
|
||||
@@ -103,7 +105,7 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
private final Collection<Problem> problems = new THashSet<Problem>();
|
||||
private boolean hasSyntaxErrors;
|
||||
|
||||
public boolean equals(final Object o) {
|
||||
public boolean equals(@Nullable final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
@@ -119,44 +121,52 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
}
|
||||
}
|
||||
|
||||
public WolfTheProblemSolverImpl(Project project, PsiManager psiManager, VirtualFileManager virtualFileManager) {
|
||||
public WolfTheProblemSolverImpl(@NotNull Project project, @NotNull PsiManager psiManager, @NotNull VirtualFileManager virtualFileManager) {
|
||||
myProject = project;
|
||||
PsiTreeChangeListener changeListener = new PsiTreeChangeAdapter() {
|
||||
@Override
|
||||
public void childAdded(@NotNull PsiTreeChangeEvent event) {
|
||||
childrenChanged(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childRemoved(@NotNull PsiTreeChangeEvent event) {
|
||||
childrenChanged(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childReplaced(@NotNull PsiTreeChangeEvent event) {
|
||||
childrenChanged(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childMoved(@NotNull PsiTreeChangeEvent event) {
|
||||
childrenChanged(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChanged(@NotNull PsiTreeChangeEvent event) {
|
||||
childrenChanged(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childrenChanged(@NotNull PsiTreeChangeEvent event) {
|
||||
clearSyntaxErrorFlag(event);
|
||||
}
|
||||
};
|
||||
psiManager.addPsiTreeChangeListener(changeListener);
|
||||
VirtualFileListener virtualFileListener = new VirtualFileAdapter() {
|
||||
public void fileDeleted(final VirtualFileEvent event) {
|
||||
@Override
|
||||
public void fileDeleted(@NotNull final VirtualFileEvent event) {
|
||||
onDeleted(event.getFile());
|
||||
}
|
||||
|
||||
public void fileMoved(final VirtualFileMoveEvent event) {
|
||||
@Override
|
||||
public void fileMoved(@NotNull final VirtualFileMoveEvent event) {
|
||||
onDeleted(event.getFile());
|
||||
}
|
||||
|
||||
private void onDeleted(final VirtualFile file) {
|
||||
private void onDeleted(@NotNull final VirtualFile file) {
|
||||
if (file.isDirectory()) {
|
||||
clearInvalidFiles();
|
||||
}
|
||||
@@ -169,10 +179,12 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
FileStatusManager fileStatusManager = FileStatusManager.getInstance(myProject);
|
||||
if (fileStatusManager != null) { //tests?
|
||||
fileStatusManager.addFileStatusListener(new FileStatusListener() {
|
||||
@Override
|
||||
public void fileStatusesChanged() {
|
||||
clearInvalidFiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileStatusChanged(@NotNull VirtualFile virtualFile) {
|
||||
fileStatusesChanged();
|
||||
}
|
||||
@@ -192,7 +204,7 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
}
|
||||
}
|
||||
|
||||
private void clearSyntaxErrorFlag(final PsiTreeChangeEvent event) {
|
||||
private void clearSyntaxErrorFlag(@NotNull final PsiTreeChangeEvent event) {
|
||||
PsiFile file = event.getFile();
|
||||
if (file == null) return;
|
||||
VirtualFile virtualFile = file.getVirtualFile();
|
||||
@@ -204,22 +216,27 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectOpened() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectClosed() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@NonNls
|
||||
public String getComponentName() {
|
||||
return "Problems";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
|
||||
}
|
||||
@@ -236,35 +253,29 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
if (file.isValid()) progressLimit += file.getLength(); // (rough approx number of PSI elements = file length/2) * (visitor count = 2 usually)
|
||||
}
|
||||
pass.setProgressLimit(progressLimit);
|
||||
final StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
|
||||
Pair<String, String> oldInfo = saveStatusBarInfo(statusBar);
|
||||
try {
|
||||
for (final VirtualFile virtualFile : files) {
|
||||
progress.checkCanceled();
|
||||
if (virtualFile == null) break;
|
||||
if (!virtualFile.isValid() || orderVincentToCleanTheCar(virtualFile, progress, statusBar)) {
|
||||
doRemove(virtualFile);
|
||||
}
|
||||
if (virtualFile.isValid()) pass.advanceProgress(virtualFile.getLength());
|
||||
for (final VirtualFile virtualFile : files) {
|
||||
progress.checkCanceled();
|
||||
if (virtualFile == null) break;
|
||||
if (!virtualFile.isValid() || orderVincentToCleanTheCar(virtualFile, progress)) {
|
||||
doRemove(virtualFile);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
restoreStatusBarInfo(statusBar, oldInfo);
|
||||
if (virtualFile.isValid()) pass.advanceProgress(virtualFile.getLength());
|
||||
}
|
||||
}
|
||||
|
||||
public static class HaveGotErrorException extends RuntimeException {
|
||||
private final HighlightInfo myHighlightInfo;
|
||||
@NotNull private final HighlightInfo myHighlightInfo;
|
||||
private final boolean myHasErrorElement;
|
||||
|
||||
private HaveGotErrorException(HighlightInfo info, final boolean hasErrorElement) {
|
||||
private HaveGotErrorException(@NotNull HighlightInfo info, final boolean hasErrorElement) {
|
||||
myHighlightInfo = info;
|
||||
myHasErrorElement = hasErrorElement;
|
||||
}
|
||||
}
|
||||
|
||||
// returns true if car has been cleaned
|
||||
private boolean orderVincentToCleanTheCar(final VirtualFile file, final ProgressIndicator progressIndicator, final StatusBar statusBar) throws ProcessCanceledException {
|
||||
private boolean orderVincentToCleanTheCar(@NotNull final VirtualFile file,
|
||||
@NotNull final ProgressIndicator progressIndicator) throws ProcessCanceledException {
|
||||
if (!isToBeHighlighted(file)) {
|
||||
clearProblems(file);
|
||||
return true; // file is going to be red waved no more
|
||||
@@ -282,9 +293,11 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
|
||||
try {
|
||||
GeneralHighlightingPass pass = new GeneralHighlightingPass(myProject, psiFile, document, 0, document.getTextLength(), false) {
|
||||
protected HighlightInfoHolder createInfoHolder(final PsiFile file) {
|
||||
@Override
|
||||
protected HighlightInfoHolder createInfoHolder(@NotNull final PsiFile file) {
|
||||
return new HighlightInfoHolder(file, HighlightInfoFilter.EMPTY_ARRAY) {
|
||||
public boolean add(HighlightInfo info) {
|
||||
@Override
|
||||
public boolean add(@Nullable HighlightInfo info) {
|
||||
if (info != null && info.getSeverity() == HighlightSeverity.ERROR) {
|
||||
throw new HaveGotErrorException(info, myHasErrorElement);
|
||||
}
|
||||
@@ -293,12 +306,6 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
};
|
||||
}
|
||||
};
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (progressIndicator.isCanceled()) return;
|
||||
statusBar.setInfo("Checking '" + file.getPresentableUrl() + "'");
|
||||
}
|
||||
});
|
||||
pass.collectInformation(progressIndicator);
|
||||
}
|
||||
catch (HaveGotErrorException e) {
|
||||
@@ -310,26 +317,7 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Pair<String, String> saveStatusBarInfo(final StatusBar statusBar) {
|
||||
Pair<String, String> oldInfo = null;
|
||||
if (statusBar instanceof StatusBarEx) {
|
||||
oldInfo = Pair.create(statusBar.getInfo(), ((StatusBarEx)statusBar).getInfoRequestor());
|
||||
}
|
||||
|
||||
return oldInfo;
|
||||
}
|
||||
|
||||
private static void restoreStatusBarInfo(final StatusBar statusBar, final Pair<String, String> oldInfo) {
|
||||
if (statusBar instanceof StatusBarEx) {
|
||||
LaterInvocator.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
statusBar.setInfo(oldInfo.first, oldInfo.second);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSyntaxErrors(final VirtualFile file) {
|
||||
synchronized (myProblems) {
|
||||
ProblemFileInfo info = myProblems.get(file);
|
||||
@@ -350,7 +338,8 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasProblemFilesBeneath(Condition<VirtualFile> condition) {
|
||||
@Override
|
||||
public boolean hasProblemFilesBeneath(@NotNull Condition<VirtualFile> condition) {
|
||||
if (!myProject.isOpen()) return false;
|
||||
synchronized (myProblems) {
|
||||
if (!myProblems.isEmpty()) {
|
||||
@@ -363,34 +352,42 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasProblemFilesBeneath(final Module scope) {
|
||||
@Override
|
||||
public boolean hasProblemFilesBeneath(@NotNull final Module scope) {
|
||||
return hasProblemFilesBeneath(new Condition<VirtualFile>() {
|
||||
@Override
|
||||
public boolean value(final VirtualFile virtualFile) {
|
||||
return ModuleUtil.moduleContainsFile(scope, virtualFile, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addProblemListener(ProblemListener listener) {
|
||||
@Override
|
||||
public void addProblemListener(@NotNull ProblemListener listener) {
|
||||
myProblemListeners.add(listener);
|
||||
}
|
||||
|
||||
public void addProblemListener(final ProblemListener listener, Disposable parentDisposable) {
|
||||
@Override
|
||||
public void addProblemListener(@NotNull final ProblemListener listener, @NotNull Disposable parentDisposable) {
|
||||
addProblemListener(listener);
|
||||
Disposer.register(parentDisposable, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
removeProblemListener(listener);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeProblemListener(ProblemListener listener) {
|
||||
@Override
|
||||
public void removeProblemListener(@NotNull ProblemListener listener) {
|
||||
myProblemListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void registerFileHighlightFilter(final Condition<VirtualFile> filter, Disposable parentDisposable) {
|
||||
@Override
|
||||
public void registerFileHighlightFilter(@NotNull final Condition<VirtualFile> filter, @NotNull Disposable parentDisposable) {
|
||||
myFilters.add(filter);
|
||||
Disposer.register(parentDisposable, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
myFilters.remove(filter);
|
||||
}
|
||||
@@ -405,13 +402,14 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProblemFile(VirtualFile virtualFile) {
|
||||
synchronized (myProblems) {
|
||||
return myProblems.containsKey(virtualFile);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isToBeHighlighted(VirtualFile virtualFile) {
|
||||
private boolean isToBeHighlighted(@Nullable VirtualFile virtualFile) {
|
||||
if (virtualFile == null) return false;
|
||||
|
||||
synchronized (myFilters) {
|
||||
@@ -430,6 +428,7 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void weHaveGotProblems(@NotNull final VirtualFile virtualFile, @NotNull List<Problem> problems) {
|
||||
if (problems.isEmpty()) return;
|
||||
if (!isToBeHighlighted(virtualFile)) return;
|
||||
@@ -452,14 +451,19 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearProblems(@NotNull VirtualFile virtualFile) {
|
||||
doRemove(virtualFile);
|
||||
}
|
||||
|
||||
public Problem convertToProblem(final VirtualFile virtualFile, final HighlightSeverity severity,
|
||||
final TextRange textRange, final String messageText) {
|
||||
@Override
|
||||
public Problem convertToProblem(@Nullable final VirtualFile virtualFile,
|
||||
final HighlightSeverity severity,
|
||||
@NotNull final TextRange textRange,
|
||||
final String messageText) {
|
||||
if (virtualFile == null || textRange.getStartOffset() < 0 || textRange.getLength() < 0 ) return null;
|
||||
HighlightInfo info = ApplicationManager.getApplication().runReadAction(new Computable<HighlightInfo>() {
|
||||
@Override
|
||||
public HighlightInfo compute() {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfo.convertSeverity(severity), textRange, messageText);
|
||||
}
|
||||
@@ -467,9 +471,11 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
return new ProblemImpl(virtualFile, info, false);
|
||||
}
|
||||
|
||||
public Problem convertToProblem(final VirtualFile virtualFile, final int line, final int column, final String[] message) {
|
||||
@Override
|
||||
public Problem convertToProblem(@Nullable final VirtualFile virtualFile, final int line, final int column, @NotNull final String[] message) {
|
||||
if (virtualFile == null || virtualFile.isDirectory() || virtualFile.getFileType().isBinary()) return null;
|
||||
HighlightInfo info = ApplicationManager.getApplication().runReadAction(new Computable<HighlightInfo>() {
|
||||
@Override
|
||||
public HighlightInfo compute() {
|
||||
TextRange textRange = getTextRange(virtualFile, line, column);
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, textRange, StringUtil.join(message, "\n"));
|
||||
@@ -479,7 +485,8 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
return new ProblemImpl(virtualFile, info, false);
|
||||
}
|
||||
|
||||
public void reportProblems(final VirtualFile file, Collection<Problem> problems) {
|
||||
@Override
|
||||
public void reportProblems(@NotNull final VirtualFile file, @NotNull Collection<Problem> problems) {
|
||||
if (problems.isEmpty()) {
|
||||
clearProblems(file);
|
||||
return;
|
||||
@@ -510,7 +517,7 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static TextRange getTextRange(final VirtualFile virtualFile, int line, final int column) {
|
||||
private static TextRange getTextRange(@NotNull final VirtualFile virtualFile, int line, final int column) {
|
||||
Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
|
||||
if (line > document.getLineCount()) line = document.getLineCount();
|
||||
line = line <= 0 ? 0 : line - 1;
|
||||
|
||||
+4
-5
@@ -96,11 +96,10 @@ public class ChangeSignaturePassFactory extends AbstractProjectComponent impleme
|
||||
HighlightInfo info = null;
|
||||
if (myRange != null) {
|
||||
info = new HighlightInfo(new TextAttributes(null, null,
|
||||
myEditor.getColorsScheme().getAttributes(CodeInsightColors.WEAK_WARNING_ATTRIBUTES).getEffectColor(),
|
||||
null, Font.PLAIN),
|
||||
HighlightInfoType.INFORMATION, myRange.getStartOffset(), myRange.getEndOffset(),
|
||||
SIGNATURE_SHOULD_BE_POSSIBLY_CHANGED, SIGNATURE_SHOULD_BE_POSSIBLY_CHANGED,
|
||||
HighlightSeverity.INFORMATION, false, true, false);
|
||||
myEditor.getColorsScheme().getAttributes(CodeInsightColors.WEAK_WARNING_ATTRIBUTES).getEffectColor(),
|
||||
null, Font.PLAIN), null, HighlightInfoType.INFORMATION,
|
||||
myRange.getStartOffset(), myRange.getEndOffset(), SIGNATURE_SHOULD_BE_POSSIBLY_CHANGED,
|
||||
SIGNATURE_SHOULD_BE_POSSIBLY_CHANGED, HighlightSeverity.INFORMATION, false, true, false);
|
||||
final ArrayList<IntentionAction> options = new ArrayList<IntentionAction>();
|
||||
options.add(new DismissNewSignatureIntentionAction());
|
||||
QuickFixAction.registerQuickFixAction(info, new ChangeSignatureDetectorAction(), options, null);
|
||||
|
||||
@@ -110,7 +110,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
|
||||
DocumentBulkUpdateListener bulkUpdateListener = new DocumentBulkUpdateListener() {
|
||||
@Override
|
||||
public void updateStarted(@NotNull Document doc) {
|
||||
if (doc != myEditor.getDocument() && myOffset >= doc.getTextLength() || savedBeforeBulkCaretMarker != null) return;
|
||||
if (doc != myEditor.getDocument() || myOffset >= doc.getTextLength() || savedBeforeBulkCaretMarker != null) return;
|
||||
savedBeforeBulkCaretMarker = doc.createRangeMarker(myOffset, myOffset);
|
||||
}
|
||||
@Override
|
||||
|
||||
+3
-2
@@ -35,8 +35,9 @@ public class RangeHighlighterTree extends RangeMarkerTree<RangeHighlighterEx> {
|
||||
protected int compareEqualStartIntervals(@NotNull IntervalNode<RangeHighlighterEx> i1, @NotNull IntervalNode<RangeHighlighterEx> i2) {
|
||||
RHNode o1 = (RHNode)i1;
|
||||
RHNode o2 = (RHNode)i2;
|
||||
if (o1.myLayer != o2.myLayer) {
|
||||
return o2.myLayer - o1.myLayer;
|
||||
int d = o2.myLayer - o1.myLayer;
|
||||
if (d != 0) {
|
||||
return d;
|
||||
}
|
||||
return super.compareEqualStartIntervals(i1, i2);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface ModuleFileIndex extends FileIndex {
|
||||
* it does not belong to any order entry.
|
||||
*/
|
||||
@Nullable
|
||||
OrderEntry getOrderEntryForFile(VirtualFile fileOrDir);
|
||||
OrderEntry getOrderEntryForFile(@NotNull VirtualFile fileOrDir);
|
||||
|
||||
/**
|
||||
* Returns the list of all order entries to which the specified file or directory
|
||||
@@ -45,5 +45,5 @@ public interface ModuleFileIndex extends FileIndex {
|
||||
* @param fileOrDir the file or directory to check.
|
||||
* @return the list of order entries to which the file or directory belongs.
|
||||
*/
|
||||
@NotNull List<OrderEntry> getOrderEntriesForFile(VirtualFile fileOrDir);
|
||||
@NotNull List<OrderEntry> getOrderEntriesForFile(@NotNull VirtualFile fileOrDir);
|
||||
}
|
||||
|
||||
+9
@@ -47,6 +47,7 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
|
||||
myExclusionManager = ProjectFileExclusionManager.SERVICE.getInstance(module.getProject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean iterateContent(@NotNull ContentIterator iterator) {
|
||||
VirtualFile[] contentRoots = ModuleRootManager.getInstance(myModule).getContentRoots();
|
||||
for (VirtualFile contentRoot : contentRoots) {
|
||||
@@ -63,16 +64,19 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean iterateContentUnderDirectory(@NotNull VirtualFile dir, @NotNull ContentIterator iterator) {
|
||||
return FileIndexImplUtil.iterateRecursively(dir, myContentFilter, iterator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isContentSourceFile(@NotNull VirtualFile file) {
|
||||
return !file.isDirectory()
|
||||
&& !myFileTypeRegistry.isFileIgnored(file)
|
||||
&& isInSourceContent(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInContent(@NotNull VirtualFile fileOrDir) {
|
||||
if (fileOrDir.isDirectory()) {
|
||||
DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(fileOrDir);
|
||||
@@ -84,6 +88,7 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInSourceContent(@NotNull VirtualFile fileOrDir) {
|
||||
if (fileOrDir.isDirectory()) {
|
||||
DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(fileOrDir);
|
||||
@@ -95,6 +100,7 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<OrderEntry> getOrderEntriesForFile(@NotNull VirtualFile fileOrDir) {
|
||||
VirtualFile dir = fileOrDir.isDirectory() ? fileOrDir : fileOrDir.getParent();
|
||||
@@ -122,6 +128,7 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
|
||||
return answer == null ? Collections.<OrderEntry>emptyList() : answer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderEntry getOrderEntryForFile(@NotNull VirtualFile fileOrDir) {
|
||||
VirtualFile dir = fileOrDir.isDirectory() ? fileOrDir : fileOrDir.getParent();
|
||||
if (dir == null) return null;
|
||||
@@ -136,6 +143,7 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTestSourceContent(@NotNull VirtualFile fileOrDir) {
|
||||
if (fileOrDir.isDirectory()) {
|
||||
DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(fileOrDir);
|
||||
@@ -148,6 +156,7 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
|
||||
}
|
||||
|
||||
private class ContentFilter implements VirtualFileFilter {
|
||||
@Override
|
||||
public boolean accept(@NotNull VirtualFile file) {
|
||||
if (file.isDirectory()) {
|
||||
DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(file);
|
||||
|
||||
+1
-1
@@ -220,7 +220,7 @@ public class XmlTagTreeHighlightingPass extends TextEditorHighlightingPass {
|
||||
|
||||
@NotNull
|
||||
private static HighlightInfo createHighlightInfo(Color color, @NotNull TextRange range) {
|
||||
return new HighlightInfo(new TextAttributes(null, color, null, null, Font.PLAIN), TYPE, range.getStartOffset(),
|
||||
return new HighlightInfo(new TextAttributes(null, color, null, null, Font.PLAIN), null, TYPE, range.getStartOffset(),
|
||||
range.getEndOffset(), null, null, HighlightSeverity.INFORMATION, false, null, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user