diff options
author | Matthias Becker | 2018-07-09 08:09:11 +0000 |
---|---|---|
committer | Matthias Becker | 2018-07-20 06:10:39 +0000 |
commit | a331ba896e29b946a6b9f07d89b6d485f5a7450d (patch) | |
tree | 68ba3c684ae653777d73a0ca3901ebb2f5bd6dea | |
parent | 8c1b2b8850e35987067b08881f2fe40dced5b5c2 (diff) | |
download | eclipse.platform.debug-a331ba896e29b946a6b9f07d89b6d485f5a7450d.tar.gz eclipse.platform.debug-a331ba896e29b946a6b9f07d89b6d485f5a7450d.tar.xz eclipse.platform.debug-a331ba896e29b946a6b9f07d89b6d485f5a7450d.zip |
Bug 465666: Fix bread crumb background in dark themeY20180723-0635Y20180723-0615I20180723-2000I20180722-2000I20180721-1500I20180720-2000
Change-Id: Ifb6349ffd0af011933760e6ee8eef3f984209b8e
Signed-off-by: Matthias Becker <ma.becker@sap.com>
7 files changed, 66 insertions, 127 deletions
diff --git a/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css b/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css index 205786c77..179131dbc 100644 --- a/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css +++ b/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css @@ -21,4 +21,24 @@ IEclipsePreferences#org-eclipse-debug-ui { 'org.eclipse.debug.ui.errorColor=225,30,70' 'org.eclipse.debug.ui.inColor=140,175,210' 'org.eclipse.debug.ui.outColor=235,235,235' +} + +#DebugBreadcrumbComposite, +#DebugBreadcrumbItemComposite, +#DebugBreadcrumbItemDetailComposite, +#DebugBreadcrumbItemDetailTextComposite, +#DebugBreadcrumbItemDetailImageComposite, +#DebugBreadcrumbItemDetailTextLabel, +#DebugBreadcrumbItemDetailImageLabel, +#DebugBreadcrumbItemDropDownToolBar +{ + /* + * Bug 465666 + * + * Note: as we can't change the arrow to black, we configure + * the background with the lighter color used for the background + * of toolbars and make the foreground color brighter too. + */ + background-color:#515658; + color: white; }
\ No newline at end of file diff --git a/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css new file mode 100644 index 000000000..3cca01f92 --- /dev/null +++ b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2018 SAP SE and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ + +#DebugBreadcrumbComposite, +#DebugBreadcrumbItemComposite, +#DebugBreadcrumbItemDetailComposite, +#DebugBreadcrumbItemDetailTextComposite, +#DebugBreadcrumbItemDetailImageComposite, +#DebugBreadcrumbItemDetailTextLabel, +#DebugBreadcrumbItemDetailImageLabel, +#DebugBreadcrumbItemDropDownToolBar +{ + background-color:COLOR-WIDGET-LIGHT-SHADOW; +}
\ No newline at end of file diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index a6826f94d..ca0a02b4b 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -3266,6 +3266,12 @@ M4 = Platform-specific fourth key refid="org.eclipse.e4.ui.css.theme.e4_dark"> </themeid> </stylesheet> + <stylesheet + uri="css/e4-light_debug_prefstyle.css"> + <themeid + refid="org.eclipse.e4.ui.css.theme.e4_default"> + </themeid> + </stylesheet> </extension> <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java index f6bc59242..da32b4701 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java @@ -69,6 +69,7 @@ class BreadcrumbItem extends Item { fExpandBlock= new BreadcrumbItemDropDown(this, fContainer); fDetailsBlock= new BreadcrumbItemDetails(this, fContainer); + fContainer.setData("org.eclipse.e4.ui.css.id", "DebugBreadcrumbItemComposite"); //$NON-NLS-1$ //$NON-NLS-2$ } /** @@ -214,8 +215,9 @@ class BreadcrumbItem extends Item { fDetailsBlock.setText(string); //more or less space might be required for the label - if (fIsLast) + if (fIsLast) { fContainer.layout(true, true); + } } /* diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java index c5a756760..62782a259 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java @@ -26,13 +26,11 @@ import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.TraverseEvent; import org.eclipse.swt.events.TraverseListener; -import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; @@ -129,6 +127,13 @@ class BreadcrumbItemDetails { }); fDetailComposite.setTabList(new Control[] { fTextComposite }); + + fDetailComposite.setData("org.eclipse.e4.ui.css.id", "DebugBreadcrumbItemDetailComposite"); //$NON-NLS-1$ //$NON-NLS-2$ + fTextComposite.setData("org.eclipse.e4.ui.css.id", "DebugBreadcrumbItemDetailTextComposite"); //$NON-NLS-1$ //$NON-NLS-2$ + fImageComposite.setData("org.eclipse.e4.ui.css.id", "DebugBreadcrumbItemDetailImageComposite"); //$NON-NLS-1$ //$NON-NLS-2$ + fElementImage.setData("org.eclipse.e4.ui.css.id", "DebugBreadcrumbItemDetailImageLabel"); //$NON-NLS-1$ //$NON-NLS-2$ + fElementText.setData("org.eclipse.e4.ui.css.id", "DebugBreadcrumbItemDetailTextLabel"); //$NON-NLS-1$ //$NON-NLS-2$ + } /** @@ -192,18 +197,21 @@ class BreadcrumbItemDetails { public int getWidth() { int result= 2; - if (fElementImage.getImage() != null) + if (fElementImage.getImage() != null) { result+= fElementImage.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + } - if (fTextVisible && fElementText.getText().length() > 0) + if (fTextVisible && fElementText.getText().length() > 0) { result+= fElementText.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + } return result; } public void setTextVisible(boolean enabled) { - if (fTextVisible == enabled) + if (fTextVisible == enabled) { return; + } fTextVisible= enabled; @@ -224,7 +232,6 @@ class BreadcrumbItemDetails { fImageComposite.setFocus(); } } - updateSelection(); } /** @@ -237,17 +244,18 @@ class BreadcrumbItemDetails { } public void setSelected(boolean selected) { - if (selected == fSelected) + if (selected == fSelected) { return; + } fSelected= selected; - updateSelection(); } public void setFocus(boolean enabled) { - if (enabled == fHasFocus) + if (enabled == fHasFocus) { return; + } fHasFocus= enabled; if (fHasFocus) { @@ -257,39 +265,6 @@ class BreadcrumbItemDetails { fImageComposite.setFocus(); } } - updateSelection(); - } - - private void updateSelection() { - Color background; - Color foreground; - - if (fSelected) { - background= Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION); - foreground= Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT); - } else { - foreground= null; - background= null; - } - - if (isTextVisible()) { - fTextComposite.setBackground(background); - fElementText.setBackground(background); - fElementText.setForeground(foreground); - - fImageComposite.setBackground(null); - fElementImage.setBackground(null); - } else { - fImageComposite.setBackground(background); - fElementImage.setBackground(background); - - fTextComposite.setBackground(null); - fElementText.setBackground(null); - fElementText.setForeground(null); - } - - fTextComposite.redraw(); - fImageComposite.redraw(); } /** @@ -385,7 +360,6 @@ class BreadcrumbItemDetails { public void focusGained(FocusEvent e) { if (!fHasFocus) { fHasFocus= true; - updateSelection(); } } @@ -393,7 +367,6 @@ class BreadcrumbItemDetails { public void focusLost(FocusEvent e) { if (fHasFocus) { fHasFocus= false; - updateSelection(); } } }); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java index 76411f3de..f0314db42 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java @@ -207,6 +207,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { } }); } + fToolBar.setData("org.eclipse.e4.ui.css.id", "DebugBreadcrumbItemDropDownToolBar"); //$NON-NLS-1$ //$NON-NLS-2$ } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java index 7fa402f14..44f5f624f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java @@ -33,15 +33,12 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.MenuDetectEvent; import org.eclipse.swt.events.MenuDetectListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Widget; @@ -98,20 +95,6 @@ public abstract class BreadcrumbViewer extends StructuredViewer { fContainer.addTraverseListener(e -> e.doit = true); fContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); - fContainer.addListener(SWT.Resize, event -> { - int height = fContainer.getClientArea().height; - - if (fGradientBackground == null || fGradientBackground.getBounds().height != height) { - Image image = height == 0 ? null : createGradientImage(height, event.display); - fContainer.setBackgroundImage(image); - - if (fGradientBackground != null) { - fGradientBackground.dispose(); - } - fGradientBackground = image; - } - }); - hookControl(fContainer); int columns= 1000; @@ -777,71 +760,6 @@ public abstract class BreadcrumbViewer extends StructuredViewer { fContainer.setRedraw(false); } - /** - * The image to use for the breadcrumb background as specified in - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=221477 - * - * @param height the height of the image to create - * @param display the current display - * @return the image for the breadcrumb background - */ - private Image createGradientImage(int height, Display display) { - int width= 50; - - Image result= new Image(display, width, height); - - GC gc= new GC(result); - - Color colorC= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 35, display); - Color colorD= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 45, display); - Color colorE= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 80, display); - Color colorF= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 70, display); - Color colorG= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_WHITE, 45, display); - Color colorH= createColor(SWT.COLOR_WIDGET_NORMAL_SHADOW, SWT.COLOR_LIST_BACKGROUND, 35, display); - - try { - drawLine(width, 0, colorC, gc); - drawLine(width, 1, colorC, gc); - - gc.setForeground(colorD); - gc.setBackground(colorE); - gc.fillGradientRectangle(0, 2, width, 2 + 8, true); - - gc.setBackground(colorE); - gc.fillRectangle(0, 2 + 9, width, height - 4); - - drawLine(width, height - 3, colorF, gc); - drawLine(width, height - 2, colorG, gc); - drawLine(width, height - 1, colorH, gc); - - } finally { - gc.dispose(); - - colorC.dispose(); - colorD.dispose(); - colorE.dispose(); - colorF.dispose(); - colorG.dispose(); - colorH.dispose(); - } - - return result; - } - - private void drawLine(int width, int position, Color color, GC gc) { - gc.setForeground(color); - gc.drawLine(0, position, width, position); - } - - private Color createColor(int color1, int color2, int ratio, Display display) { - RGB rgb1= display.getSystemColor(color1).getRGB(); - RGB rgb2= display.getSystemColor(color2).getRGB(); - - RGB blend= blend(rgb2, rgb1, ratio); - - return new Color(display, blend); - } - /** * Blends c1 and c2 based in the provided ratio. * |