Package org.eclipse.php.internal.core.format

Examples of org.eclipse.php.internal.core.format.PhpFormatter


    }
    JobSafeStructuredDocument newdocument = new JobSafeStructuredDocument(
        new PhpSourceParser());
    String start = "<?php"; //$NON-NLS-1$
    newdocument.set(start + newline + tempsb.toString());
    PhpFormatter formatter = new PhpFormatter(0, newdocument.getLength(),
        true, indentationObject);
    formatter.format(newdocument.getFirstStructuredDocumentRegion());

    List<String> list = new ArrayList<String>();
    try {
      int lineNumber = newdocument.getNumberOfLines();
      for (int i = 0; i < lineNumber; i++) {
        if (i == 0) {
          continue;
        }
        IRegion region = newdocument.getLineInformation(i);
        String line = newdocument.get(region.getOffset(),
            region.getLength());
        list.add(line);
      }
    } catch (BadLocationException e) {
    }
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < startingEmptyLines; i++) {
      String lineDelimiter = newline;
      try {
        lineDelimiter = tempdocument.getLineDelimiter(i);
      } catch (BadLocationException e) {
      }
      sb.append(lineDelimiter);
    }
    for (int i = 0; i < list.size(); i++) {
      if (!formatter.getIgnoreLines().contains(i + 1)) {
        sb.append(helpBuffer.toString());
      }
      sb.append(list.get(i));
      if (i == list.size() - 1) {
      } else {
View Full Code Here


    switch (node.getNodeType()) {
    case Node.ELEMENT_NODE:
      if (node instanceof ElementImplForPhp
          && ((ElementImplForPhp) node).isPhpTag()) {
        formatter = new PhpFormatter(start, length);

      } else {
        formatter = new HTMLElementFormatterNoPHP();
      }
View Full Code Here

      }

      if (container != null
          && container.getFirstRegion().getType()
              .equals(PHPRegionContext.PHP_OPEN)) {
        PhpFormatter phpFormatter = new PhpFormatter(
            attribute.getStartOffset(), attribute.getEndOffset());
        phpFormatter.format(attribute, contraints);
      }
    }

  }
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.format.PhpFormatter

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.