本文整理汇总了Java中com.intellij.execution.stacktrace.StackTraceLine类的典型用法代码示例。如果您正苦于以下问题:Java StackTraceLine类的具体用法?Java StackTraceLine怎么用?Java StackTraceLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StackTraceLine类属于com.intellij.execution.stacktrace包,在下文中一共展示了StackTraceLine类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getErrorNavigatable
import com.intellij.execution.stacktrace.StackTraceLine; //导入依赖的package包/类
@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;
}
示例2: getLocation
import com.intellij.execution.stacktrace.StackTraceLine; //导入依赖的package包/类
@Nullable
@Override
public Location getLocation(@NotNull Project project, @NotNull GlobalSearchScope searchScope) {
if (getLocationUrl() != null) {
if (isDefect() && myStacktrace != null) {
final String[] stackTrace = new LineTokenizer(myStacktrace).execute();
for (String aStackTrace : stackTrace) {
final StackTraceLine line = new StackTraceLine(project, aStackTrace);
if (getName().equals(line.getMethodName()) && StringUtil.equals(myClassName, line.getClassName())) {
return line.getMethodLocation(project);
}
}
}
}
return super.getLocation(project, searchScope);
}
示例3: getDescriptor
import com.intellij.execution.stacktrace.StackTraceLine; //导入依赖的package包/类
public Navigatable getDescriptor(final Location<?> location) {
if (location == null) return super.getDescriptor(location);
//navigate to the first stack trace
final String[] stackTrace = new LineTokenizer(myStackTraces.get(0)).execute();
final PsiLocation<?> psiLocation = location.toPsiLocation();
final PsiClass containingClass = psiLocation.getParentElement(PsiClass.class);
if (containingClass == null) return super.getDescriptor(location);
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 super.getDescriptor(location);
final String qualifiedName = containingClass.getQualifiedName();
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()) :
super.getDescriptor(location);
}
示例4: getStackTraceErrorNavigatable
import com.intellij.execution.stacktrace.StackTraceLine; //导入依赖的package包/类
@Nullable
public static Navigatable getStackTraceErrorNavigatable(@NotNull Location<?> location, @NotNull String stacktrace)
{
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;
final String[] stackTrace = new LineTokenizer(stacktrace).execute();
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;
}