Prepared better HEREDOC support; see comment for bug #1319276
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / corext / template / php / JavaFormatter.java
index 936cf14..3b5456f 100644 (file)
@@ -1,10 +1,10 @@
 /*******************************************************************************
  * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials 
+ * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/cpl-v10.html
- * 
+ *
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *******************************************************************************/
@@ -57,7 +57,7 @@ public class JavaFormatter {
 
   /**
    * Creates a JavaFormatter with the target line delimiter.
-   * 
+   *
    * @param lineDelimiter
    *          the line delimiter to use
    * @param initialIndentLevel
@@ -73,7 +73,7 @@ public class JavaFormatter {
 
   /**
    * Formats the template buffer.
-   * 
+   *
    * @param buffer
    * @param context
    * @throws BadLocationException
@@ -130,7 +130,7 @@ public class JavaFormatter {
       return partitionType != null
           && (partitionType.equals(IPHPPartitions.PHP_MULTILINE_COMMENT)
               || partitionType.equals(IPHPPartitions.PHP_SINGLELINE_COMMENT) || partitionType.equals(IPHPPartitions.PHP_STRING_DQ)
-              || partitionType.equals(IPHPPartitions.PHP_STRING_SQ) || partitionType.equals(IPHPPartitions.PHP_PHPDOC_COMMENT));
+              || partitionType.equals(IPHPPartitions.PHP_STRING_SQ) || partitionType.equals(IPHPPartitions.PHP_STRING_HEREDOC) || partitionType.equals(IPHPPartitions.PHP_PHPDOC_COMMENT));
 
     } catch (BadLocationException e) {
       return false;
@@ -176,23 +176,23 @@ public class JavaFormatter {
   }
 
   //   private void plainFormat(TemplateBuffer templateBuffer, JavaContext context) throws BadLocationException {
-  //           
+  //
   //           IDocument doc= new Document(templateBuffer.getString());
-  //           
+  //
   //           TemplateVariable[] variables= templateBuffer.getVariables();
-  //           
+  //
   //           List offsets= variablesToPositions(variables);
-  //           
+  //
   //           Map options;
   //           if (context.getCompilationUnit() != null)
   //                   options= context.getCompilationUnit().getJavaProject().getOptions(true);
   //           else
   //                   options= JavaCore.getOptions();
-  //           
+  //
   //           TextEdit edit= CodeFormatterUtil.format2(CodeFormatter.K_UNKNOWN, doc.get(), fInitialIndentLevel, fLineDelimiter, options);
   //           if (edit == null)
   //                   throw new BadLocationException(); // fall back to indenting
-  //           
+  //
   //           MultiTextEdit root;
   //           if (edit instanceof MultiTextEdit)
   //                   root= (MultiTextEdit) edit;
@@ -209,11 +209,11 @@ public class JavaFormatter {
   //                           // ignore this position
   //                   }
   //           }
-  //           
+  //
   //           root.apply(doc, TextEdit.UPDATE_REGIONS);
-  //           
+  //
   //           positionsToVariables(offsets, variables);
-  //           
+  //
   //           templateBuffer.setContent(doc.get(), variables);
   //   }
 
@@ -270,7 +270,7 @@ public class JavaFormatter {
 
   /**
    * Changes the delimiter to the configured line delimiter.
-   * 
+   *
    * @param document
    *          the temporary document being edited
    * @param root