use of com.intellij.openapi.diff.LineTokenizer in project intellij-community by JetBrains.
the class JavaAwareTestConsoleProperties method getErrorNavigatable.
@Nullable
@Override
public Navigatable getErrorNavigatable(@NotNull Location<?> location, @NotNull String stacktrace) {
//navigate to the first stack trace
final String[] stackTrace = new LineTokenizer(stacktrace).execute();
final PsiLocation<?> psiLocation = location.toPsiLocation();
final PsiClass containingClass = psiLocation.getParentElement(PsiClass.class);
if (containingClass == null)
return null;
final String qualifiedName = containingClass.getQualifiedName();
if (qualifiedName == null)
return null;
String containingMethod = null;
for (Iterator<Location<PsiMethod>> iterator = psiLocation.getAncestors(PsiMethod.class, false); iterator.hasNext(); ) {
final PsiMethod psiMethod = iterator.next().getPsiElement();
if (containingClass.equals(psiMethod.getContainingClass()))
containingMethod = psiMethod.getName();
}
if (containingMethod == null)
return null;
StackTraceLine lastLine = null;
for (String aStackTrace : stackTrace) {
final StackTraceLine line = new StackTraceLine(containingClass.getProject(), aStackTrace);
if (containingMethod.equals(line.getMethodName()) && qualifiedName.equals(line.getClassName())) {
lastLine = line;
break;
}
}
return lastLine != null ? lastLine.getOpenFileDescriptor(containingClass.getContainingFile().getVirtualFile()) : null;
}
use of com.intellij.openapi.diff.LineTokenizer in project intellij-community by JetBrains.
the class AbstractVcsTestCase method verify.
private static void verify(final ProcessOutput runResult, final boolean sorted, final String... stdoutLines) {
verify(runResult);
final String[] lines = new LineTokenizer(runResult.getStdout()).execute();
if (sorted) {
Arrays.sort(lines);
}
Assert.assertEquals(runResult.getStdout(), stdoutLines.length, lines.length);
for (int i = 0; i < stdoutLines.length; i++) {
Assert.assertEquals(stdoutLines[i], compressWhitespace(lines[i]));
}
}
Aggregations