From ed1e05876c54f7b6ec8673dd4802f724c69cb90f Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Mon, 1 Nov 2021 16:59:12 +0000 Subject: [PATCH] Bug 576987 - Unable to scroll when editing a launch config The current situation is that: * launch configuration dialog tabs scroll correctly in the standard Eclipse platform dialog, but not at all in the Launchbar-specific dialog * some CDT-supplied launch configuration dialog tabs try to manage their own scrolling behaviour to fix scrolling in the Launchbar-specific dialog but this breaks scrolling for that tab in the standard Eclipse platform dialog. This change fixes the launchbar-specific editor dialog to use a scrolled composite instead of a regular composite on which to layout the content of each tab -- This gives the launchbar's configuration editing dialog exactly the same scrolling behaviour as the standard Eclipse platform configuration editing dialog. And also fixes any CDT-supplied tabs that try to manage their own scrolling behaviour so now all tabs have the same behaviour when viewed in the Launchbar-specific dialog as they do when viewed in the standard Eclipse platform dialog. Change-Id: I0d7364a24ca48bb125cae9518728b4c93b93545d Signed-off-by: Mat Booth --- .../internal/ui/launching/CDebuggerTab.java | 20 ++++--------- .../META-INF/MANIFEST.MF | 2 +- .../gdbjtag/ui/GDBJtagDSFDebuggerTab.java | 12 ++------ .../debug/gdbjtag/ui/GDBJtagStartupTab.java | 14 ++------- .../META-INF/MANIFEST.MF | 2 +- .../internal/LaunchBarLaunchConfigDialog.java | 30 ++++++++++++++----- 6 files changed, 36 insertions(+), 44 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java index ef232ed889a..12fea2ec06b 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 QNX Software Systems and others. + * Copyright (c) 2008, 2021 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -44,7 +44,6 @@ import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -88,8 +87,6 @@ public class CDebuggerTab extends CLaunchConfigurationTab { protected Button fStopInMain; protected Text fStopInMainSymbol; - private ScrolledComposite fContainer; - private Composite fContents; private IContentChangeListener fContentListener = new IContentChangeListener() { @@ -115,14 +112,8 @@ public class CDebuggerTab extends CLaunchConfigurationTab { @Override public void createControl(Composite parent) { - fContainer = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); - fContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); - fContainer.setLayout(new FillLayout()); - fContainer.setExpandHorizontal(true); - fContainer.setExpandVertical(true); - - fContents = new Composite(fContainer, SWT.NONE); - setControl(fContainer); + fContents = new Composite(parent, SWT.NONE); + setControl(fContents); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB); int numberOfColumns = fAttachMode ? 2 : 1; @@ -137,8 +128,6 @@ public class CDebuggerTab extends CLaunchConfigurationTab { createOptionsComposite(fContents); createDebuggerGroup(fContents, 2); - - fContainer.setContent(fContents); } protected void initDebuggerTypes(String selection) { @@ -378,7 +367,8 @@ public class CDebuggerTab extends CLaunchConfigurationTab { } protected void contentsChanged() { - fContainer.setMinSize(fContents.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + ScrolledComposite parent = (ScrolledComposite) fContents.getParent(); + parent.setMinSize(fContents.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } protected void loadDynamicDebugArea() { diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF index f2130d423e3..9289d4b6376 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.ui;singleton:=true -Bundle-Version: 9.0.100.qualifier +Bundle-Version: 9.0.200.qualifier Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.ui.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java index 6aa24c67dba..8619797f4d9 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2020 QNX Software Systems and others. + * Copyright (c) 2007, 2021 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -53,7 +53,6 @@ import org.eclipse.debug.ui.StringVariableSelectionDialog; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.PixelConverter; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; @@ -105,13 +104,8 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { @Override public void createControl(Composite parent) { - ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); - sc.setExpandHorizontal(true); - sc.setExpandVertical(true); - setControl(sc); - - Composite comp = new Composite(sc, SWT.NONE); - sc.setContent(comp); + Composite comp = new Composite(parent, SWT.NONE); + setControl(comp); GridLayout layout = new GridLayout(2, false); comp.setLayout(layout); diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagStartupTab.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagStartupTab.java index a82ad060b55..c32ac9d5dfa 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagStartupTab.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagStartupTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 - 2020 QNX Software Systems and others. + * Copyright (c) 2007 - 2021 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -35,7 +35,6 @@ import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.layout.PixelConverter; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; @@ -117,21 +116,14 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab { @Override public void createControl(Composite parent) { - ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); - sc.setExpandHorizontal(true); - sc.setExpandVertical(true); - setControl(sc); - - Composite comp = new Composite(sc, SWT.NONE); - sc.setContent(comp); + Composite comp = new Composite(parent, SWT.NONE); + setControl(comp); GridLayout layout = new GridLayout(); comp.setLayout(layout); createInitGroup(comp); createLoadGroup(comp); createRunGroup(comp); - - sc.setMinSize(comp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } private void browseButtonSelected(String title, Text text) { diff --git a/launchbar/org.eclipse.launchbar.ui/META-INF/MANIFEST.MF b/launchbar/org.eclipse.launchbar.ui/META-INF/MANIFEST.MF index f35ce1f6919..05a7da20dd3 100644 --- a/launchbar/org.eclipse.launchbar.ui/META-INF/MANIFEST.MF +++ b/launchbar/org.eclipse.launchbar.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.launchbar.ui;singleton:=true -Bundle-Version: 2.4.200.qualifier +Bundle-Version: 2.4.300.qualifier Bundle-Activator: org.eclipse.launchbar.ui.internal.Activator Bundle-Vendor: %providerName Require-Bundle: org.eclipse.core.runtime, diff --git a/launchbar/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/LaunchBarLaunchConfigDialog.java b/launchbar/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/LaunchBarLaunchConfigDialog.java index beb391749ad..59d055fb03d 100644 --- a/launchbar/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/LaunchBarLaunchConfigDialog.java +++ b/launchbar/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/LaunchBarLaunchConfigDialog.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2016, 2021 QNX Software Systems 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 + *******************************************************************************/ package org.eclipse.launchbar.ui.internal; import java.lang.reflect.InvocationTargetException; @@ -26,6 +36,7 @@ import org.eclipse.launchbar.ui.ILaunchBarUIManager; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.SelectionAdapter; @@ -198,13 +209,18 @@ public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILau tabItem.setText(tab.getName()); tabItem.setImage(tab.getImage()); - Composite tabComp = new Composite(tabFolder, SWT.NONE); - tabComp.setLayout(new GridLayout()); - tabItem.setControl(tabComp); - - tab.createControl(tabComp); - Control configControl = tab.getControl(); - configControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + ScrolledComposite sc = new ScrolledComposite(tabItem.getParent(), SWT.V_SCROLL | SWT.H_SCROLL); + sc.setFont(tabItem.getParent().getFont()); + sc.setExpandHorizontal(true); + sc.setExpandVertical(true); + sc.setShowFocusedControl(true); + tab.createControl(sc); + Control control = tab.getControl(); + if (control != null) { + sc.setContent(control); + sc.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + tabItem.setControl(control.getParent()); + } return tabItem; }