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


Java SourcePosition.createFromElement方法代码示例

本文整理汇总了Java中com.intellij.debugger.SourcePosition.createFromElement方法的典型用法代码示例。如果您正苦于以下问题:Java SourcePosition.createFromElement方法的具体用法?Java SourcePosition.createFromElement怎么用?Java SourcePosition.createFromElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.debugger.SourcePosition的用法示例。


在下文中一共展示了SourcePosition.createFromElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LambdaMethodFilter

import com.intellij.debugger.SourcePosition; //导入方法依赖的package包/类
public LambdaMethodFilter(PsiLambdaExpression lambda, int expressionOrdinal, Range<Integer> callingExpressionLines) {
  myLambdaOrdinal = expressionOrdinal;
  myCallingExpressionLines = callingExpressionLines;

  SourcePosition firstStatementPosition = null;
  SourcePosition lastStatementPosition = null;
  final PsiElement body = lambda.getBody();
  if (body instanceof PsiCodeBlock) {
    final PsiStatement[] statements = ((PsiCodeBlock)body).getStatements();
    if (statements.length > 0) {
      firstStatementPosition = SourcePosition.createFromElement(statements[0]);
      if (firstStatementPosition != null) {
        final PsiStatement lastStatement = statements[statements.length - 1];
        lastStatementPosition =
          SourcePosition.createFromOffset(firstStatementPosition.getFile(), lastStatement.getTextRange().getEndOffset());
      }
    }
  }
  else if (body != null) {
    firstStatementPosition = SourcePosition.createFromElement(body);
  }
  myFirstStatementPosition = firstStatementPosition;
  myLastStatementLine = lastStatementPosition != null ? lastStatementPosition.getLine() : -1;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:LambdaMethodFilter.java

示例2: AnonymousClassMethodFilter

import com.intellij.debugger.SourcePosition; //导入方法依赖的package包/类
public AnonymousClassMethodFilter(PsiMethod psiMethod, Range<Integer> lines) {
  super(psiMethod, lines);
  SourcePosition firstStatementPosition = null;
  SourcePosition lastStatementPosition = null;
  final PsiCodeBlock body = psiMethod.getBody();
  if (body != null) {
    final PsiStatement[] statements = body.getStatements();
    if (statements.length > 0) {
      firstStatementPosition = SourcePosition.createFromElement(statements[0]);
      if (firstStatementPosition != null) {
        final PsiStatement lastStatement = statements[statements.length - 1];
        lastStatementPosition = SourcePosition.createFromOffset(firstStatementPosition.getFile(), lastStatement.getTextRange().getEndOffset());
      }
    }
  }
  myBreakpointPosition = firstStatementPosition;
  myLastStatementLine = lastStatementPosition != null? lastStatementPosition.getLine() : -1;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AnonymousClassMethodFilter.java

示例3: getSourcePositionForLocalVariable

import com.intellij.debugger.SourcePosition; //导入方法依赖的package包/类
@Nullable
protected SourcePosition getSourcePositionForLocalVariable(String name,
                                                           @NotNull Project project,
                                                           @NotNull DebuggerContextImpl context,
                                                           boolean nearest) {
  PsiElement place = PositionUtil.getContextElement(context);
  if (place == null) return null;

  PsiVariable psiVariable = JavaPsiFacade.getInstance(project).getResolveHelper().resolveReferencedVariable(name, place);
  if (psiVariable == null) return null;

  PsiFile containingFile = psiVariable.getContainingFile();
  if(containingFile == null) return null;
  if (nearest) {
    return DebuggerContextUtil.findNearest(context, psiVariable, containingFile);
  }
  return SourcePosition.createFromElement(psiVariable);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DefaultSourcePositionProvider.java

示例4: getJVMQualifiedName

import com.intellij.debugger.SourcePosition; //导入方法依赖的package包/类
public static JVMName getJVMQualifiedName(@NotNull PsiClass psiClass) {
  final String name = getNonAnonymousClassName(psiClass);
  if (name != null) {
    return getJVMRawText(name);
  }
  else {
    return new JVMClassAt(SourcePosition.createFromElement(psiClass));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JVMNameUtil.java


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