Package org.eclipse.php.internal.core.ast.rewrite.TargetSourceRangeComputer

Examples of org.eclipse.php.internal.core.ast.rewrite.TargetSourceRangeComputer.SourceRange


   * @return an extended source range (never null)
   * @since 3.1
   */
  final SourceRange getExtendedRange(ASTNode node) {
    if (this.eventStore.isRangeCopyPlaceholder(node)) {
      return new SourceRange(node.getStart(), node.getLength());
    }
    return this.extendedSourceRangeComputer.computeSourceRange(node);
  }
View Full Code Here


  }

  final TextEdit getCopySourceEdit(CopySourceInfo info) {
    TextEdit edit = (TextEdit) this.sourceCopyInfoToEdit.get(info);
    if (edit == null) {
      SourceRange range = getExtendedRange(info.getNode());
      int start = range.getStartPosition();
      int end = start + range.getLength();
      if (info.isMove) {
        MoveSourceEdit moveSourceEdit = new MoveSourceEdit(start, end
            - start);
        moveSourceEdit.setTargetEdit(new MoveTargetEdit(0));
        edit = moveSourceEdit;
View Full Code Here

      StructuralPropertyDescriptor property) {
    RewriteEvent event = getEvent(parent, property);
    if (event != null && event.getChangeKind() == RewriteEvent.REPLACED) {
      ASTNode node = (ASTNode) event.getOriginalValue();
      TextEditGroup editGroup = getEditGroup(event);
      SourceRange range = getExtendedRange(node);
      int offset = range.getStartPosition();
      int length = range.getLength();
      doTextRemoveAndVisit(offset, length, node, editGroup);
      doTextInsert(offset, (ASTNode) event.getNewValue(),
          getIndent(offset), true, editGroup);
      return offset + length;
    }
View Full Code Here

        return nodeEnd;
      }
      case RewriteEvent.REPLACED: {
        ASTNode node = (ASTNode) event.getOriginalValue();
        TextEditGroup editGroup = getEditGroup(event);
        SourceRange range = getExtendedRange(node);
        int nodeOffset = range.getStartPosition();
        int nodeLen = range.getLength();
        doTextRemoveAndVisit(nodeOffset, nodeLen, node, editGroup);
        doTextInsert(nodeOffset, (ASTNode) event.getNewValue(),
            getIndent(offset), true, editGroup);
        return nodeOffset + nodeLen;
      }
View Full Code Here

        break;
      }
      case RewriteEvent.REPLACED: {
        ASTNode node = (ASTNode) event.getOriginalValue();
        TextEditGroup editGroup = getEditGroup(event);
        SourceRange range = getExtendedRange(node);
        int offset = range.getStartPosition();
        int length = range.getLength();

        doTextRemoveAndVisit(offset, length, node, editGroup);
        doTextInsert(offset, (ASTNode) event.getNewValue(),
            getIndent(startPos), true, editGroup);
        try {
View Full Code Here

    CopySourceInfo[] infos = this.eventStore.getNodeCopySources(node);
    doCopySourcePreVisit(infos, this.sourceCopyEndNodes);

    TextEditGroup editGroup = this.eventStore.getTrackedNodeData(node);
    if (editGroup != null) {
      SourceRange range = getExtendedRange(node);
      int offset = range.getStartPosition();
      int length = range.getLength();
      TextEdit edit = new RangeMarker(offset, length);
      addEditGroup(editGroup, edit);
      addEdit(edit);
      this.currentEdit = edit;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.ast.rewrite.TargetSourceRangeComputer.SourceRange

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.