Examples of StructuralPropertyDescriptor


Examples of org.aspectj.org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

   */
  public final void remove(ASTNode node, TextEditGroup editGroup) {
    if (node == null) {
      throw new IllegalArgumentException();
    }
    StructuralPropertyDescriptor property= node.getLocationInParent();
    if (property.isChildListProperty()) {
      getListRewrite(node.getParent(), (ChildListPropertyDescriptor) property).remove(node, editGroup);
    } else {
      set(node.getParent(), property, null, editGroup);
    }
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

   */   
  public final void replace(ASTNode node, ASTNode replacement, TextEditGroup editGroup) {
    if (node == null) {
      throw new IllegalArgumentException();
    }
    StructuralPropertyDescriptor property= node.getLocationInParent();
    if (property.isChildListProperty()) {
      getListRewrite(node.getParent(), (ChildListPropertyDescriptor) property).replace(node, replacement, editGroup);
    } else {
      set(node.getParent(), property, replacement, editGroup);
    }
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

   *
   * @see #createAfter(IJavaElement)
   * @see #createBefore(IJavaElement)
   */
  protected void insertASTNode(ASTRewrite rewriter, ASTNode parent, ASTNode child) throws JavaModelException {
    StructuralPropertyDescriptor propertyDescriptor = getChildPropertyDescriptor(parent);
    if (propertyDescriptor instanceof ChildListPropertyDescriptor) {
      ChildListPropertyDescriptor childListPropertyDescriptor = (ChildListPropertyDescriptor) propertyDescriptor;
       ListRewrite rewrite = rewriter.getListRewrite(parent, childListPropertyDescriptor);
       switch (this.insertionPolicy) {
         case INSERT_BEFORE:
View Full Code Here

Examples of org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

  public final void remove(ASTNode node, TextEditGroup editGroup) {
    if (node == null) {
      throw new IllegalArgumentException();
    }

    StructuralPropertyDescriptor property;
    ASTNode parent;
    if (RewriteEventStore.isNewNode(node)) { // remove a new node, bug 164862
      PropertyLocation location= this.eventStore.getPropertyLocation(node, RewriteEventStore.NEW);
      if (location != null) {
        property= location.getProperty();
        parent= location.getParent();
      } else {
        throw new IllegalArgumentException("Node is not part of the rewriter's AST"); //$NON-NLS-1$
      }
    } else {
      property= node.getLocationInParent();
      parent= node.getParent();
    }

    if (property.isChildListProperty()) {
      getListRewrite(parent, (ChildListPropertyDescriptor) property).remove(node, editGroup);
    } else {
      set(parent, property, null, editGroup);
    }
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

  public final void replace(ASTNode node, ASTNode replacement, TextEditGroup editGroup) {
    if (node == null) {
      throw new IllegalArgumentException();
    }

    StructuralPropertyDescriptor property;
    ASTNode parent;
    if (RewriteEventStore.isNewNode(node)) { // replace a new node, bug 164862
      PropertyLocation location= this.eventStore.getPropertyLocation(node, RewriteEventStore.NEW);
      if (location != null) {
        property= location.getProperty();
        parent= location.getParent();
      } else {
        throw new IllegalArgumentException("Node is not part of the rewriter's AST"); //$NON-NLS-1$
      }
    } else {
      property= node.getLocationInParent();
      parent= node.getParent();
    }

    if (property.isChildListProperty()) {
      getListRewrite(parent, (ChildListPropertyDescriptor) property).replace(node, replacement, editGroup);
    } else {
      set(parent, property, replacement, editGroup);
    }
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

     *
     *  @param node The node to be removed.
     */
    public static void removeNode(ASTNode node) {
        ASTNode parent = node.getParent();
        StructuralPropertyDescriptor location = node.getLocationInParent();

        if (location.isChildProperty()) {
            parent.setStructuralProperty(location, null);
        } else {
            List<ASTNode> properties = (List<ASTNode>) parent
                    .getStructuralProperty(location);
            int position = properties.indexOf(node);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

     @param node The node to be replace.
     *  @param newNode The new node.
     */
    public static void replaceNode(ASTNode node, ASTNode newNode) {
        ASTNode parent = node.getParent();
        StructuralPropertyDescriptor location = node.getLocationInParent();

        if (location.isChildProperty()) {
            parent.setStructuralProperty(location, newNode);
        } else {
            List<ASTNode> properties = (List<ASTNode>) parent
                    .getStructuralProperty(location);
            int position = properties.indexOf(node);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

     * @param parent the parent node
     * @return <code>true</code> if the nodes may be the sub nodes of a type node, false otherwise
     */
    private boolean isTypePath(ASTNode child, ASTNode parent) {
      if (parent instanceof Type) {
        StructuralPropertyDescriptor location= child.getLocationInParent();
        return location == ParameterizedType.TYPE_PROPERTY || location == SimpleType.NAME_PROPERTY;
      } else if (parent instanceof QualifiedName) {
        StructuralPropertyDescriptor location= child.getLocationInParent();
        return location == QualifiedName.NAME_PROPERTY;
      }
      return false;
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

        return true;
      // special cases: the autoboxing conversions happens at a
      // location that is not mapped directly to a simple name
      // or a literal, but can still be mapped somehow
      // A) expressions
      StructuralPropertyDescriptor desc= node.getLocationInParent();
      if (desc == ArrayAccess.ARRAY_PROPERTY
          || desc == InfixExpression.LEFT_OPERAND_PROPERTY
          || desc == InfixExpression.RIGHT_OPERAND_PROPERTY
          || desc == ConditionalExpression.THEN_EXPRESSION_PROPERTY
          || desc == PrefixExpression.OPERAND_PROPERTY
View Full Code Here

Examples of org.eclipse.jdt.core.dom.StructuralPropertyDescriptor

    /*
     * @see org.eclipse.jdt.internal.ui.javaeditor.ISemanticHighlighting#isMatched(org.eclipse.jdt.core.dom.ASTNode)
     */
    public boolean consumes(SemanticToken token) {
      StructuralPropertyDescriptor location= token.getNode().getLocationInParent();
      return location == MethodDeclaration.NAME_PROPERTY || location == AnnotationTypeMemberDeclaration.NAME_PROPERTY;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.