Examples of IPhpScriptRegion


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

        tRegion = container.getRegionAtCharacterOffset(offset);
      }

      if (tRegion != null
          && tRegion.getType() == PHPRegionContext.PHP_CONTENT) {
        IPhpScriptRegion phpScriptRegion = (IPhpScriptRegion) tRegion;
        try {
          tRegion = phpScriptRegion.getPhpToken(offset
              - container.getStartOffset()
              - phpScriptRegion.getStart());
        } catch (BadLocationException e) {
          return null;
        }

        // Determine element name:
        int elementStart = container.getStartOffset()
            + phpScriptRegion.getStart() + tRegion.getStart();
        TextSequence statement = PHPTextSequenceUtilities.getStatement(
            elementStart + tRegion.getLength(), sRegion, true);
        int endPosition = PHPTextSequenceUtilities.readBackwardSpaces(
            statement, statement.length());
        int startPosition = PHPTextSequenceUtilities
View Full Code Here

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

              .getStart());
        }
        int regionStart = sdRegion.getStartOffset(tRegion);

        if (tRegion != null && tRegion instanceof IPhpScriptRegion) {
          IPhpScriptRegion scriptRegion = (IPhpScriptRegion) tRegion;
          regionOffset -= scriptRegion.getStart();

          ITextRegion commentRegion = scriptRegion
              .getPhpToken(regionOffset);
          int phpScriptEndOffset = scriptRegion.getLength();
          boolean isSpaceDeletionNeeded = false;
          do {
            int currentRegionEndOffset = commentRegion.getEnd();
            commentRegion = scriptRegion
                .getPhpToken(currentRegionEndOffset);
            String tokenType = commentRegion.getType();
            if (tokenType.equals(PHPRegionTypes.PHP_COMMENT_END)
                || PHPRegionTypes.PHPDOC_COMMENT_END
                    .equals(tokenType)) {
View Full Code Here

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

                    .getStart());
              }

              if (tRegion != null
                  && tRegion instanceof IPhpScriptRegion) {
                IPhpScriptRegion scriptRegion = (IPhpScriptRegion) tRegion;

                // update region offset for in order to get
                // phpdoc region later
                regionOffset -= scriptRegion.getStart();

                ITextRegion commentRegion = scriptRegion
                    .getPhpToken(regionOffset);

                String tokenType = commentRegion.getType();
                if (document.getLength() == offset
                    && (tokenType
                        .equals(PHPRegionTypes.PHPDOC_COMMENT_END) || tokenType
                        .equals(PHPRegionTypes.PHP_COMMENT_END))
                    && document.get(offset - 2, 2).equals(
                        "*/")) { //$NON-NLS-1$

                  ITextRegion region = commentRegion;
                  // go up in document and search for the
                  // first line containing
                  // PHPDOC_COMMENT_START/PHP_COMMENT_START
                  // tag
                  do {
                    if (region.getType() == PHPRegionTypes.PHPDOC_COMMENT_START
                        || region.getType() == PHPRegionTypes.PHP_COMMENT_START
                        || region.getStart() <= scriptRegion
                            .getStart()) {
                      break;
                    }
                    // get previous region
                    region = scriptRegion
                        .getPhpToken(region.getStart()
                            - lineDelimiters[index]
                                .length());

                  } while (true);
View Full Code Here

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

        regionStart += tRegion.getStart();
      }

      // find the specified php token in the PhpScriptRegion
      if (tRegion instanceof IPhpScriptRegion) {
        IPhpScriptRegion scriptRegion = (IPhpScriptRegion) tRegion;
        tRegion = scriptRegion.getPhpToken(offset - regionStart);

        return tRegion;
      }
    } catch (BadLocationException e) {
    }
View Full Code Here

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

    protected void redrawRegionChanged(
        RegionChangedEvent structuredDocumentEvent) {
      if (structuredDocumentEvent != null
          && structuredDocumentEvent.getRegion() != null
          && structuredDocumentEvent.getRegion().getType() == PHPRegionContext.PHP_CONTENT) {
        final IPhpScriptRegion region = (IPhpScriptRegion) structuredDocumentEvent
            .getRegion();
        if (region.isFullReparsed()) {
          final TextRegionListImpl newList = new TextRegionListImpl();
          newList.add(region);
          final IStructuredDocumentRegion structuredDocumentRegion = structuredDocumentEvent
              .getStructuredDocumentRegion();
          final IStructuredDocument structuredDocument = structuredDocumentEvent
View Full Code Here

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

        || sdRegion.getType() != PHPRegionTypes.PHP_CONTENT
        || sdRegion.getRegions().size() < 2) {
      return null;
    }

    final IPhpScriptRegion textRegion = (IPhpScriptRegion) sdRegion
        .getRegions().get(1);
    try {
      ITextRegion phpToken = textRegion.getPhpToken(0);
      i = 0;
      while (phpToken != null
          && phpToken.getType() != PHPRegionTypes.PHPDOC_COMMENT_START
          && i++ < 3) {
        phpToken = textRegion.getPhpToken(phpToken.getEnd() + 1);
      }
      if (phpToken == null
          || phpToken.getType() != PHPRegionTypes.PHPDOC_COMMENT_START) {
        return null;
      }
      int start = phpToken.getStart();
      ITextRegion lastToken = null;
      while (lastToken != phpToken && phpToken != null
          && phpToken.getType() != PHPRegionTypes.PHPDOC_COMMENT_END) {
        phpToken = textRegion.getPhpToken(phpToken.getEnd() + 1);
      }

      if (phpToken != null
          && phpToken.getType() == PHPRegionTypes.PHPDOC_COMMENT_END) {
        int end = phpToken.getEnd();
        return new Region(sdRegion.getStartOffset()
            + textRegion.getStart() + start, end - start);
      }
      return null;

    } catch (BadLocationException e) {
      return null;
View Full Code Here

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

            ITextRegionContainer container = (ITextRegionContainer) currentTextRegion;
            currentTextRegion = container
                .getRegionAtCharacterOffset(offset);
          }
          if (currentTextRegion instanceof IPhpScriptRegion) {
            IPhpScriptRegion scriptRegion = (IPhpScriptRegion) currentTextRegion;
            try {
              currentTextRegion = scriptRegion.getPhpToken(offset
                  - docRegion.getStartOffset(scriptRegion));

              if (currentTextRegion != null
                  && currentTextRegion.getTextLength() > 1) {
                int offsetAtNearEdge = offset;
View Full Code Here

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

              .getRegionAtCharacterOffset(offset);
          ITextRegion textRegion = sdRegion
              .getRegionAtCharacterOffset(offset);
          try {
            if (textRegion instanceof IPhpScriptRegion) {
              IPhpScriptRegion phpReg = (IPhpScriptRegion) textRegion;
              String partition = phpReg.getPartition(offset
                  - sdRegion.getStart());
              if (partition
                  .equals(PHPPartitionTypes.PHP_QUOTED_STRING)
                  || partition
                      .equals(PHPPartitionTypes.PHP_COMMENT)
View Full Code Here

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

        container = (ITextRegionContainer) region;
        region = container.getRegionAtCharacterOffset(offset);
      }

      if (region.getType() == PHPRegionContext.PHP_CONTENT) {
        IPhpScriptRegion phpScriptRegion = (IPhpScriptRegion) region;
        try {
          region = phpScriptRegion.getPhpToken(offset
              - container.getStartOffset() - region.getStart());
        } catch (BadLocationException e) {
          region = null;
        }
View Full Code Here

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

      tRegion = container.getRegionAtCharacterOffset(offset);
      regionStart += tRegion.getStart();
    }

    if (tRegion instanceof IPhpScriptRegion) {
      IPhpScriptRegion scriptRegion = (IPhpScriptRegion) tRegion;
      tRegion = scriptRegion.getPhpToken(offset - regionStart);
      return tRegion;
    }
    return null;
  }
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.