diff options
author | Dani Megert | 2010-08-04 12:40:50 +0000 |
---|---|---|
committer | Dani Megert | 2010-08-04 12:40:50 +0000 |
commit | 23414f5c2ada49b199b2a6c64dcf2dec6ec760fb (patch) | |
tree | 1faa9dc9acccc17841f73d8bfbeb7f623acd24e9 /org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java | |
parent | 22faf55d8597163dcf433eada4262fa32e9147dc (diff) | |
download | eclipse.platform.text-23414f5c2ada49b199b2a6c64dcf2dec6ec760fb.tar.gz eclipse.platform.text-23414f5c2ada49b199b2a6c64dcf2dec6ec760fb.tar.xz eclipse.platform.text-23414f5c2ada49b199b2a6c64dcf2dec6ec760fb.zip |
Reverted previous change.v20100805-1200v20100804-1300
Diffstat (limited to 'org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java')
-rw-r--r-- | org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java | 57 |
1 files changed, 18 insertions, 39 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java index 56e127e119a..4d0c8ec9c8b 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java @@ -179,6 +179,10 @@ public abstract class AbstractInformationControl implements IInformationControl, fResizable= (shellStyle & SWT.RESIZE) != 0; fShell= new Shell(parentShell, shellStyle); + Display display= fShell.getDisplay(); + Color foreground= display.getSystemColor(SWT.COLOR_INFO_FOREGROUND); + Color background= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); + setColor(fShell, foreground, background); GridLayout layout= new GridLayout(1, false); layout.marginHeight= 0; @@ -189,8 +193,9 @@ public abstract class AbstractInformationControl implements IInformationControl, fContentComposite= new Composite(fShell, SWT.NONE); fContentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fContentComposite.setLayout(new FillLayout()); + setColor(fContentComposite, foreground, background); - createStatusComposite(statusFieldText, toolBarManager); + createStatusComposite(statusFieldText, toolBarManager, foreground, background); addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { @@ -198,10 +203,9 @@ public abstract class AbstractInformationControl implements IInformationControl, } }); - updateColors(); } - private void createStatusComposite(final String statusFieldText, final ToolBarManager toolBarManager) { + private void createStatusComposite(final String statusFieldText, final ToolBarManager toolBarManager, Color foreground, Color background) { if (toolBarManager == null && statusFieldText == null) return; @@ -218,13 +222,13 @@ public abstract class AbstractInformationControl implements IInformationControl, fSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (statusFieldText != null) { - createStatusLabel(statusFieldText); + createStatusLabel(statusFieldText, foreground, background); } else { createToolBar(toolBarManager); } } - private void createStatusLabel(final String statusFieldText) { + private void createStatusLabel(final String statusFieldText, Color foreground, Color background) { fStatusLabel= new Label(fStatusComposite, SWT.RIGHT); fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fStatusLabel.setText(statusFieldText); @@ -235,6 +239,10 @@ public abstract class AbstractInformationControl implements IInformationControl, } fStatusLabelFont= new Font(fStatusLabel.getDisplay(), fontDatas); fStatusLabel.setFont(fStatusLabelFont); + + fStatusLabelForeground= new Color(fStatusLabel.getDisplay(), Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f)); + setColor(fStatusLabel, fStatusLabelForeground, background); + setColor(fStatusComposite, foreground, background); } private void createToolBar(ToolBarManager toolBarManager) { @@ -400,40 +408,14 @@ public abstract class AbstractInformationControl implements IInformationControl, } /** - * Updates the colors. - * - * @since 3.7 - */ - private void updateColors() { - if (fShell.isDisposed()) - return; - - Display display= fShell.getDisplay(); - Color foreground= display.getSystemColor(SWT.COLOR_INFO_FOREGROUND); - Color background= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); - - setColors(fShell, foreground, background); - setColors(fContentComposite, foreground, background); - - if (fStatusLabel == null) - return; - - if (fStatusLabelForeground != null) - fStatusLabelForeground.dispose(); - fStatusLabelForeground= new Color(fStatusLabel.getDisplay(), Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f)); - - setColors(fStatusLabel, fStatusLabelForeground, background); - setColors(fStatusComposite, foreground, background); - } - - /** - * Utility to set the foreground and the background color of the given control - * + * Utility to set the foreground and the background color of the given + * control + * * @param control the control to modify * @param foreground the color to use for the foreground * @param background the color to use for the background */ - private static void setColors(Control control, Color foreground, Color background) { + private static void setColor(Control control, Color foreground, Color background) { control.setForeground(foreground); control.setBackground(background); } @@ -520,9 +502,6 @@ public abstract class AbstractInformationControl implements IInformationControl, if (fShell.isVisible() == visible) return; - if (visible) - updateColors(); - fShell.setVisible(visible); } @@ -530,7 +509,7 @@ public abstract class AbstractInformationControl implements IInformationControl, * @see IInformationControl#dispose() */ public void dispose() { - if (!fShell.isDisposed()) + if (fShell != null && !fShell.isDisposed()) fShell.dispose(); } |