Package org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter

Examples of org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.Prefix


      } catch (CoreException e) {
        handleException(e);
      }
    }

    Prefix formatterPrefix;
    if (property == SingleVariableDeclaration.MODIFIERS2_PROPERTY)
      formatterPrefix= this.formatter.PARAM_ANNOTATION_SEPARATION;
    else
      formatterPrefix= this.formatter.ANNOTATION_SEPARATION;

    int endPos= new ModifierRewriter(formatterPrefix).rewriteList(node, property, pos, Util.EMPTY_STRING, " "); //$NON-NLS-1$

    try {
      int nextPos= getScanner().getNextStartOffset(endPos, false);

      boolean lastUnchanged= children[children.length - 1].getChangeKind() != RewriteEvent.UNCHANGED;

      if (isAllRemove) {
        doTextRemove(endPos, nextPos - endPos, getEditGroup(children[children.length - 1]));
        return nextPos;
      } else if (isAllInsert || (nextPos == endPos && lastUnchanged)) { // see bug 165654
        RewriteEvent lastChild= children[children.length - 1];
        String separator;
        if (lastChild.getNewValue() instanceof Annotation) {
          separator= formatterPrefix.getPrefix(getIndent(pos));
        } else {
          separator= String.valueOf(' ');
        }
        doTextInsert(endPos, separator, getEditGroup(lastChild));
      }
View Full Code Here


      return doVisitUnchangedChildren(node);
    }
    try {
      int pos= getScanner().getNextEndOffset(node.getStartPosition(), true); // pos after question mark

      Prefix prefix;
      if (Boolean.TRUE.equals(getNewValue(node, WildcardType.UPPER_BOUND_PROPERTY))) {
        prefix= this.formatter.WILDCARD_EXTENDS;
      } else {
        prefix= this.formatter.WILDCARD_SUPER;
      }

      int boundKindChange= getChangeKind(node, WildcardType.UPPER_BOUND_PROPERTY);
      if (boundKindChange != RewriteEvent.UNCHANGED) {
        int boundTypeChange= getChangeKind(node, WildcardType.BOUND_PROPERTY);
        if (boundTypeChange != RewriteEvent.INSERTED && boundTypeChange != RewriteEvent.REMOVED) {
          ASTNode type= (ASTNode) getOriginalValue(node, WildcardType.BOUND_PROPERTY);
          String str= prefix.getPrefix(0);
          doTextReplace(pos, type.getStartPosition() - pos, str, getEditGroup(node, WildcardType.BOUND_PROPERTY));
        }
      }
      rewriteNode(node, WildcardType.BOUND_PROPERTY, pos, prefix);
    } catch (CoreException e) {
View Full Code Here

      }
    }

    boolean isAnnotationsProperty = isVarargsAnnotationsProperty
        || node instanceof AnnotatableType && property == ((AnnotatableType) node).getAnnotationsProperty();
    Prefix formatterPrefix;
    if (property == SingleVariableDeclaration.MODIFIERS2_PROPERTY ||
        property == TypeParameter.MODIFIERS_PROPERTY || isAnnotationsProperty)
      formatterPrefix= this.formatter.PARAM_ANNOTATION_SEPARATION;
    else
      formatterPrefix= this.formatter.ANNOTATION_SEPARATION;

    int endPos= new ModifierRewriter(formatterPrefix).rewriteList(node, property, pos, keyword, " "); //$NON-NLS-1$

    try {
      int nextPos= getScanner().getNextStartOffset(endPos, false);
      RewriteEvent lastChild = children[children.length - 1];
      boolean lastUnchanged= lastChild.getChangeKind() != RewriteEvent.UNCHANGED;

      if (isAllRemove) {
        doTextRemove(endPos, nextPos - endPos, getEditGroup(lastChild));
        return nextPos;
      } else if ((isAllInsert || (nextPos == endPos && lastUnchanged)) // see bug 165654
          && !isVarargsAnnotationsProperty) {
        String separator;
        if (lastChild.getNewValue() instanceof Annotation) {
          separator= formatterPrefix.getPrefix(getIndent(pos));
        } else {
          separator= String.valueOf(' ');
        }
        doTextInsert(endPos, separator, getEditGroup(lastChild));
      }
View Full Code Here

      rewriteTypeAnnotations(node, WildcardType.ANNOTATIONS_PROPERTY, node.getStartPosition());
    }
    try {
      int pos= getScanner().getNextEndOffset(node.getStartPosition(), true); // pos after question mark

      Prefix prefix;
      if (Boolean.TRUE.equals(getNewValue(node, WildcardType.UPPER_BOUND_PROPERTY))) {
        prefix= this.formatter.WILDCARD_EXTENDS;
      } else {
        prefix= this.formatter.WILDCARD_SUPER;
      }

      int boundKindChange= getChangeKind(node, WildcardType.UPPER_BOUND_PROPERTY);
      if (boundKindChange != RewriteEvent.UNCHANGED) {
        int boundTypeChange= getChangeKind(node, WildcardType.BOUND_PROPERTY);
        if (boundTypeChange != RewriteEvent.INSERTED && boundTypeChange != RewriteEvent.REMOVED) {
          ASTNode type= (ASTNode) getOriginalValue(node, WildcardType.BOUND_PROPERTY);
          String str= prefix.getPrefix(0);
          doTextReplace(pos, type.getStartPosition() - pos, str, getEditGroup(node, WildcardType.BOUND_PROPERTY));
        }
      }
      rewriteNode(node, WildcardType.BOUND_PROPERTY, pos, prefix);
    } catch (CoreException e) {
View Full Code Here

      } catch (CoreException e) {
        handleException(e);
      }
    }

    Prefix formatterPrefix;
    if (property == SingleVariableDeclaration.MODIFIERS2_PROPERTY)
      formatterPrefix= this.formatter.PARAM_ANNOTATION_SEPARATION;
    else
      formatterPrefix= this.formatter.ANNOTATION_SEPARATION;

    int endPos= new ModifierRewriter(formatterPrefix).rewriteList(node, property, pos, Util.EMPTY_STRING, " "); //$NON-NLS-1$

    try {
      int nextPos= getScanner().getNextStartOffset(endPos, false);

      boolean lastUnchanged= children[children.length - 1].getChangeKind() != RewriteEvent.UNCHANGED;

      if (isAllRemove) {
        doTextRemove(endPos, nextPos - endPos, getEditGroup(children[children.length - 1]));
        return nextPos;
      } else if (isAllInsert || (nextPos == endPos && lastUnchanged)) { // see bug 165654
        RewriteEvent lastChild= children[children.length - 1];
        String separator;
        if (lastChild.getNewValue() instanceof Annotation) {
          separator= formatterPrefix.getPrefix(getIndent(pos));
        } else {
          separator= String.valueOf(' ');
        }
        doTextInsert(endPos, separator, getEditGroup(lastChild));
      }
View Full Code Here

      return doVisitUnchangedChildren(node);
    }
    try {
      int pos= getScanner().getNextEndOffset(node.getStartPosition(), true); // pos after question mark

      Prefix prefix;
      if (Boolean.TRUE.equals(getNewValue(node, WildcardType.UPPER_BOUND_PROPERTY))) {
        prefix= this.formatter.WILDCARD_EXTENDS;
      } else {
        prefix= this.formatter.WILDCARD_SUPER;
      }

      int boundKindChange= getChangeKind(node, WildcardType.UPPER_BOUND_PROPERTY);
      if (boundKindChange != RewriteEvent.UNCHANGED) {
        int boundTypeChange= getChangeKind(node, WildcardType.BOUND_PROPERTY);
        if (boundTypeChange != RewriteEvent.INSERTED && boundTypeChange != RewriteEvent.REMOVED) {
          ASTNode type= (ASTNode) getOriginalValue(node, WildcardType.BOUND_PROPERTY);
          String str= prefix.getPrefix(0);
          doTextReplace(pos, type.getStartPosition() - pos, str, getEditGroup(node, WildcardType.BOUND_PROPERTY));
        }
      }
      rewriteNode(node, WildcardType.BOUND_PROPERTY, pos, prefix);
    } catch (CoreException e) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.Prefix

Copyright © 2018 www.massapicom. 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.