mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+5
-6
@@ -74,17 +74,16 @@ public class ExceptionExFilterFactory implements ExceptionFilterFactory {
|
||||
final int lineStartOffset = copiedFragment.getLineStartOffset(i);
|
||||
final int lineEndOffset = copiedFragment.getLineEndOffset(i);
|
||||
|
||||
String text = copiedFragment.getText(new TextRange(lineStartOffset, lineEndOffset));
|
||||
if (!text.contains(".java:")) continue;
|
||||
Trinity<TextRange, TextRange, TextRange> info = visited.get(text);
|
||||
String lineText = copiedFragment.getText(new TextRange(lineStartOffset, lineEndOffset));
|
||||
if (!lineText.contains(".java:")) continue;
|
||||
Trinity<TextRange, TextRange, TextRange> info = visited.get(lineText);
|
||||
if (info == emptyInfo) continue;
|
||||
|
||||
if (info == null) {
|
||||
info = emptyInfo;
|
||||
AccessToken token = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
try {
|
||||
worker.execute(text, lineEndOffset);
|
||||
Result result = worker.getResult();
|
||||
Result result = worker.execute(lineText, lineEndOffset);
|
||||
if (result == null) continue;
|
||||
HyperlinkInfo hyperlinkInfo = result.getHyperlinkInfo();
|
||||
if (!(hyperlinkInfo instanceof FileHyperlinkInfo)) continue;
|
||||
@@ -105,7 +104,7 @@ public class ExceptionExFilterFactory implements ExceptionFilterFactory {
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
visited.put(text, info);
|
||||
visited.put(lineText, info);
|
||||
}
|
||||
}
|
||||
int off = startOffset + lineStartOffset;
|
||||
|
||||
@@ -26,9 +26,9 @@ public class ExceptionFilter implements Filter, DumbAware {
|
||||
myCache = new ExceptionInfoCache(scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result applyFilter(final String line, final int textEndOffset) {
|
||||
ExceptionWorker worker = new ExceptionWorker(myCache);
|
||||
worker.execute(line, textEndOffset);
|
||||
return worker.getResult();
|
||||
return worker.execute(line, textEndOffset);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-7
@@ -106,12 +106,8 @@ public class VcsContentAnnotationExceptionFilter implements Filter, FilterMixin
|
||||
final int lineStartOffset = copiedFragment.getLineStartOffset(i);
|
||||
final int lineEndOffset = copiedFragment.getLineEndOffset(i);
|
||||
final ExceptionWorker worker = new ExceptionWorker(myCache);
|
||||
final String[] lineText = new String[1];
|
||||
ApplicationManager.getApplication().runReadAction(() -> {
|
||||
lineText[0] = copiedFragment.getText(new TextRange(lineStartOffset, lineEndOffset));
|
||||
worker.execute(lineText[0], lineEndOffset);
|
||||
});
|
||||
if (worker.getResult() != null) {
|
||||
final String lineText = copiedFragment.getText(new TextRange(lineStartOffset, lineEndOffset));
|
||||
if (ApplicationManager.getApplication().runReadAction((Computable<Result>)() -> worker.execute(lineText, lineEndOffset)) != null) {
|
||||
VirtualFile vf = worker.getFile().getVirtualFile();
|
||||
if (vf.getFileSystem().isReadOnly()) continue;
|
||||
|
||||
@@ -133,7 +129,7 @@ public class VcsContentAnnotationExceptionFilter implements Filter, FilterMixin
|
||||
if (document == null) return;
|
||||
|
||||
int startFileOffset = worker.getInfo().getThird().getStartOffset();
|
||||
int idx = lineText[0].indexOf(':', startFileOffset);
|
||||
int idx = lineText.indexOf(':', startFileOffset);
|
||||
int endIdx = idx == -1 ? worker.getInfo().getThird().getEndOffset() : idx;
|
||||
consumer.consume(new MyAdditionalHighlight(startOffset + lineStartOffset + startFileOffset + 1, startOffset + lineStartOffset + endIdx));
|
||||
|
||||
|
||||
@@ -61,11 +61,11 @@ public class ExceptionWorker {
|
||||
myCache = cache;
|
||||
}
|
||||
|
||||
public void execute(final String line, final int textEndOffset) {
|
||||
public Filter.Result execute(final String line, final int textEndOffset) {
|
||||
myResult = null;
|
||||
myInfo = parseExceptionLine(line);
|
||||
if (myInfo == null) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
myMethod = myInfo.getSecond().substring(line);
|
||||
@@ -75,10 +75,10 @@ public class ExceptionWorker {
|
||||
final String fileAndLine = line.substring(lparenthIndex + 1, rparenthIndex).trim();
|
||||
|
||||
final int colonIndex = fileAndLine.lastIndexOf(':');
|
||||
if (colonIndex < 0) return;
|
||||
if (colonIndex < 0) return null;
|
||||
|
||||
final int lineNumber = getLineNumber(fileAndLine.substring(colonIndex + 1));
|
||||
if (lineNumber < 0) return;
|
||||
if (lineNumber < 0) return null;
|
||||
|
||||
Pair<PsiClass[], PsiFile[]> pair = myCache.resolveClass(myInfo.first.substring(line).trim());
|
||||
myClasses = pair.first;
|
||||
@@ -88,7 +88,7 @@ public class ExceptionWorker {
|
||||
//todo[nik] it would be better to use FilenameIndex here to honor the scope by it isn't accessible in Open API
|
||||
myFiles = PsiShortNamesCache.getInstance(myProject).getFilesByName(fileAndLine.substring(0, colonIndex).trim());
|
||||
}
|
||||
if (myFiles.length == 0) return;
|
||||
if (myFiles.length == 0) return null;
|
||||
|
||||
/*
|
||||
IDEADEV-4976: Some scramblers put something like SourceFile mock instead of real class name.
|
||||
@@ -130,7 +130,9 @@ public class ExceptionWorker {
|
||||
virtualFiles = virtualFilesInContent;
|
||||
}
|
||||
HyperlinkInfo linkInfo = HyperlinkInfoFactory.getInstance().createMultipleFilesHyperlinkInfo(virtualFiles, lineNumber - 1, myProject);
|
||||
myResult = new Filter.Result(highlightStartOffset, highlightEndOffset, linkInfo, attributes);
|
||||
Filter.Result result = new Filter.Result(highlightStartOffset, highlightEndOffset, linkInfo, attributes);
|
||||
myResult = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int getLineNumber(String lineString) {
|
||||
|
||||
Reference in New Issue
Block a user