1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-02-23 20:26:46 -08:00
parent f6ecdf5318
commit 688a0e6f75

View file

@ -140,13 +140,8 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
* @param styles * @param styles
* @param store * @param store
*/ */
public CSourceViewer( public CSourceViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler,
Composite parent, boolean isOverviewRulerShowing, int styles, IPreferenceStore store) {
IVerticalRuler ruler,
IOverviewRuler overviewRuler,
boolean isOverviewRulerShowing,
int styles,
IPreferenceStore store) {
super(parent, ruler, overviewRuler, isOverviewRulerShowing, styles); super(parent, ruler, overviewRuler, isOverviewRulerShowing, styles);
setPreferenceStore(store); setPreferenceStore(store);
} }
@ -209,7 +204,6 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
protected void initializeViewerColors() { protected void initializeViewerColors() {
if (fPreferenceStore != null) { if (fPreferenceStore != null) {
StyledText styledText= getTextWidget(); StyledText styledText= getTextWidget();
// ----------- foreground color -------------------- // ----------- foreground color --------------------
@ -268,15 +262,14 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
* @return the created color according to the specification in the preference store * @return the created color according to the specification in the preference store
*/ */
private Color createColor(IPreferenceStore store, String key, Display display) { private Color createColor(IPreferenceStore store, String key, Display display) {
RGB rgb= null; RGB rgb= null;
if (store.contains(key)) { if (store.contains(key)) {
if (store.isDefault(key)) {
if (store.isDefault(key))
rgb= PreferenceConverter.getDefaultColor(store, key); rgb= PreferenceConverter.getDefaultColor(store, key);
else } else {
rgb= PreferenceConverter.getColor(store, key); rgb= PreferenceConverter.getColor(store, key);
}
if (rgb != null) if (rgb != null)
return new Color(display, rgb); return new Color(display, rgb);
@ -332,8 +325,7 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
|| AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR.equals(property) || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR.equals(property)
|| AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR.equals(property) || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR.equals(property)
|| AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR.equals(property) || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR.equals(property)
|| AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR.equals(property)) || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR.equals(property)) {
{
initializeViewerColors(); initializeViewerColors();
} }
} }
@ -362,7 +354,6 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
*/ */
@Override @Override
protected void createControl(Composite parent, int styles) { protected void createControl(Composite parent, int styles) {
// Use LEFT_TO_RIGHT unless otherwise specified. // Use LEFT_TO_RIGHT unless otherwise specified.
if ((styles & SWT.RIGHT_TO_LEFT) == 0 && (styles & SWT.LEFT_TO_RIGHT) == 0) if ((styles & SWT.RIGHT_TO_LEFT) == 0 && (styles & SWT.LEFT_TO_RIGHT) == 0)
styles |= SWT.LEFT_TO_RIGHT; styles |= SWT.LEFT_TO_RIGHT;
@ -375,7 +366,6 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
*/ */
@Override @Override
public void doOperation(int operation) { public void doOperation(int operation) {
if (getTextWidget() == null) { if (getTextWidget() == null) {
return; return;
} }
@ -513,7 +503,6 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
} }
} }
/** /**
* Configure the indentation mode for this viewer. * Configure the indentation mode for this viewer.
* *
@ -584,8 +573,7 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
} }
} }
} }
} catch (BadLocationException e) {
} catch (BadLocationException x) {
// ignored // ignored
} finally { } finally {
if (rewriteSession != null) { if (rewriteSession != null) {
@ -642,9 +630,9 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
Color cDefaultColor= manager.getColor(ICColorConstants.C_DEFAULT); Color cDefaultColor= manager.getColor(ICColorConstants.C_DEFAULT);
RGB cDefaultRGB= cDefaultColor != null ? RGB cDefaultRGB= cDefaultColor != null ?
cDefaultColor.getRGB() : new RGB(255, 255, 255); cDefaultColor.getRGB() : new RGB(255, 255, 255);
float[] javaDefaultHSB= cDefaultRGB.getHSB(); float[] cDefaultHSB= cDefaultRGB.getHSB();
if (Math.abs(defaultBgHSB[2] - javaDefaultHSB[2]) >= 0.5f) { if (Math.abs(defaultBgHSB[2] - cDefaultHSB[2]) >= 0.5f) {
getTextWidget().setBackground(defaultColor); getTextWidget().setBackground(defaultColor);
if (fBackgroundColor != null) { if (fBackgroundColor != null) {
fBackgroundColor.dispose(); fBackgroundColor.dispose();