Examples of StructuralPropertyDescriptor


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

    /*
     * @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#consumes(org.eclipse.jdt.internal.ui.javaeditor.SemanticToken)
     */
    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);
View Full Code Here

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

      int nodeType= node.getNodeType();
      if (nodeType != ASTNode.SIMPLE_TYPE && nodeType != ASTNode.QUALIFIED_TYPE)
        return false;

      // 2: match type arguments
      StructuralPropertyDescriptor locationInParent= node.getLocationInParent();
      if (locationInParent == ParameterizedType.TYPE_ARGUMENTS_PROPERTY)
        return true;

      return false;
    }
View Full Code Here

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

  public boolean preVisit2(ASTNode node) {
    ASTNode previous = null;
   
    List properties = node.structuralPropertiesForType();
    for (int i = 0; i < properties.size(); i++) {
      StructuralPropertyDescriptor property = (StructuralPropertyDescriptor) properties.get(i);
      if (property.isChildProperty()) {
        ASTNode child = (ASTNode) node.getStructuralProperty(property);
        if (child != null) {
          boolean ok = checkChild(node, previous, child);
          if (ok) {
            previous = child;
          } else {
            return false;
          }
        }
      } else if (property.isChildListProperty()) {
        List children = (List) node.getStructuralProperty(property);
        for (int j= 0; j < children.size(); j++) {
          ASTNode child = (ASTNode) children.get(j);
          boolean ok = checkChild(node, previous, child);
          if (ok) {
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

   }

   @SuppressWarnings("unchecked")
   public static List<Type> getInterfaces(final BodyDeclaration dec)
   {
      StructuralPropertyDescriptor desc;
      if (dec instanceof EnumDeclaration) {
         desc = EnumDeclaration.SUPER_INTERFACE_TYPES_PROPERTY;
      } else {
         desc = TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY;
      }
View Full Code Here

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

         */
        ASTNode orig = (ASTNode) this.clonedNodes.remove(node);
        if (orig != null) {
          List properties = node.structuralPropertiesForType();
          for (int i= 0; i < properties.size(); i++) {
            StructuralPropertyDescriptor property = (StructuralPropertyDescriptor) properties.get(i);
            Object child = node.getStructuralProperty(property);
            if (child instanceof ASTNode) {
              markAsMoveOrCopyTarget(node, (ASTNode) child);
            } else if (child instanceof List) {
              List children = (List) child;
View Full Code Here

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

   */
  public static List<ChildListPropertyDescriptor> getChildListPropertyDescriptors(ASTNode node) {
    List<ChildListPropertyDescriptor> childListPropertyDescriptors = new ArrayList<ChildListPropertyDescriptor>();
    List list= node.structuralPropertiesForType();
    for (int i= 0; i < list.size(); i++) {
      StructuralPropertyDescriptor curr= (StructuralPropertyDescriptor) list.get(i);
      if (!(curr instanceof ChildListPropertyDescriptor)) {
        continue;
      }
      childListPropertyDescriptors.add((ChildListPropertyDescriptor)curr);
    }
View Full Code Here

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

  public boolean preVisit2(ASTNode node) {
    ASTNode previous = null;
   
    List properties = node.structuralPropertiesForType();
    for (int i = 0; i < properties.size(); i++) {
      StructuralPropertyDescriptor property = (StructuralPropertyDescriptor) properties.get(i);
      if (property.isChildProperty()) {
        ASTNode child = (ASTNode) node.getStructuralProperty(property);
        if (child != null) {
          boolean ok = checkChild(node, previous, child);
          if (ok) {
            previous = child;
          } else {
            return false;
          }
        }
      } else if (property.isChildListProperty()) {
        List children = (List) node.getStructuralProperty(property);
        for (int j= 0; j < children.size(); j++) {
          ASTNode child = (ASTNode) children.get(j);
          boolean ok = checkChild(node, previous, child);
          if (ok) {
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.