當前位置: 首頁>>代碼示例>>Java>>正文


Java VariableDeclarationFragment.NAME_PROPERTY屬性代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.dom.VariableDeclarationFragment.NAME_PROPERTY屬性的典型用法代碼示例。如果您正苦於以下問題:Java VariableDeclarationFragment.NAME_PROPERTY屬性的具體用法?Java VariableDeclarationFragment.NAME_PROPERTY怎麽用?Java VariableDeclarationFragment.NAME_PROPERTY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.eclipse.jdt.core.dom.VariableDeclarationFragment的用法示例。


在下文中一共展示了VariableDeclarationFragment.NAME_PROPERTY屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleSimpleName

private void handleSimpleName(SimpleName node) {
  ASTNode firstExpression = node.getParent();
  if (firstExpression instanceof FieldAccess) {
    while (firstExpression instanceof FieldAccess) {
      firstExpression = ((FieldAccess) firstExpression).getExpression();
    }
    if (!(firstExpression instanceof SimpleName)) return;

    node = (SimpleName) firstExpression;
  } else if (firstExpression instanceof SuperFieldAccess) return;

  StructuralPropertyDescriptor parentDescription = node.getLocationInParent();
  if (parentDescription == VariableDeclarationFragment.NAME_PROPERTY
      || parentDescription == SwitchCase.EXPRESSION_PROPERTY) return;

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

  handleVariable(node, (IVariableBinding) binding);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:20,代碼來源:CodeStyleFix.java

示例2: getDeclaringNode

private static ASTNode getDeclaringNode(ASTNode selectedNode) {
  ASTNode declaringNode = null;
  if (selectedNode instanceof MethodDeclaration) {
    declaringNode = selectedNode;
  } else if (selectedNode instanceof SimpleName) {
    StructuralPropertyDescriptor locationInParent = selectedNode.getLocationInParent();
    if (locationInParent == MethodDeclaration.NAME_PROPERTY
        || locationInParent == TypeDeclaration.NAME_PROPERTY) {
      declaringNode = selectedNode.getParent();
    } else if (locationInParent == VariableDeclarationFragment.NAME_PROPERTY) {
      declaringNode = selectedNode.getParent().getParent();
    }
  }
  return declaringNode;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:15,代碼來源:Java50Fix.java

示例3: visit

@Override
public boolean visit(SimpleName node) {
  addReferencesToName(node);
  IBinding binding = node.resolveBinding();
  if (binding instanceof ITypeBinding) {
    ITypeBinding type = (ITypeBinding) binding;
    if (type.isTypeVariable()) {
      addTypeVariableReference(type, node);
    }
  } else if (binding instanceof IVariableBinding) {
    IVariableBinding vb = (IVariableBinding) binding;
    if (vb.isField() && !isStaticallyImported(node)) {
      Name topName = ASTNodes.getTopMostName(node);
      if (node == topName || node == ASTNodes.getLeftMostSimpleName(topName)) {
        StructuralPropertyDescriptor location = node.getLocationInParent();
        if (location != SingleVariableDeclaration.NAME_PROPERTY
            && location != VariableDeclarationFragment.NAME_PROPERTY) {
          fImplicitReceivers.add(node);
        }
      }
    } else if (!vb.isField()) {
      // we have a local. Check if it is a parameter.
      ParameterData data = fParameters.get(binding);
      if (data != null) {
        ASTNode parent = node.getParent();
        if (parent instanceof Expression) {
          int precedence = OperatorPrecedence.getExpressionPrecedence((Expression) parent);
          if (precedence != Integer.MAX_VALUE) {
            data.setOperatorPrecedence(precedence);
          }
        }
      }
    }
  }
  return true;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:36,代碼來源:SourceAnalyzer.java

示例4: consumes

@Override
public boolean consumes(SemanticToken token) {
  SimpleName node = token.getNode();
  StructuralPropertyDescriptor location = node.getLocationInParent();
  if (location == VariableDeclarationFragment.NAME_PROPERTY
      || location == SingleVariableDeclaration.NAME_PROPERTY) {
    ASTNode parent = node.getParent();
    if (parent instanceof VariableDeclaration) {
      parent = parent.getParent();
      return parent == null || !(parent instanceof FieldDeclaration);
    }
  }
  return false;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:14,代碼來源:SemanticHighlightings.java


注:本文中的org.eclipse.jdt.core.dom.VariableDeclarationFragment.NAME_PROPERTY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。