Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-04-09 04:58:34 -0400
committerUwe Stieber2013-04-09 04:58:34 -0400
commit3dc3211274b69bb3dd7c58089c0c13eb5ea3aa28 (patch)
treeebdf9af79c750da7adf4594d3feea989b48a2a8f /target_explorer/plugins/org.eclipse.tcf.te.ui.swt
parent9042daf4c16e9bdc547056d76b0d5d2abe7887b7 (diff)
downloadorg.eclipse.tcf-3dc3211274b69bb3dd7c58089c0c13eb5ea3aa28.tar.gz
org.eclipse.tcf-3dc3211274b69bb3dd7c58089c0c13eb5ea3aa28.tar.xz
org.eclipse.tcf-3dc3211274b69bb3dd7c58089c0c13eb5ea3aa28.zip
Target Explorer: Make sure title area dialogs get a vertical scroll bar if resized below the actual content size
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.ui.swt')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTitleAreaDialog.java50
1 files changed, 41 insertions, 9 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTitleAreaDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTitleAreaDialog.java
index 009c69b5e..a12d1d33b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTitleAreaDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTitleAreaDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011, 2013 Wind River Systems, Inc. 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
@@ -17,11 +17,13 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tcf.te.ui.swt.activator.UIPlugin;
import org.eclipse.ui.PlatformUI;
@@ -138,32 +140,62 @@ public class CustomTitleAreaDialog extends TitleAreaDialog implements IMessagePr
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createDialogArea(Composite parent) {
+ protected final Control createDialogArea(Composite parent) {
if (contextHelpId != null) {
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId);
}
// Let the super implementation create the dialog area control
Control control = super.createDialogArea(parent);
- // But fix the layout data for the top control
+ // Setup the inner panel as scrollable composite
if (control instanceof Composite) {
- configureDialogAreaControl((Composite)control);
+ ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL);
+
+ GridLayout layout = new GridLayout(1, true);
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ layout.verticalSpacing = 0; layout.horizontalSpacing = 0;
+
+ sc.setLayout(layout);
+ sc.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ sc.setExpandHorizontal(true);
+ sc.setExpandVertical(true);
+
+ // Give subclasses the chance to configure the new dialog area control
+ configureDialogAreaControl(sc);
+
+ Composite composite = new Composite(sc, SWT.NONE);
+ composite.setLayout(new GridLayout());
+
+ // Setup the dialog area content
+ createDialogAreaContent(composite);
+
+ sc.setContent(composite);
+ sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+
+ // Return the scrolled composite as new dialog area control
+ control = sc;
}
return control;
}
/**
+ * Creates the dialog area content.
+ *
+ * @param parent The parent composite. Must not be <code>null</code>.
+ */
+ protected void createDialogAreaContent(Composite parent) {
+ Assert.isNotNull(parent);
+ }
+
+ /**
* Configure the dialog top control.
*
* @param composite The dialog top control. Must not be <code>null</code>.
*/
protected void configureDialogAreaControl(Composite composite) {
Assert.isNotNull(composite);
- Layout layout = composite.getLayout();
- if (layout == null || layout instanceof GridLayout) {
- composite.setLayout(new GridLayout());
- }
}
/**

Back to the top