improved PHP parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / actions / RemoveBlockCommentAction.java
index 38c0291..c58c0ad 100644 (file)
@@ -1,10 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * 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
  *******************************************************************************/
@@ -14,15 +14,15 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.ResourceBundle;
 
-import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
-
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.BadPartitioningException;
 import org.eclipse.jface.text.IDocumentExtension3;
 import org.eclipse.jface.text.ITextSelection;
 import org.eclipse.jface.text.ITypedRegion;
+
 import org.eclipse.ui.texteditor.ITextEditor;
 
+import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
 
 /**
  * Action that removes the enclosing comment marks from a Java block comment.
@@ -30,8 +30,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
  * @since 3.0
  */
 public class RemoveBlockCommentAction extends BlockCommentAction {
-    final static String DEFAULT_PARTITIONING_CONTENT_TYPE = "__dftl_partition_content_type"; //$NON-NLS-1$
-       
+
        /**
         * Creates a new instance.
         * 
@@ -46,7 +45,7 @@ public class RemoveBlockCommentAction extends BlockCommentAction {
        }
        
        /*
-        * @see org.eclipse.jdt.internal.ui.actions.AddBlockCommentAction#runInternal(org.eclipse.jface.text.ITextSelection, org.eclipse.jface.text.IDocumentExtension3, org.eclipse.jdt.internal.ui.actions.AddBlockCommentAction.Edit.EditFactory)
+        * @see net.sourceforge.phpdt.internal.ui.actions.AddBlockCommentAction#runInternal(org.eclipse.jface.text.ITextSelection, org.eclipse.jface.text.IDocumentExtension3, net.sourceforge.phpdt.internal.ui.actions.AddBlockCommentAction.Edit.EditFactory)
         */
        protected void runInternal(ITextSelection selection, IDocumentExtension3 docExtension, Edit.EditFactory factory) throws BadPartitioningException, BadLocationException {
                List edits= new LinkedList();
@@ -55,28 +54,23 @@ public class RemoveBlockCommentAction extends BlockCommentAction {
                int offset= selection.getOffset();
                int endOffset= offset + selection.getLength();
 
-//             ITypedRegion partition= docExtension.getPartition(IPHPPartitions.PHP_PARTITIONING, offset, false);
-               ITypedRegion partition= docExtension.getPartition(IDocumentExtension3.DEFAULT_PARTITIONING, offset, false);
-               
+               ITypedRegion partition= docExtension.getPartition(IPHPPartitions.PHP_PARTITIONING, offset, false);
                int partOffset= partition.getOffset();
                int partEndOffset= partOffset + partition.getLength();
                
                while (partEndOffset < endOffset) {
                        
-                       if (partition.getType() == IPHPPartitions.PHP_PHPDOC_COMMENT) {
+                       if (partition.getType() == IPHPPartitions.PHP_MULTILINE_COMMENT) {
                                edits.add(factory.createEdit(partOffset, tokenLength, "")); //$NON-NLS-1$
                                edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$
                        }
                        
-//                     partition= docExtension.getPartition(IPHPPartitions.PHP_PARTITIONING, partEndOffset, false);
-                       partition= docExtension.getPartition(IDocumentExtension3.DEFAULT_PARTITIONING, partEndOffset, false);
-                       
+                       partition= docExtension.getPartition(IPHPPartitions.PHP_PARTITIONING, partEndOffset, false);
                        partOffset= partition.getOffset();
                        partEndOffset= partOffset + partition.getLength();
                }
 
-//             if (partition.getType() == IPHPPartitions.PHP_PHPDOC_COMMENT) {
-               if (partition.getType() ==   DEFAULT_PARTITIONING_CONTENT_TYPE) {
+               if (partition.getType() == IPHPPartitions.PHP_MULTILINE_COMMENT) {
                        edits.add(factory.createEdit(partOffset, tokenLength, "")); //$NON-NLS-1$
                        edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$
                }
@@ -85,7 +79,7 @@ public class RemoveBlockCommentAction extends BlockCommentAction {
        }
 
        /*
-        * @see org.eclipse.jdt.internal.ui.actions.AddBlockCommentAction#validSelection(org.eclipse.jface.text.ITextSelection)
+        * @see net.sourceforge.phpdt.internal.ui.actions.AddBlockCommentAction#validSelection(org.eclipse.jface.text.ITextSelection)
         */
        protected boolean isValidSelection(ITextSelection selection) {
                return selection != null && !selection.isEmpty();