use of com.intellij.execution.filters.FileHyperlinkInfo in project intellij-community by JetBrains.
the class AnnotateStackTraceAction method getHyperlinkVirtualFile.
@Nullable
@CalledWithReadLock
private static VirtualFile getHyperlinkVirtualFile(@NotNull List<RangeHighlighter> links) {
RangeHighlighter key = ContainerUtil.getLastItem(links);
if (key == null)
return null;
HyperlinkInfo info = EditorHyperlinkSupport.getHyperlinkInfo(key);
if (!(info instanceof FileHyperlinkInfo))
return null;
OpenFileDescriptor descriptor = ((FileHyperlinkInfo) info).getDescriptor();
return descriptor != null ? descriptor.getFile() : null;
}
use of com.intellij.execution.filters.FileHyperlinkInfo in project intellij-community by JetBrains.
the class SMTRunnerConsoleProperties method getErrorNavigatable.
@Nullable
@Override
public Navigatable getErrorNavigatable(@NotNull final Project project, @NotNull final String stacktrace) {
if (myCustomFilter.isEmpty()) {
return null;
}
// iterate stacktrace lines find first navigatable line using
// stacktrace filters
final int stacktraceLength = stacktrace.length();
final String[] lines = StringUtil.splitByLines(stacktrace);
for (String line : lines) {
Filter.Result result;
try {
result = myCustomFilter.applyFilter(line, stacktraceLength);
} catch (Throwable t) {
throw new RuntimeException("Error while applying " + myCustomFilter + " to '" + line + "'", t);
}
final HyperlinkInfo info = result != null ? result.getFirstHyperlinkInfo() : null;
if (info != null) {
// covers 99% use existing cases
if (info instanceof FileHyperlinkInfo) {
return ((FileHyperlinkInfo) info).getDescriptor();
}
// otherwise
return new Navigatable() {
@Override
public void navigate(boolean requestFocus) {
info.navigate(project);
}
@Override
public boolean canNavigate() {
return true;
}
@Override
public boolean canNavigateToSource() {
return true;
}
};
}
}
return null;
}
Aggregations