• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ASTResolving类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jdt.internal.ui.text.correction.ASTResolving的典型用法代码示例。如果您正苦于以下问题:Java ASTResolving类的具体用法?Java ASTResolving怎么用?Java ASTResolving使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ASTResolving类属于org.eclipse.jdt.internal.ui.text.correction包,在下文中一共展示了ASTResolving类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCatchBodyContent

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
public static String getCatchBodyContent(
    ICompilationUnit cu,
    String exceptionType,
    String variableName,
    ASTNode locationInAST,
    String lineDelimiter)
    throws CoreException {
  String enclosingType = ""; // $NON-NLS-1$
  String enclosingMethod = ""; // $NON-NLS-1$

  if (locationInAST != null) {
    MethodDeclaration parentMethod = ASTResolving.findParentMethodDeclaration(locationInAST);
    if (parentMethod != null) {
      enclosingMethod = parentMethod.getName().getIdentifier();
      locationInAST = parentMethod;
    }
    ASTNode parentType = ASTResolving.findParentType(locationInAST);
    if (parentType instanceof AbstractTypeDeclaration) {
      enclosingType = ((AbstractTypeDeclaration) parentType).getName().getIdentifier();
    }
  }
  return getCatchBodyContent(
      cu, exceptionType, variableName, enclosingType, enclosingMethod, lineDelimiter);
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:StubUtility.java


示例2: visit

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean visit(SimpleName node) {
  if (node.getParent() instanceof VariableDeclarationFragment) return super.visit(node);
  if (node.getParent() instanceof SingleVariableDeclaration) return super.visit(node);

  IBinding binding = node.resolveBinding();
  if (!(binding instanceof IVariableBinding)) return super.visit(node);

  binding = ((IVariableBinding) binding).getVariableDeclaration();
  if (ASTResolving.isWriteAccess(node)) {
    List<SimpleName> list;
    if (fResult.containsKey(binding)) {
      list = fResult.get(binding);
    } else {
      list = new ArrayList<SimpleName>();
    }
    list.add(node);
    fResult.put(binding, list);
  }

  return super.visit(node);
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:VariableDeclarationFix.java


示例3: findCUForMethod

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
private static CompilationUnit findCUForMethod(
    CompilationUnit compilationUnit, ICompilationUnit cu, IMethodBinding methodBinding) {
  ASTNode methodDecl = compilationUnit.findDeclaringNode(methodBinding.getMethodDeclaration());
  if (methodDecl == null) {
    // is methodDecl defined in another CU?
    ITypeBinding declaringTypeDecl = methodBinding.getDeclaringClass().getTypeDeclaration();
    if (declaringTypeDecl.isFromSource()) {
      ICompilationUnit targetCU = null;
      try {
        targetCU =
            ASTResolving.findCompilationUnitForBinding(cu, compilationUnit, declaringTypeDecl);
      } catch (JavaModelException e) {
        /* can't do better */
      }
      if (targetCU != null) {
        return ASTResolving.createQuickFixAST(targetCU, null);
      }
    }
    return null;
  }
  return compilationUnit;
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:NullAnnotationsRewriteOperations.java


示例4: checkExpressionIsRValue

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
/**
 * @param e
 * @return int Checks.IS_RVALUE if e is an rvalue Checks.IS_RVALUE_GUESSED if e is guessed as an
 *     rvalue Checks.NOT_RVALUE_VOID if e is not an rvalue because its type is void
 *     Checks.NOT_RVALUE_MISC if e is not an rvalue for some other reason
 */
public static int checkExpressionIsRValue(Expression e) {
  if (e instanceof Name) {
    if (!(((Name) e).resolveBinding() instanceof IVariableBinding)) {
      return NOT_RVALUE_MISC;
    }
  }
  if (e instanceof Annotation) return NOT_RVALUE_MISC;

  ITypeBinding tb = e.resolveTypeBinding();
  boolean guessingRequired = false;
  if (tb == null) {
    guessingRequired = true;
    tb = ASTResolving.guessBindingForReference(e);
  }
  if (tb == null) return NOT_RVALUE_MISC;
  else if (tb.getName().equals("void")) // $NON-NLS-1$
  return NOT_RVALUE_VOID;

  return guessingRequired ? IS_RVALUE_GUESSED : IS_RVALUE;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:Checks.java


示例5: isVoidMethod

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
private boolean isVoidMethod() {
  ITypeBinding binding = null;
  LambdaExpression enclosingLambdaExpr =
      ASTResolving.findEnclosingLambdaExpression(getFirstSelectedNode());
  if (enclosingLambdaExpr != null) {
    IMethodBinding methodBinding = enclosingLambdaExpr.resolveMethodBinding();
    if (methodBinding != null) {
      binding = methodBinding.getReturnType();
    }
  } else {
    // if we have an initializer
    if (fEnclosingMethodBinding == null) return true;
    binding = fEnclosingMethodBinding.getReturnType();
  }
  if (fEnclosingBodyDeclaration
      .getAST()
      .resolveWellKnownType("void")
      .equals(binding)) // $NON-NLS-1$
  return true;
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:ExtractMethodAnalyzer.java


示例6: initializeDestinations

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的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


示例7: getRewrite

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
@Override
protected ASTRewrite getRewrite() throws CoreException {
  CompilationUnit cu = ASTResolving.findParentCompilationUnit(fOriginalNode);
  switch (fVariableKind) {
    case PARAM:
      return doAddParam(cu);
    case FIELD:
    case CONST_FIELD:
      return doAddField(cu);
    case LOCAL:
      return doAddLocal(cu);
    case ENUM_CONST:
      return doAddEnumConst(cu);
    default:
      throw new IllegalArgumentException(
          "Unsupported variable kind: " + fVariableKind); // $NON-NLS-1$
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:NewVariableCorrectionProposal.java


示例8: doAddField

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
private ASTRewrite doAddField(CompilationUnit astRoot) {
  SimpleName node = fOriginalNode;
  boolean isInDifferentCU = false;

  ASTNode newTypeDecl = astRoot.findDeclaringNode(fSenderBinding);
  if (newTypeDecl == null) {
    astRoot = ASTResolving.createQuickFixAST(getCompilationUnit(), null);
    newTypeDecl = astRoot.findDeclaringNode(fSenderBinding.getKey());
    isInDifferentCU = true;
  }
  ImportRewrite imports = createImportRewrite(astRoot);
  ImportRewriteContext importRewriteContext =
      new ContextSensitiveImportRewriteContext(
          ASTResolving.findParentBodyDeclaration(node), imports);

  if (newTypeDecl != null) {
    AST ast = newTypeDecl.getAST();

    ASTRewrite rewrite = ASTRewrite.create(ast);

    VariableDeclarationFragment fragment = ast.newVariableDeclarationFragment();
    fragment.setName(ast.newSimpleName(node.getIdentifier()));

    Type type = evaluateVariableType(ast, imports, importRewriteContext, fSenderBinding);

    FieldDeclaration newDecl = ast.newFieldDeclaration(fragment);
    newDecl.setType(type);
    newDecl
        .modifiers()
        .addAll(ASTNodeFactory.newModifiers(ast, evaluateFieldModifiers(newTypeDecl)));

    if (fSenderBinding.isInterface() || fVariableKind == CONST_FIELD) {
      fragment.setInitializer(ASTNodeFactory.newDefaultExpression(ast, type, 0));
    }

    ChildListPropertyDescriptor property = ASTNodes.getBodyDeclarationsProperty(newTypeDecl);
    List<BodyDeclaration> decls =
        ASTNodes.<BodyDeclaration>getChildListProperty(newTypeDecl, property);

    int maxOffset = isInDifferentCU ? -1 : node.getStartPosition();

    int insertIndex = findFieldInsertIndex(decls, newDecl, maxOffset);

    ListRewrite listRewriter = rewrite.getListRewrite(newTypeDecl, property);
    listRewriter.insertAt(newDecl, insertIndex, null);

    ModifierCorrectionSubProcessor.installLinkedVisibilityProposals(
        getLinkedProposalModel(), rewrite, newDecl.modifiers(), fSenderBinding.isInterface());

    addLinkedPosition(rewrite.track(newDecl.getType()), false, KEY_TYPE);
    if (!isInDifferentCU) {
      addLinkedPosition(rewrite.track(node), true, KEY_NAME);
    }
    addLinkedPosition(rewrite.track(fragment.getName()), false, KEY_NAME);

    if (fragment.getInitializer() != null) {
      addLinkedPosition(rewrite.track(fragment.getInitializer()), false, KEY_INITIALIZER);
    }
    return rewrite;
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:63,代码来源:NewVariableCorrectionProposal.java


示例9: AssignToVariableAssistProposal

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
public AssignToVariableAssistProposal(
    ICompilationUnit cu,
    int variableKind,
    ExpressionStatement node,
    ITypeBinding typeBinding,
    int relevance) {
  super("", cu, null, relevance, null); // $NON-NLS-1$

  fVariableKind = variableKind;
  fNodeToAssign = node;
  if (typeBinding.isWildcardType()) {
    typeBinding = ASTResolving.normalizeWildcardType(typeBinding, true, node.getAST());
  }

  fTypeBinding = typeBinding;
  if (variableKind == LOCAL) {
    setDisplayName(CorrectionMessages.AssignToVariableAssistProposal_assigntolocal_description);
    setImage(JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_LOCAL));
  } else {
    setDisplayName(CorrectionMessages.AssignToVariableAssistProposal_assigntofield_description);
    setImage(JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PRIVATE));
  }
  createImportRewrite((CompilationUnit) node.getRoot());
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:AssignToVariableAssistProposal.java


示例10: createProposalsForProblemOnAsyncType

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
public static List<IJavaCompletionProposal> createProposalsForProblemOnAsyncType(
    ASTNode problemNode, String extraSyncMethodBindingKey) {
  TypeDeclaration asyncTypeDecl = (TypeDeclaration) ASTResolving.findAncestor(
      problemNode, ASTNode.TYPE_DECLARATION);
  assert (asyncTypeDecl != null);

  IType syncType = RemoteServiceUtilities.findSyncType(asyncTypeDecl);
  if (syncType == null) {
    return null;
  }

  MethodDeclaration extraSyncMethodDecl = JavaASTUtils.findMethodDeclaration(
      syncType.getCompilationUnit(), extraSyncMethodBindingKey);
  if (extraSyncMethodDecl == null) {
    return null;
  }

  return Collections.<IJavaCompletionProposal> singletonList(new DeleteMethodProposal(
      syncType.getCompilationUnit(), extraSyncMethodDecl));
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:21,代码来源:DeleteMethodProposal.java


示例11: createProposalsForProblemOnSyncType

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
public static List<IJavaCompletionProposal> createProposalsForProblemOnSyncType(
    ASTNode problemNode, String extraAsyncMethodBindingKey) {
  TypeDeclaration syncTypeDecl = (TypeDeclaration) ASTResolving.findAncestor(
      problemNode, ASTNode.TYPE_DECLARATION);
  assert (syncTypeDecl != null);

  IType asyncType = RemoteServiceUtilities.findAsyncType(syncTypeDecl);
  if (asyncType == null) {
    return null;
  }

  MethodDeclaration extraAsyncMethodDecl = JavaASTUtils.findMethodDeclaration(
      asyncType.getCompilationUnit(), extraAsyncMethodBindingKey);
  if (extraAsyncMethodDecl == null) {
    return null;
  }

  return Collections.<IJavaCompletionProposal> singletonList(new DeleteMethodProposal(
      asyncType.getCompilationUnit(), extraAsyncMethodDecl));
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:21,代码来源:DeleteMethodProposal.java


示例12: getRewrite

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
@Override
protected ASTRewrite getRewrite() throws CoreException {
  CompilationUnit targetAstRoot = ASTResolving.createQuickFixAST(
      getCompilationUnit(), null);
  createImportRewrite(targetAstRoot);

  ASTRewrite rewrite = ASTRewrite.create(targetAstRoot.getAST());

  // Find the method declaration in the AST we just generated (the one that
  // the AST rewriter is hooked up to).
  MethodDeclaration rewriterAstMethodDecl = JavaASTUtils.findMethodDeclaration(
      targetAstRoot, methodDecl.resolveBinding().getKey());
  if (rewriterAstMethodDecl == null) {
    return null;
  }

  // Remove the extra method declaration
  rewrite.remove(rewriterAstMethodDecl, null);

  return rewrite;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:22,代码来源:DeleteMethodProposal.java


示例13: createProposalsForProblemOnAsyncType

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
public static List<IJavaCompletionProposal> createProposalsForProblemOnAsyncType(
    ICompilationUnit asyncCompilationUnit, ASTNode problemNode,
    String syncMethodBindingKey) {
  TypeDeclaration asyncTypeDecl = (TypeDeclaration) ASTResolving.findAncestor(
      problemNode, ASTNode.TYPE_DECLARATION);
  assert (asyncTypeDecl != null);
  String asyncQualifiedTypeName = asyncTypeDecl.resolveBinding().getQualifiedName();

  // Lookup the sync version of the interface
  IType syncType = RemoteServiceUtilities.findSyncType(asyncTypeDecl);
  if (syncType == null) {
    return Collections.emptyList();
  }

  MethodDeclaration syncMethodDecl = JavaASTUtils.findMethodDeclaration(
      syncType.getCompilationUnit(), syncMethodBindingKey);
  if (syncMethodDecl == null) {
    return Collections.emptyList();
  }

  return Collections.<IJavaCompletionProposal> singletonList(new CreateAsyncMethodProposal(
      asyncCompilationUnit, asyncQualifiedTypeName, syncMethodDecl));
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:CreateAsyncMethodProposal.java


示例14: createProposalsForProblemOnSyncMethod

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
public static List<IJavaCompletionProposal> createProposalsForProblemOnSyncMethod(
    ASTNode problemNode) {
  // Find the problematic sync method declaration and its declaring type
  MethodDeclaration syncMethodDecl = ASTResolving.findParentMethodDeclaration(problemNode);
  TypeDeclaration syncTypeDecl = (TypeDeclaration) ASTResolving.findAncestor(
      syncMethodDecl, ASTNode.TYPE_DECLARATION);
  assert (syncTypeDecl != null);

  // Lookup the async version of the interface
  IType asyncType = RemoteServiceUtilities.findAsyncType(syncTypeDecl);
  if (asyncType == null) {
    return Collections.emptyList();
  }

  return Collections.<IJavaCompletionProposal> singletonList(new CreateAsyncMethodProposal(
      asyncType.getCompilationUnit(), asyncType.getFullyQualifiedName('.'),
      syncMethodDecl));
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:19,代码来源:CreateAsyncMethodProposal.java


示例15: getRewrite

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
@Override
protected ASTRewrite getRewrite() {
  MethodDeclaration dstMethod = findBestUpdateMatch(rpcPair);

  CompilationUnit astRoot = ASTResolving.createQuickFixAST(
      getCompilationUnit(), null);
  createImportRewrite(astRoot);

  ASTRewrite rewrite = ASTRewrite.create(astRoot.getAST());

  MethodDeclaration rewriterDstMethod = JavaASTUtils.findMethodDeclaration(
      astRoot, dstMethod.resolveBinding().getKey());
  if (rewriterDstMethod == null) {
    return null;
  }

  MethodDeclaration newSignature = computeMethodSignature(rewrite.getAST(),
      rpcPair, rewriterDstMethod);

  rewrite.replace(rewriterDstMethod, newSignature, null);

  return rewrite;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:AbstractUpdateSignatureProposal.java


示例16: getRewrite

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
@Override
protected ASTRewrite getRewrite() {
  CompilationUnit targetAstRoot = ASTResolving.createQuickFixAST(
      getCompilationUnit(), null);
  createImportRewrite(targetAstRoot);

  // Find the target type declaration
  TypeDeclaration typeDecl = JavaASTUtils.findTypeDeclaration(targetAstRoot,
      targetQualifiedTypeName);
  if (typeDecl == null) {
    return null;
  }

  ASTRewrite rewrite = ASTRewrite.create(targetAstRoot.getAST());

  // Generate the new method declaration
  MethodDeclaration methodDecl = createMethodDeclaration(rewrite.getAST());

  // Add the new method declaration to the interface
  ChildListPropertyDescriptor property = ASTNodes.getBodyDeclarationsProperty(typeDecl);
  ListRewrite listRewriter = rewrite.getListRewrite(typeDecl, property);
  listRewriter.insertLast(methodDecl, null);

  return rewrite;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:26,代码来源:AbstractCreateMethodProposal.java


示例17: createProposalsForProblemOnAsyncMethod

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
public static List<IJavaCompletionProposal> createProposalsForProblemOnAsyncMethod(
    ASTNode problemNode) {
  // Find the problematic async method declaration and its declaring type
  MethodDeclaration asyncMethodDecl = ASTResolving.findParentMethodDeclaration(problemNode);
  TypeDeclaration asyncTypeDecl = (TypeDeclaration) ASTResolving.findAncestor(
      asyncMethodDecl, ASTNode.TYPE_DECLARATION);
  assert (asyncTypeDecl != null);

  // Lookup the sync version of the interface
  IType syncType = RemoteServiceUtilities.findSyncType(asyncTypeDecl);
  if (syncType == null) {
    return Collections.emptyList();
  }

  return Collections.<IJavaCompletionProposal> singletonList(new CreateSyncMethodProposal(
      syncType.getCompilationUnit(), syncType.getFullyQualifiedName('.'),
      asyncMethodDecl));
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:19,代码来源:CreateSyncMethodProposal.java


示例18: createProposalsForProblemOnSyncType

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
public static List<IJavaCompletionProposal> createProposalsForProblemOnSyncType(
    ICompilationUnit syncCompilationUnit, ASTNode problemNode,
    String asyncMethodBindingKey) {
  TypeDeclaration syncTypeDecl = (TypeDeclaration) ASTResolving.findAncestor(
      problemNode, ASTNode.TYPE_DECLARATION);
  assert (syncTypeDecl != null);
  String syncQualifiedTypeName = syncTypeDecl.resolveBinding().getQualifiedName();

  // Lookup the async version of the interface
  IType asyncType = RemoteServiceUtilities.findAsyncType(syncTypeDecl);
  if (asyncType == null) {
    return Collections.emptyList();
  }

  MethodDeclaration asyncMethodDecl = JavaASTUtils.findMethodDeclaration(
      asyncType.getCompilationUnit(), asyncMethodBindingKey);
  if (asyncMethodDecl == null) {
    return Collections.emptyList();
  }

  return Collections.<IJavaCompletionProposal> singletonList(new CreateSyncMethodProposal(
      syncCompilationUnit, syncQualifiedTypeName, asyncMethodDecl));
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:CreateSyncMethodProposal.java


示例19: checkExpressionIsRValue

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
/**
 * @param e
 * @return int
 *          Checks.IS_RVALUE			if e is an rvalue
 *          Checks.IS_RVALUE_GUESSED	if e is guessed as an rvalue
 *          Checks.NOT_RVALUE_VOID  	if e is not an rvalue because its type is void
 *          Checks.NOT_RVALUE_MISC  	if e is not an rvalue for some other reason
 */
public static int checkExpressionIsRValue(Expression e) {
	if (e instanceof Name) {
		if(!(((Name) e).resolveBinding() instanceof IVariableBinding)) {
			return NOT_RVALUE_MISC;
		}
	}
	if (e instanceof Annotation)
		return NOT_RVALUE_MISC;
		

	ITypeBinding tb= e.resolveTypeBinding();
	boolean guessingRequired= false;
	if (tb == null) {
		guessingRequired= true;
		tb= ASTResolving.guessBindingForReference(e);
	}
	if (tb == null)
		return NOT_RVALUE_MISC;
	else if (tb.getName().equals("void")) //$NON-NLS-1$
		return NOT_RVALUE_VOID;

	return guessingRequired ? IS_RVALUE_GUESSED : IS_RVALUE;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:Checks.java


示例20: isVoidMethod

import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; //导入依赖的package包/类
private boolean isVoidMethod() {
	ITypeBinding binding= null;
	LambdaExpression enclosingLambdaExpr= ASTResolving.findEnclosingLambdaExpression(getFirstSelectedNode());
	if (enclosingLambdaExpr != null) {
		IMethodBinding methodBinding= enclosingLambdaExpr.resolveMethodBinding();
		if (methodBinding != null) {
			binding= methodBinding.getReturnType();
		}
	} else {
		// if we have an initializer
		if (fEnclosingMethodBinding == null)
			return true;
		binding= fEnclosingMethodBinding.getReturnType();
	}
	if (fEnclosingBodyDeclaration.getAST().resolveWellKnownType("void").equals(binding)) //$NON-NLS-1$
		return true;
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:ExtractMethodAnalyzer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClassTreeNode类代码示例发布时间:2022-05-23
下一篇:
Java ImmutableList类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap