mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
13645705f8
commit
145dc70ee6
1 changed files with 6 additions and 3 deletions
|
@ -124,7 +124,8 @@ public final class ToggleCommentAction extends TextEditorAction {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IRegion block= getTextBlockFromSelection(textSelection, document);
|
IRegion block= getTextBlockFromSelection(textSelection, document);
|
||||||
ITypedRegion[] regions= TextUtilities.computePartitioning(document, fDocumentPartitioning, block.getOffset(), block.getLength(), false);
|
ITypedRegion[] regions= TextUtilities.computePartitioning(document, fDocumentPartitioning,
|
||||||
|
block.getOffset(), block.getLength(), false);
|
||||||
|
|
||||||
int lineCount= 0;
|
int lineCount= 0;
|
||||||
int[] lines= new int[regions.length * 2]; // [startline, endline, startline, endline, ...]
|
int[] lines= new int[regions.length * 2]; // [startline, endline, startline, endline, ...]
|
||||||
|
@ -179,7 +180,8 @@ public final class ToggleCommentAction extends TextEditorAction {
|
||||||
private IRegion getTextBlockFromSelection(ITextSelection selection, IDocument document) {
|
private IRegion getTextBlockFromSelection(ITextSelection selection, IDocument document) {
|
||||||
try {
|
try {
|
||||||
IRegion line= document.getLineInformationOfOffset(selection.getOffset());
|
IRegion line= document.getLineInformationOfOffset(selection.getOffset());
|
||||||
int length= selection.getLength() == 0 ? line.getLength() : selection.getLength() + (selection.getOffset() - line.getOffset());
|
int length= selection.getLength() == 0 ?
|
||||||
|
line.getLength() : selection.getLength() + (selection.getOffset() - line.getOffset());
|
||||||
return new Region(line.getOffset(), length);
|
return new Region(line.getOffset(), length);
|
||||||
|
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
|
@ -272,7 +274,8 @@ public final class ToggleCommentAction extends TextEditorAction {
|
||||||
if (fOperationTarget == null && editor != null)
|
if (fOperationTarget == null && editor != null)
|
||||||
fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
|
fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
|
||||||
|
|
||||||
boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(ITextOperationTarget.PREFIX) && fOperationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
|
boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(ITextOperationTarget.PREFIX) &&
|
||||||
|
fOperationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
|
||||||
setEnabled(isEnabled);
|
setEnabled(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue