From c198a352ec1f89203d328a466cb27ee6f6c78e2c Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Thu, 26 Jun 2008 10:43:12 +0000 Subject: [PATCH] Vertical scroll bar for paths and symbols page, bug 235301. --- .../cdt/ui/newui/AbstractCPropertyTab.java | 41 +++++++++++++------ .../cdt/ui/newui/AbstractLangsListTab.java | 3 +- .../eclipse/cdt/ui/newui/AbstractPage.java | 14 +++---- .../eclipse/cdt/ui/newui/CLocationTab.java | 6 +-- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java index 60e3963c2ea..339753f8a14 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java @@ -7,6 +7,7 @@ * * Contributors: * Intel Corporation - initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.ui.newui; @@ -48,6 +49,7 @@ import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; import org.eclipse.ui.dialogs.ISelectionStatusValidator; import org.eclipse.ui.model.WorkbenchContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; +import org.eclipse.ui.part.PageBook; import org.eclipse.ui.views.navigator.ResourceComparator; import org.eclipse.cdt.core.CCorePlugin; @@ -112,7 +114,10 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { protected static final String ENUM = "enum"; //$NON-NLS-1$ protected static final String SSET = "set"; //$NON-NLS-1$ - private CLabel background; + private PageBook pageBook; // to select between background and usercomp. + private CLabel background; + private Composite userdata; + protected Composite usercomp; // space where user can create widgets protected Composite buttoncomp; // space for buttons on the right private Button[] buttons; // buttons in buttoncomp @@ -136,15 +141,24 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { */ protected void createControls(Composite parent) { parent.setLayout(new FillLayout()); - background = new CLabel(parent, SWT.CENTER | SWT.SHADOW_NONE); + pageBook = new PageBook(parent, SWT.NULL); + + background = new CLabel(pageBook, SWT.CENTER | SWT.SHADOW_NONE); background.setText(EMPTY_STR); - background.setLayout(new GridLayout(2, false)); - usercomp = new Composite(background, SWT.NONE); - usercomp.setLayoutData(new GridData(GridData.FILL_BOTH)); - buttoncomp = new Composite(background, SWT.NONE); - GridData d = new GridData(GridData.END); - d.widthHint = 1; - buttoncomp.setLayoutData(d); + + GridData gd; + userdata= new Composite(pageBook, SWT.NONE); + userdata.setLayout(new GridLayout(2, false)); + + usercomp = new Composite(userdata, SWT.NONE); + usercomp.setLayoutData(gd= new GridData(GridData.FILL_BOTH)); + gd.widthHint= 150; + + buttoncomp = new Composite(userdata, SWT.NONE); + buttoncomp.setLayoutData(gd= new GridData(GridData.END)); + gd.widthHint= 150; + + pageBook.showPage(userdata); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, helpId); } @@ -628,9 +642,12 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { * @param msg - text to be shown instead of panes */ protected void setAllVisible(boolean visible, String msg) { - setBackgroundText(visible ? EMPTY_STR : msg); - usercomp.setVisible(visible); - buttoncomp.setVisible(visible); + if (!visible) { + setBackgroundText(msg); + pageBook.showPage(background); + } else { + pageBook.showPage(userdata); + } if (page != null) { Button b = page.getAButton(); if (b != null) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java index ec4d4f86ece..1668e1c9692 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java @@ -8,6 +8,7 @@ * Contributors: * Intel Corporation - initial API and implementation * IBM Corporation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.ui.newui; @@ -121,7 +122,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { addTree(sashForm).setLayoutData(new GridData(GridData.FILL_VERTICAL)); table = new Table(sashForm, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.FULL_SELECTION); gd = new GridData(GridData.FILL_BOTH); - gd.widthHint = 255; + gd.widthHint = 150; table.setLayoutData(gd); table.setHeaderVisible(isHeaderVisible()); table.setLinesVisible(true); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java index c45e59461af..8db9b15bd4e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java @@ -7,6 +7,7 @@ * * Contributors: * Intel Corporation - initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.ui.newui; @@ -243,6 +244,7 @@ implements Group configGroup = ControlFactory.createGroup(composite, EMPTY_STR, 1); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.grabExcessHorizontalSpace = true; + gd.widthHint= 150; configGroup.setLayoutData(gd); configGroup.setLayout(new GridLayout(3, false)); @@ -256,12 +258,7 @@ implements handleConfigSelection(); } }); - gd = new GridData(GridData.FILL); - gd.grabExcessHorizontalSpace = true; - gd.grabExcessVerticalSpace = true; - gd.horizontalAlignment = GridData.FILL; - gd.verticalAlignment = GridData.FILL; - + gd = new GridData(GridData.FILL_BOTH); configSelector.setLayoutData(gd); if (!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG)) { @@ -328,9 +325,10 @@ implements } public void createWidgets(Composite c) { + GridData gd; parentComposite = new Composite(c, SWT.NONE); - parentComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); - + parentComposite.setLayoutData(gd= new GridData(GridData.FILL_BOTH)); + gd.widthHint= 200; itabs.clear(); if (!isSingle()) { parentComposite.setLayout(new FillLayout()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java index 4f24b80a880..4091f2d1859 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java @@ -7,6 +7,7 @@ * * Contributors: * Intel Corporation - initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.ui.newui; @@ -250,12 +251,11 @@ public abstract class CLocationTab extends AbstractCPropertyTab { @Override public void updateData(ICResourceDescription _cfgd) { if (page.isMultiCfg()) { - usercomp.setVisible(false); + setAllVisible(false, ""); //$NON-NLS-1$ return; } - if ( !usercomp.getVisible()) - usercomp.setVisible(true); + setAllVisible(true, null); cfgd = _cfgd; src = new ArrayList<_Entry>(); for (ICExclusionPatternPathEntry e : getEntries(cfgd))