Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java')
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java40
1 files changed, 20 insertions, 20 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java
index 31c031ab6e2..4ea687f7818 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java
@@ -31,32 +31,34 @@ import org.eclipse.cdt.ui.text.ICPartitions;
/**
* Action that removes the enclosing comment marks from a C block comment.
- *
+ *
* @since 3.0
*/
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 <code>ResourceAction</code> constructor), or
+ * (described in <code>ResourceAction</code> constructor), or
* <code>null</code> if none
* @param editor the text editor
*/
public RemoveBlockCommentAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
super(bundle, prefix, editor);
}
-
+
@Override
- protected void runInternal(ITextSelection selection, IDocumentExtension3 docExtension, Edit.EditFactory factory) throws BadPartitioningException, BadLocationException {
- if ( !(docExtension instanceof IDocument) ) return;
+ protected void runInternal(ITextSelection selection, IDocumentExtension3 docExtension, Edit.EditFactory factory)
+ throws BadPartitioningException, BadLocationException {
+ if (!(docExtension instanceof IDocument))
+ return;
+
+ List<Edit> edits = new LinkedList<Edit>();
- List<Edit> edits= new LinkedList<Edit>();
-
int partitionStart = -1;
- int partitionEnd = selection.getOffset();
+ int partitionEnd = selection.getOffset();
do {
ITypedRegion partition = docExtension.getPartition(ICPartitions.C_PARTITIONING, partitionEnd, false);
@@ -65,20 +67,19 @@ public class RemoveBlockCommentAction extends BlockCommentAction {
break;
}
partitionStart = partition.getOffset();
- partitionEnd = partitionStart + partition.getLength();
+ partitionEnd = partitionStart + partition.getLength();
if (partition.getType() == ICPartitions.C_MULTI_LINE_COMMENT
|| partition.getType() == ICPartitions.C_MULTI_LINE_DOC_COMMENT) {
- uncommentPartition((IDocument)docExtension, factory, edits, partitionStart, partitionEnd);
+ uncommentPartition((IDocument) docExtension, factory, edits, partitionStart, partitionEnd);
}
- } while (partitionEnd < selection.getOffset()+selection.getLength());
+ } while (partitionEnd < selection.getOffset() + selection.getLength());
executeEdits(edits);
}
- private void uncommentPartition(IDocument doc, Edit.EditFactory factory,
- List<Edit> edits, int partitionStart, int partitionEnd)
- throws BadLocationException {
-
+ private void uncommentPartition(IDocument doc, Edit.EditFactory factory, List<Edit> edits, int partitionStart,
+ int partitionEnd) throws BadLocationException {
+
int startCommentTokenLength = getCommentStart().length();
int endCommentTokenLength = getCommentEnd().length();
@@ -90,8 +91,8 @@ public class RemoveBlockCommentAction extends BlockCommentAction {
// start comment tag '/*'
if (lineContent.equals(getCommentStart())) {
String eol = doc.getLineDelimiter(doc.getLineOfOffset(partitionStart));
- if (eol!=null) {
- startCommentTokenLength = startCommentTokenLength+eol.length();
+ if (eol != null) {
+ startCommentTokenLength = startCommentTokenLength + eol.length();
}
}
}
@@ -103,7 +104,7 @@ public class RemoveBlockCommentAction extends BlockCommentAction {
// end comment tag '*/'
if (lineContent.equals(getCommentEnd())) {
String eol = doc.getLineDelimiter(doc.getLineOfOffset(partitionEnd));
- if (eol!=null) {
+ if (eol != null) {
endCommentTokenLength = endCommentTokenLength + eol.length();
}
}
@@ -118,5 +119,4 @@ public class RemoveBlockCommentAction extends BlockCommentAction {
return selection != null && !selection.isEmpty() && selection.getLength() > 0;
}
-
}

Back to the top