Examples of IPhpScriptRegion


Examples of org.eclipse.php.internal.core.documentModel.parser.regions.IPhpScriptRegion

            .getRegionAtCharacterOffset(formattedLineStart);
        regionStart += firstTokenInLine.getStart();
      }
      int scriptRegionLength = 0;
      if (firstTokenInLine instanceof IPhpScriptRegion) {
        IPhpScriptRegion scriptRegion = (IPhpScriptRegion) firstTokenInLine;
        if (scriptRegion.getStart() + scriptRegion.getLength() < formattedLineStart
            - regionStart) {
          return;
        }
        scriptRegionLength = scriptRegion.getStart();
        firstTokenInLine = scriptRegion.getPhpToken(formattedLineStart
            - regionStart);
        if (firstTokenInLine != null
            && firstTokenInLine.getStart()
                + sdRegion.getStartOffset() < orginalLineStart
            && firstTokenInLine.getType() == PHPRegionTypes.WHITESPACE) {
          firstTokenInLine = scriptRegion
              .getPhpToken(formattedLineStart - regionStart
                  + firstTokenInLine.getLength());
        }
        if (scriptRegion.getStart() + scriptRegion.getLength() >= formattedTextEnd
            - regionStart - 1) {

          lastTokenInLine = scriptRegion.getPhpToken(formattedTextEnd
              - regionStart - 1);
          if (lastTokenInLine != null
              && lastTokenInLine.getEnd()
                  + sdRegion.getStartOffset() > orginalLineStart
                  + originalLineLength
              && lastTokenInLine.getType() == PHPRegionTypes.WHITESPACE) {
            lastTokenInLine = scriptRegion
                .getPhpToken(formattedTextEnd - regionStart - 1
                    - lastTokenInLine.getLength());
          }
        }
      }
View Full Code Here

Examples of org.eclipse.php.internal.core.documentModel.parser.regions.IPhpScriptRegion

      tRegion = container.getRegionAtCharacterOffset(offset);
      regionStart += tRegion.getStart();
    }
    do {
      if (tRegion instanceof IPhpScriptRegion) {
        IPhpScriptRegion scriptRegion = (IPhpScriptRegion) tRegion;
        tRegion = scriptRegion.getPhpToken(offset - regionStart - 1);

        // go backward over the region to find a 'case' or 'default'
        // region
        // in this case is the same indentation
        // other case if look for the '{' of the 'switch' region
        while (tRegion != null) {
          String token = tRegion.getType();
          if (token == PHPRegionTypes.PHP_CURLY_OPEN) {
            curlyCount--;
            if (curlyCount < 0) {
              return document.getLineInformationOfOffset(tRegion
                  .getStart()
                  + regionStart);
            }
          } else if (token == PHPRegionTypes.PHP_CURLY_CLOSE) {
            curlyCount++;
          }
          if (tRegion.getStart() > 0) {
            tRegion = scriptRegion
                .getPhpToken(tRegion.getStart() - 1);
          } else {
            break;
          }
        }
View Full Code Here

Examples of org.eclipse.php.internal.core.documentModel.parser.regions.IPhpScriptRegion

        IStructuredDocumentRegion sdRegion = ((BasicStructuredDocument) fDocument)
            .getRegionAtCharacterOffset(position);
        ITextRegion textRegion = sdRegion
            .getRegionAtCharacterOffset(position);
        if (textRegion instanceof IPhpScriptRegion) {
          IPhpScriptRegion phpScriptRegion = (IPhpScriptRegion) textRegion;
          textRegion = phpScriptRegion.getPhpToken(position
              - phpScriptRegion.getStart()
              - sdRegion.getStartOffset());

          int regionStart = textRegion.getStart()
              + phpScriptRegion.getStart()
              + sdRegion.getStartOffset();
          // handle comments
          if (PHPPartitionTypes.isPHPCommentState(textRegion
              .getType())) {
            return new TypedRegion(regionStart,
View Full Code Here

Examples of org.eclipse.php.internal.core.documentModel.parser.regions.IPhpScriptRegion

        IStructuredDocumentRegion sdRegion = ((BasicStructuredDocument) fDocument)
            .getRegionAtCharacterOffset(position);
        ITextRegion textRegion = sdRegion
            .getRegionAtCharacterOffset(position);
        if (textRegion instanceof IPhpScriptRegion) {
          IPhpScriptRegion phpScriptRegion = (IPhpScriptRegion) textRegion;
          textRegion = phpScriptRegion.getPhpToken(position
              - sdRegion.getStartOffset()
              - phpScriptRegion.getStart());
          return textRegion;
        }
      }

      return null;
View Full Code Here

Examples of org.eclipse.php.internal.core.documentModel.parser.regions.IPhpScriptRegion

  }

  public int getPrefixEnd() throws BadLocationException {
    ITextRegion phpToken = getPHPToken();
    if (phpToken.getType() == PHPRegionTypes.PHP_NS_SEPARATOR) {
      IPhpScriptRegion phpScriptRegion = getPhpScriptRegion();
      ITextRegion nextRegion = phpScriptRegion.getPhpToken(phpToken
          .getEnd());
      return getRegionCollection().getStartOffset()
          + phpScriptRegion.getStart() + nextRegion.getTextEnd();
    }
    return super.getPrefixEnd();
  }
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.