Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-04-09 09:06:19 +0000
committerUwe Stieber2013-04-09 09:06:19 +0000
commit1ea76786fb48d778e7b7dd3fc4b6417875225899 (patch)
treef1fc3e353c65f9fdc90a3593ca2a00e5f5e8b29c /target_explorer/plugins
parent3dc3211274b69bb3dd7c58089c0c13eb5ea3aa28 (diff)
downloadorg.eclipse.tcf-1ea76786fb48d778e7b7dd3fc4b6417875225899.tar.gz
org.eclipse.tcf-1ea76786fb48d778e7b7dd3fc4b6417875225899.tar.xz
org.eclipse.tcf-1ea76786fb48d778e7b7dd3fc4b6417875225899.zip
Target Explorer: Adapt custom tray dialog to use the same scrollable composite dialog area implementation as the custom title area dialog
Diffstat (limited to 'target_explorer/plugins')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTrayDialog.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java16
3 files changed, 53 insertions, 25 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTrayDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTrayDialog.java
index 38e647197..72f110e99 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTrayDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTrayDialog.java
@@ -16,10 +16,12 @@ import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.TrayDialog;
+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.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;
@@ -129,32 +131,62 @@ public class CustomTrayDialog extends TrayDialog {
* @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());
- }
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java
index 4bf3f4012..cead2df92 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java
@@ -14,7 +14,6 @@ import org.eclipse.swt.events.TypedEvent;
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.Shell;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
@@ -122,15 +121,15 @@ public class EncodingSelectionDialog extends CustomTrayDialog {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createDialogArea(Composite parent) {
- setDialogTitle(Messages.EncodingSelectionDialog_title);
+ protected void createDialogAreaContent(Composite parent) {
+ super.createDialogAreaContent(parent);
- Composite composite = (Composite)super.createDialogArea(parent);
+ setDialogTitle(Messages.EncodingSelectionDialog_title);
- Composite panel = new Composite(composite, SWT.NONE);
+ Composite panel = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0; layout.marginWidth = 0;
panel.setLayout(layout);
@@ -139,8 +138,7 @@ public class EncodingSelectionDialog extends CustomTrayDialog {
encodingPanel = new EncodingPanel();
encodingPanel.setupPanel(panel, null);
- applyDialogFont(composite);
- return composite;
+ applyDialogFont(panel);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
index 05bcfb6dc..a1e7dcf54 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
@@ -270,20 +270,20 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createDialogArea(Composite parent) {
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
+ protected void createDialogAreaContent(Composite parent) {
+ super.createDialogAreaContent(parent);
+
+ if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
UIPlugin.getTraceHandler().trace("Creating dialog area after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this);
}
setDialogTitle(Messages.LaunchTerminalSettingsDialog_title);
- Composite composite = (Composite)super.createDialogArea(parent);
-
- Composite panel = new Composite(composite, SWT.NONE);
+ Composite panel = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0; layout.marginWidth = 0;
panel.setLayout(layout);
@@ -356,14 +356,12 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
restoreWidgetValues();
- applyDialogFont(composite);
+ applyDialogFont(panel);
if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
UIPlugin.getTraceHandler().trace("Created dialog area after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this);
}
-
- return composite;
}
/**

Back to the top