当前位置: 首页>>代码示例>>Java>>正文


Java StackTraceLine类代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:JavaAwareTestConsoleProperties.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GradleSMTestProxy.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FaultyState.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:41,代码来源:JavaAwareTestConsoleProperties.java


注:本文中的com.intellij.execution.stacktrace.StackTraceLine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。