Prepared better HEREDOC support; see comment for bug #1319276
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / actions / AddBlockCommentAction.java
index 500644f..9977be9 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
  *******************************************************************************/
@@ -29,14 +29,14 @@ import org.eclipse.ui.texteditor.ITextEditor;
 /**
  * Action that encloses the editor's current selection with Java block comment terminators (<code>&#47;&#42;</code> and
  * <code>&#42;&#47;</code>).
- * 
+ *
  * @since 3.0
- */ 
+ */
 public class AddBlockCommentAction extends BlockCommentAction {
 
   /**
    * Creates a new instance.
-   * 
+   *
    * @param bundle
    *          the resource bundle
    * @param prefix
@@ -73,7 +73,7 @@ public class AddBlockCommentAction extends BlockCommentAction {
 
   /**
    * Handle the first partition of the selected text.
-   * 
+   *
    * @param partition
    * @param edits
    * @param factory
@@ -101,7 +101,7 @@ public class AddBlockCommentAction extends BlockCommentAction {
 
   /**
    * Handles the end of the given partition and the start of the next partition, which is returned.
-   *  
+   *
    * @param partition
    * @param edits
    * @param factory
@@ -139,7 +139,7 @@ public class AddBlockCommentAction extends BlockCommentAction {
     if (wasJavadoc) {
 
       // if previous was javadoc, and the current one is not, then add block comment start
-      if (partType == IDocument.DEFAULT_CONTENT_TYPE ||  
+      if (partType == IDocument.DEFAULT_CONTENT_TYPE ||
           partType == PHPDocumentPartitioner.PHP_SCRIPT_CODE ||
           isSpecialPartition(partType)) {
         edits.add(factory.createEdit(partition.getOffset(), 0, getCommentStart()));
@@ -161,7 +161,7 @@ public class AddBlockCommentAction extends BlockCommentAction {
 
   /**
    * Handles the end of the last partition.
-   * 
+   *
    * @param partition
    * @param edits
    * @param factory
@@ -186,14 +186,14 @@ public class AddBlockCommentAction extends BlockCommentAction {
   /**
    * Returns whether <code>partType</code> is special, i.e. a Java <code>String</code>,<code>Character</code>, or
    * <code>Line End Comment</code> partition.
-   * 
+   *
    * @param partType
    *          the partition type to check
    * @return <code>true</code> if <code>partType</code> is special, <code>false</code> otherwise
    */
   private boolean isSpecialPartition(String partType) {
     //         return partType == IJavaPartitions.JAVA_CHARACTER
-    return partType == IPHPPartitions.PHP_STRING_DQ || partType == IPHPPartitions.PHP_STRING_SQ
+    return partType == IPHPPartitions.PHP_STRING_DQ || partType == IPHPPartitions.PHP_STRING_SQ || partType == IPHPPartitions.PHP_STRING_HEREDOC
         || partType == IPHPPartitions.PHP_SINGLELINE_COMMENT;
   }