Package org.eclipse.php.internal.core.util.text

Examples of org.eclipse.php.internal.core.util.text.TextSequence


        // Check function name
        if (SymfonyTextSequenceUtilities.isGetFunction(getStatementText())  == -1) {
          return false;
        }

        TextSequence statementText = getStatementText();
        int totalLength = statementText.length();
        int elementStart = PHPTextSequenceUtilities.readBackwardSpaces(
            statementText, totalLength);
        elementStart = PHPTextSequenceUtilities.readIdentifierStartIndex(
            statementText, elementStart, true);
        elementStart = PHPTextSequenceUtilities.readBackwardSpaces(
            statementText, elementStart);
        elementStart-=3;
        if (statementText.charAt(elementStart) != ')') { //
          return false;
        }

        // find get()
        PHPHeuristicScanner scanner = PHPHeuristicScanner.createHeuristicScanner(getDocument(), offset - statementText.length() + elementStart-1, true);
        int open = scanner.findOpeningPeer(offset - statementText.length() + elementStart-1, PHPHeuristicScanner.UNBOUND, PHPHeuristicScanner.LPAREN, PHPHeuristicScanner.RPAREN);
        statementText = getStatementText(open);
        totalLength = statementText.length();
        elementStart = PHPTextSequenceUtilities.readBackwardSpaces(
            statementText, totalLength);
        elementStart = PHPTextSequenceUtilities.readIdentifierStartIndex(
            statementText, elementStart, true);
View Full Code Here


      // wrong nature
      if(!sourceModule.getScriptProject().getProject().hasNature(SymfonyNature.NATURE_ID)) {
        return false
      }
     
      TextSequence sequence = getStatementText();
      int start = sequence.toString().lastIndexOf("@");
      int end = sequence.toString().length();
     
      String line = sequence.toString().substring(start, end);
     
      // we're inside an annotation's parameters
      // can't complete this so far.
      if (line.contains("(")) {
        return false;
View Full Code Here

      try {

        if (requestor == null || !requestor.getClass().toString().contains("Symfony"))
            return false;
       
        TextSequence statement = getStatementText();
        IScriptProject project = getSourceModule().getScriptProject();

        if (SymfonyTextSequenceUtilities.isInViewPathFunctionParameter(statement, project) == false)
          return false;

        int startOffset = SymfonyTextSequenceUtilities.readViewPathStartIndex(statement);

        String path = null;

        if (startOffset == -1) {
          path = "";
        } else {          

          int original = statement.getOriginalOffset(startOffset);
          int end = offset;

          if (original >= 0 &&  end > original) {
            path = statement.getSource().getFullText().substring(original, end);
          }
          else path = "";
        }

        if (path != null) {               
View Full Code Here

        if (requestor == null || !requestor.getClass().toString().toLowerCase().contains("symfony")) {
          return false;
        }

        TextSequence statementText = getStatementText();
        char nextChar = getNextChar();

        if (nextChar != ' ' && nextChar != '\n' && nextChar != '\'' && nextChar != '"') {
          return false;
        }

        if (SymfonyTextSequenceUtilities.isInEntityFunctionParameter(statementText) > -1) {
          int startOffset = SymfonyTextSequenceUtilities.readViewPathStartIndex(statementText);
          String path = null;

          if (startOffset == -1) {
            path = "";
          } else {
            int original = statementText.getOriginalOffset(startOffset);
            int end = offset;

            if (original >= 0 && end > original) {
              path = statementText.getSource().getFullText().substring(original, end);
            } else
              path = "";
          }

          if (path != null) {
View Full Code Here

  public TextSequence getStatementText() {

    if (textRegion == null)
      return null;
   
    TextSequence textSequence = TextSequenceUtilities
        .createTextSequence(textRegion, offset, textRegion.getFullText().length());

    return textSequence;
   
 
View Full Code Here

    if(super.isValid(sourceModule, offset, requestor)) {
     
       try {        
                 
         TextSequence statement = getStatementText();


         if (!requestor.getClass().getName().contains("Twig")) {
             return false;
         }
         if (TwigTextSequenceUtilities.isInFunction(statement)) {
           return false;
         }
         int startOffset = SymfonyTextSequenceUtilities.readViewPathStartIndex(statement);
         String path = getDocument().getText().substring(statement.getOriginalOffset(startOffset), offset);
        
         if (path != null) {               
           viewPath = new ViewPath(path);
           return true;
         }
View Full Code Here

            if (!requestor.getClass().getName().contains("Twig")) {
                return false;
            }

            TextSequence statement = getStatementText();

            if (!TwigTextSequenceUtilities.isInFunction(statement)) {
                return false;
            }
View Full Code Here

                }
            }
        } catch (BadLocationException e) {
        }

        TextSequence textSequence = PHPTextSequenceUtilities
                .getStatement(lineStart,
                        document.getRegionAtCharacterOffset(lineStart), true);
        if (textSequence != null
                && isRegionTypeAllowedMultiline(FormatterUtils.getRegionType(
                        document, textSequence.getOriginalOffset(0)))
                && document.getLineOfOffset(textSequence.getOriginalOffset(0)) < currLineIndex) {
            return true;
        }

        return false;
    }
View Full Code Here

                    }
                    startTokenRegion = twigScriptRegion
                            .getTwigToken(startTokenRegion.getStart() - 1);
                }

                TextSequence textSequence = TextSequenceUtilities
                        .createTextSequence(sdRegion, startOffset, offset
                                - startOffset);

                // remove spaces from start.
                textSequence = textSequence.subTextSequence(
                        PHPTextSequenceUtilities.readForwardSpaces(
                                textSequence, 0), textSequence.length());

                return textSequence;

            } catch (Exception e) {
                Logger.logException(e);
View Full Code Here

        if (super.isValid(sourceModule, offset, requestor)) {

            try {

                TextSequence statement = getStatementText();

                if (TwigTextSequenceUtilities.isInField(statement)) {

                    variable = TwigTextSequenceUtilities.getVariable(statement);
                    return true;
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.util.text.TextSequence

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.