Lines 1124-1132
Link Here
|
1124 |
/** The error message shown in the status line in case of failed information look up. */ |
1124 |
/** The error message shown in the status line in case of failed information look up. */ |
1125 |
protected final String fErrorLabel= EditorMessages.getString("Editor.statusline.error.label"); //$NON-NLS-1$ |
1125 |
protected final String fErrorLabel= EditorMessages.getString("Editor.statusline.error.label"); //$NON-NLS-1$ |
1126 |
private final String fPositionLabelPattern= EditorMessages.getString("Editor.statusline.position.pattern"); //$NON-NLS-1$ |
1126 |
private final String fPositionLabelPattern= EditorMessages.getString("Editor.statusline.position.pattern"); //$NON-NLS-1$ |
|
|
1127 |
private final String fSelectionLabelPattern= EditorMessages.getString("Editor.statusline.selection.pattern"); |
1128 |
private final PositionLabelValue fNumOfLinesLabel= new PositionLabelValue(); |
1127 |
private final PositionLabelValue fLineLabel= new PositionLabelValue(); |
1129 |
private final PositionLabelValue fLineLabel= new PositionLabelValue(); |
1128 |
private final PositionLabelValue fColumnLabel= new PositionLabelValue(); |
1130 |
private final PositionLabelValue fColumnLabel= new PositionLabelValue(); |
1129 |
private final Object[] fPositionLabelPatternArguments= new Object[] { fLineLabel, fColumnLabel }; |
1131 |
private final Object[] fPositionLabelPatternArguments= new Object[] { fLineLabel, fColumnLabel, fNumOfLinesLabel }; |
1130 |
|
1132 |
|
1131 |
|
1133 |
|
1132 |
|
1134 |
|
Lines 3721-3745
Link Here
|
3721 |
if (document == null) |
3723 |
if (document == null) |
3722 |
return fErrorLabel; |
3724 |
return fErrorLabel; |
3723 |
|
3725 |
|
3724 |
try { |
3726 |
ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection(); |
3725 |
|
3727 |
|
3726 |
int line= document.getLineOfOffset(caret); |
3728 |
if (selection == null || selection.getLength() == 0) { |
|
|
3729 |
try { |
3730 |
int line= document.getLineOfOffset(caret); |
3731 |
|
3732 |
int lineOffset= document.getLineOffset(line); |
3733 |
int tabWidth= styledText.getTabs(); |
3734 |
int column= 0; |
3735 |
for (int i= lineOffset; i < caret; i++) |
3736 |
if ('\t' == document.getChar(i)) |
3737 |
column += tabWidth - (column % tabWidth); |
3738 |
else |
3739 |
column++; |
3740 |
|
3741 |
fLineLabel.fValue= line + 1; |
3742 |
fColumnLabel.fValue= column + 1; |
3743 |
return MessageFormat.format(fPositionLabelPattern, fPositionLabelPatternArguments); |
3744 |
} catch (BadLocationException x) { |
3745 |
return fErrorLabel; |
3746 |
} |
3747 |
} else { |
3748 |
int start= selection.getStartLine(); |
3749 |
int end= selection.getEndLine(); |
3727 |
|
3750 |
|
3728 |
int lineOffset= document.getLineOffset(line); |
3751 |
fLineLabel.fValue= start + 1; |
3729 |
int tabWidth= styledText.getTabs(); |
3752 |
fColumnLabel.fValue= end + 1; |
3730 |
int column= 0; |
3753 |
fNumOfLinesLabel.fValue= end - start + 1; |
3731 |
for (int i= lineOffset; i < caret; i++) |
3754 |
|
3732 |
if ('\t' == document.getChar(i)) |
3755 |
return MessageFormat.format(fSelectionLabelPattern, fPositionLabelPatternArguments); |
3733 |
column += tabWidth - (column % tabWidth); |
|
|
3734 |
else |
3735 |
column++; |
3736 |
|
3737 |
fLineLabel.fValue= line + 1; |
3738 |
fColumnLabel.fValue= column + 1; |
3739 |
return MessageFormat.format(fPositionLabelPattern, fPositionLabelPatternArguments); |
3740 |
|
3741 |
} catch (BadLocationException x) { |
3742 |
return fErrorLabel; |
3743 |
} |
3756 |
} |
3744 |
} |
3757 |
} |
3745 |
|
3758 |
|