diff options
author | Tobias Melcher | 2020-10-12 15:54:26 +0000 |
---|---|---|
committer | Matthias Becker | 2020-10-26 12:44:37 +0000 |
commit | 67a74d76e7a99b3252d4ca29167f33e55cee9740 (patch) | |
tree | d38a78ee38d99224a7be4dcffe241225dde8b7dc | |
parent | 5b5b4b786f679ba15f8bffbbde3fb6dea1e01bfc (diff) | |
download | eclipse.platform.debug-67a74d76e7a99b3252d4ca29167f33e55cee9740.tar.gz eclipse.platform.debug-67a74d76e7a99b3252d4ca29167f33e55cee9740.tar.xz eclipse.platform.debug-67a74d76e7a99b3252d4ca29167f33e55cee9740.zip |
Bug 567816: Changing font size in variables viewY20201027-1200Y20201026-1200I20201026-1850
Change-Id: I9c69b8e535a32829a740480499901545bf672677
Signed-off-by: Tobias Melcher <Tobias.Melcher@sap.com>
6 files changed, 73 insertions, 8 deletions
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF index 039f99a7c..adbe4da4b 100644 --- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF @@ -92,7 +92,8 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)", org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)", org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)", - org.eclipse.ui.genericeditor;bundle-version="1.1.0";resolution:=optional + org.eclipse.ui.genericeditor;bundle-version="1.1.0";resolution:=optional, + org.eclipse.e4.ui.services;bundle-version="[1.3.700,2.0.0)" Bundle-ActivationPolicy: lazy Bundle-ClassPath: . Import-Package: org.eclipse.ui.forms.widgets 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 248b776f1..86735f611 100644 --- a/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css +++ b/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css @@ -45,4 +45,8 @@ IEclipsePreferences#org-eclipse-debug-ui { */ background-color:#515658; color: white; -}
\ No newline at end of file +} + +#VariablesViewer { + font-family: '#org-eclipse-debug-ui-VariableTextFont'; +} diff --git a/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css index b0df8dd4f..52da14fb3 100644 --- a/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css +++ b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css @@ -20,4 +20,8 @@ #DebugBreadcrumbItemDropDownToolBar { background-color:COLOR-WIDGET-LIGHT-SHADOW; -}
\ No newline at end of file +} + +#VariablesViewer { + font-family: '#org-eclipse-debug-ui-VariableTextFont'; +} diff --git a/org.eclipse.debug.ui/css/e4-light_debug_prefstyle_system.css b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle_system.css new file mode 100644 index 000000000..83cced5af --- /dev/null +++ b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle_system.css @@ -0,0 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2018 SAP SE and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ + +#VariablesViewer { + font-family: '#org-eclipse-debug-ui-VariableTextFont'; +} diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index 184ad0608..a96e1f6c6 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -3309,6 +3309,12 @@ M4 = Platform-specific fourth key refid="org.eclipse.e4.ui.css.theme.e4_default"> </themeid> </stylesheet> + <stylesheet + uri="css/e4-light_debug_prefstyle_system.css"> + <themeid + refid="org.eclipse.e4.ui.css.theme.e4_system"> + </themeid> + </stylesheet> </extension> <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java index fc5a907ac..8e59e6aa6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java @@ -76,6 +76,7 @@ import org.eclipse.debug.ui.IDebugView; import org.eclipse.debug.ui.contexts.DebugContextEvent; import org.eclipse.debug.ui.contexts.IDebugContextListener; import org.eclipse.debug.ui.contexts.IDebugContextService; +import org.eclipse.e4.ui.services.IStylingEngine; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuManager; @@ -85,6 +86,7 @@ import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.commands.ActionHandler; import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.FontDescriptor; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.LocalSelectionTransfer; @@ -108,6 +110,7 @@ import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlListener; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -115,6 +118,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.IActionBars; @@ -128,6 +132,7 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.XMLMemento; import org.eclipse.ui.handlers.CollapseAllHandler; @@ -145,10 +150,14 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis IViewerUpdateListener, IDetailPaneContainer2, ISaveablePart2 { private static final String COLLAPSE_ALL = "CollapseAll"; //$NON-NLS-1$ + /** + * Unique ID of variables view tree viewer used for CSS styling + */ + private static final String CSS_VARIABLES_VIEWER_ID = "VariablesViewer"; //$NON-NLS-1$ /** - * Selection provider wrapping an exchangeable active selection provider. - * Sends out a selection changed event when the active selection provider changes. + * Selection provider wrapping an exchangeable active selection provider. Sends + * out a selection changed event when the active selection provider changes. * Forwards all selection changed events of the active selection provider. */ private static class SelectionProviderWrapper implements ISelectionProvider { @@ -386,6 +395,10 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis */ private IPresentationContext fPresentationContext; + private Font variablesTreeFont; + + private TreeModelViewer variablesViewer; + /** * Remove myself as a selection listener * and preference change listener. @@ -413,6 +426,9 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis } fInputService.dispose(); fSelectionProvider.dispose(); + if (variablesTreeFont != null) { + variablesTreeFont.dispose(); + } super.dispose(); } @@ -459,7 +475,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis if (propertyName.equals(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR) || propertyName.equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND) || propertyName.equals(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT)) { - getViewer().refresh(); + Viewer viewer = getViewer(); + if (viewer == variablesViewer) { + setVariablesViewerTreeFont(variablesViewer); + } + viewer.refresh(); } } @@ -476,10 +496,12 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); JFaceResources.getFontRegistry().addListener(this); - TreeModelViewer variablesViewer = createTreeViewer(fSashForm); + variablesViewer = createTreeViewer(fSashForm); fInputService = new ViewerInputService(variablesViewer, fRequester); fSashForm.setMaximizedControl(variablesViewer.getControl()); + setVariablesViewerTreeFont(variablesViewer); + fDetailsAnchor = SWTFactory.createComposite(fSashForm, parent.getFont(), 1, 1, GridData.FILL_BOTH, 0, 0); fSashForm.setWeights(getLastSashWeights()); @@ -510,6 +532,21 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis return variablesViewer; } + private void setVariablesViewerTreeFont(TreeModelViewer variablesViewer) { + Tree tree = variablesViewer.getTree(); + FontDescriptor fontDescriptor = JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT); + Font oldVariablesTreeFont = variablesTreeFont; + variablesTreeFont = fontDescriptor.createFont(tree.getDisplay()); + tree.setFont(variablesTreeFont); // needed when themes are disabled + if (oldVariablesTreeFont != null) { + oldVariablesTreeFont.dispose(); + } + IStylingEngine engine = PlatformUI.getWorkbench().getService(IStylingEngine.class); + if (engine != null) { + engine.setId(tree, CSS_VARIABLES_VIEWER_ID); + } + } + /** * Initializes the drag and/or drop adapters for this view. Called from createViewer(). * @@ -616,7 +653,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis int style = getViewerStyle(); fPresentationContext = new DebugModelPresentationContext(getPresentationContextId(), this, fModelPresentation); final TreeModelViewer variablesViewer = new TreeModelViewer(parent, style, fPresentationContext); - variablesViewer.getControl().addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { |