X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/RemoveBlockCommentAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/RemoveBlockCommentAction.java index c58c0ad..f1709fc 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/RemoveBlockCommentAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/RemoveBlockCommentAction.java @@ -14,16 +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. * @@ -34,45 +33,57 @@ public class RemoveBlockCommentAction extends BlockCommentAction { /** * Creates a new instance. * - * @param bundle the resource bundle - * @param prefix a prefix to be prepended to the various resource keys - * (described in ResourceAction constructor), or - * null if none - * @param editor the text editor + * @param bundle + * the resource bundle + * @param prefix + * a prefix to be prepended to the various resource keys + * (described in ResourceAction constructor), or + * null if none + * @param editor + * the text editor */ - public RemoveBlockCommentAction(ResourceBundle bundle, String prefix, ITextEditor editor) { + public RemoveBlockCommentAction(ResourceBundle bundle, String prefix, + ITextEditor editor) { super(bundle, prefix, editor); } - + /* - * @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) + * @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(); - int tokenLength= getCommentStart().length(); - - int offset= selection.getOffset(); - int endOffset= offset + selection.getLength(); + protected void runInternal(ITextSelection selection, + IDocumentExtension3 docExtension, Edit.EditFactory factory) + throws BadPartitioningException, BadLocationException { + List edits = new LinkedList(); + int tokenLength = getCommentStart().length(); + + int offset = selection.getOffset(); + int endOffset = offset + selection.getLength(); + + ITypedRegion partition = docExtension.getPartition( + IPHPPartitions.PHP_PARTITIONING, offset, false); + int partOffset = partition.getOffset(); + int partEndOffset = partOffset + partition.getLength(); - 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_MULTILINE_COMMENT) { edits.add(factory.createEdit(partOffset, tokenLength, "")); //$NON-NLS-1$ - edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$ + edits.add(factory.createEdit(partEndOffset - tokenLength, + tokenLength, "")); //$NON-NLS-1$ } - - partition= docExtension.getPartition(IPHPPartitions.PHP_PARTITIONING, partEndOffset, false); - partOffset= partition.getOffset(); - partEndOffset= partOffset + partition.getLength(); + + partition = docExtension.getPartition( + IPHPPartitions.PHP_PARTITIONING, partEndOffset, false); + partOffset = partition.getOffset(); + partEndOffset = partOffset + partition.getLength(); } 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$ + edits.add(factory.createEdit(partEndOffset - tokenLength, + tokenLength, "")); //$NON-NLS-1$ } executeEdits(edits);