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


Java ASTNodes.getEnclosingType方法代码示例

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


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

示例1: getReceiver

import org.eclipse.jdt.internal.corext.dom.ASTNodes; //导入方法依赖的package包/类
private String getReceiver(
    CallContext context, int modifiers, ImportRewriteContext importRewriteContext) {
  String receiver = context.receiver;
  ITypeBinding invocationType = ASTNodes.getEnclosingType(context.invocation);
  ITypeBinding sourceType = fDeclaration.resolveBinding().getDeclaringClass();
  if (!context.receiverIsStatic && Modifier.isStatic(modifiers)) {
    if ("this".equals(receiver)
        && invocationType != null
        && Bindings.equals(invocationType, sourceType)) { // $NON-NLS-1$
      receiver = null;
    } else {
      receiver = context.importer.addImport(sourceType, importRewriteContext);
    }
  }
  return receiver;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:SourceProvider.java

示例2: initializeDestinations

import org.eclipse.jdt.internal.corext.dom.ASTNodes; //导入方法依赖的package包/类
private void initializeDestinations() {
  List<ASTNode> result = new ArrayList<ASTNode>();
  BodyDeclaration decl = fAnalyzer.getEnclosingBodyDeclaration();
  ASTNode current = ASTResolving.findParentType(decl.getParent());
  if (fAnalyzer.isValidDestination(current)) {
    result.add(current);
  }
  if (current != null
      && (decl instanceof MethodDeclaration
          || decl instanceof Initializer
          || decl instanceof FieldDeclaration)) {
    ITypeBinding binding = ASTNodes.getEnclosingType(current);
    ASTNode next = ASTResolving.findParentType(current.getParent());
    while (next != null && binding != null && binding.isNested()) {
      if (fAnalyzer.isValidDestination(next)) {
        result.add(next);
      }
      current = next;
      binding = ASTNodes.getEnclosingType(current);
      next = ASTResolving.findParentType(next.getParent());
    }
  }
  fDestinations = result.toArray(new ASTNode[result.size()]);
  fDestination = fDestinations[fDestinationIndex];
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ExtractMethodRefactoring.java

示例3: checkInput

import org.eclipse.jdt.internal.corext.dom.ASTNodes; //导入方法依赖的package包/类
public void checkInput(RefactoringStatus status, String methodName, ASTNode destination) {
  ITypeBinding[] arguments = getArgumentTypes();
  ITypeBinding type = ASTNodes.getEnclosingType(destination);
  status.merge(Checks.checkMethodInType(type, methodName, arguments));
  ITypeBinding superClass = type.getSuperclass();
  if (superClass != null) {
    status.merge(Checks.checkMethodInHierarchy(superClass, methodName, null, arguments));
  }
  for (ITypeBinding superInterface : type.getInterfaces()) {
    status.merge(Checks.checkMethodInHierarchy(superInterface, methodName, null, arguments));
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:ExtractMethodAnalyzer.java


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