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
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
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/filetransfer/AddEditFileTransferDialog.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialPortAddressDialog.java18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/dialogs/CustomTitleAreaDialog.java50
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/NameValuePairDialog.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/RenameDialog.java16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/TreeViewerSearchDialog.java18
7 files changed, 78 insertions, 61 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/filetransfer/AddEditFileTransferDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/filetransfer/AddEditFileTransferDialog.java
index 7223abbfd..e307eac4e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/filetransfer/AddEditFileTransferDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/filetransfer/AddEditFileTransferDialog.java
@@ -78,20 +78,19 @@ public class AddEditFileTransferDialog extends CustomTitleAreaDialog {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createDialogArea(Composite parent) {
+ protected void createDialogAreaContent(Composite parent) {
+ super.createDialogAreaContent(parent);
+
// Set dialog title and default message
setDialogTitle(modeNew ? Messages.AddEditFileTransferDialog_add_dialogTitle : Messages.AddEditFileTransferDialog_edit_dialogTitle);
setTitle(modeNew ? Messages.AddEditFileTransferDialog_add_title : Messages.AddEditFileTransferDialog_edit_title);
setDefaultMessage(modeNew ? Messages.AddEditFileTransferDialog_add_message : Messages.AddEditFileTransferDialog_edit_message, IMessageProvider.INFORMATION);
- // Get the parent container composite
- Composite container = (Composite) super.createDialogArea(parent);
-
// Create the inner panel
- Composite panel = new Composite(container, SWT.NULL);
+ Composite panel = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0; layout.marginWidth = 0;
panel.setLayout(layout);
@@ -207,9 +206,7 @@ public class AddEditFileTransferDialog extends CustomTitleAreaDialog {
options.setupPanel(panel);
options.doCreateControlDecoration(target.getEditFieldControl());
- applyDialogFont(container);
-
- return container;
+ applyDialogFont(panel);
}
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java
index f218f6d03..29b8cd9c6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java
@@ -107,18 +107,18 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createDialogArea(Composite parent) {
- Composite top = (Composite)super.createDialogArea(parent);
+ protected void createDialogAreaContent(Composite parent) {
+ super.createDialogAreaContent(parent);
setDialogTitle(getDialogTitle());
setTitle(getTitle());
setDefaultMessage(getDefaultMessage(), IMessageProvider.NONE);
// Create the table viewer
- viewer = new TableViewer(top, (supportsMultiSelection() ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER);
+ viewer = new TableViewer(parent, (supportsMultiSelection() ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER);
// Configure the table
Table table = viewer.getTable();
@@ -146,7 +146,7 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog {
viewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, labelProvider));
// Create the filter buttons area
- createFilterButtons(top);
+ createFilterButtons(parent);
// Subclasses may customize the viewer before setting the input
configureTableViewer(viewer);
@@ -167,8 +167,6 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog {
}
}
});
-
- return top;
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialPortAddressDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialPortAddressDialog.java
index 1fc42eb9f..0f4ff4311 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialPortAddressDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialPortAddressDialog.java
@@ -75,16 +75,15 @@ public class SerialPortAddressDialog extends CustomTitleAreaDialog {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.dialogs.CustomTitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createDialogArea(Composite parent) {
- setDialogTitle(Messages.SerialLinePanel_customSerialDevice_title);
+ protected void createDialogAreaContent(Composite parent) {
+ super.createDialogAreaContent(parent);
- //set margins of dialog and apply dialog font
- Composite container = (Composite) super.createDialogArea(parent);
+ setDialogTitle(Messages.SerialLinePanel_customSerialDevice_title);
- Composite ttyComp = new Composite(container, SWT.NONE);
+ Composite ttyComp = new Composite(parent, SWT.NONE);
GridLayout gl = new GridLayout();
ttyComp.setLayout(gl);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -125,7 +124,7 @@ public class SerialPortAddressDialog extends CustomTitleAreaDialog {
}
});
- Composite tcpComp = new Composite(container, SWT.NONE);
+ Composite tcpComp = new Composite(parent, SWT.NONE);
gl = new GridLayout(4, true);
tcpComp.setLayout(gl);
gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -239,11 +238,10 @@ public class SerialPortAddressDialog extends CustomTitleAreaDialog {
Messages.SerialPortAddressDialog_Error_InvalidPortRange);
portControl.setEditFieldValidator(portValidator);
- applyDialogFont(container);
+ applyDialogFont(ttyComp);
+ applyDialogFont(tcpComp);
setupData();
-
- return container;
}
private void setupData() {
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());
- }
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/NameValuePairDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/NameValuePairDialog.java
index 208987fd0..ebcd36ed0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/NameValuePairDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/NameValuePairDialog.java
@@ -22,7 +22,6 @@ import org.eclipse.swt.events.ModifyListener;
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.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@@ -79,17 +78,17 @@ public class NameValuePairDialog extends CustomTitleAreaDialog {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createDialogArea(Composite parent) {
- Composite top = (Composite)super.createDialogArea(parent);
+ protected void createDialogAreaContent(Composite parent) {
+ super.createDialogAreaContent(parent);
setDialogTitle(dialogTitle);
setTitle(title);
setDefaultMessage(message, IMessageProvider.NONE);
- Composite panel = new Composite(top, SWT.NONE);
+ Composite panel = new Composite(parent, SWT.NONE);
panel.setLayout(new GridLayout(2, false));
panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
@@ -124,7 +123,6 @@ public class NameValuePairDialog extends CustomTitleAreaDialog {
});
applyDialogFont(panel);
- return panel;
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/RenameDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/RenameDialog.java
index f924cf20a..ee390573b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/RenameDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/dialogs/RenameDialog.java
@@ -74,19 +74,19 @@ public class RenameDialog extends CustomTitleAreaDialog {
this.newName = this.oldName;
}
- /*(non-Javadoc)
- * @see org.eclipse.tcf.te.ui.dialogs.CustomTitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createDialogArea(Composite parent) {
+ protected void createDialogAreaContent(Composite parent) {
+ super.createDialogAreaContent(parent);
+
setDialogTitle(dialogTitle);
setTitle(title);
setDefaultMessage(defaultMessage, IMessageProvider.INFORMATION);
- //set margins of dialog and apply dialog font
- Composite container = (Composite) super.createDialogArea(parent);
//we need two columns
- Composite comp = new Composite(container, SWT.NONE);
+ Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout(2, false));
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -112,9 +112,7 @@ public class RenameDialog extends CustomTitleAreaDialog {
}
});
- applyDialogFont(container);
-
- return container;
+ applyDialogFont(comp);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/TreeViewerSearchDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/TreeViewerSearchDialog.java
index 853450bd0..0dc464666 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/TreeViewerSearchDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/TreeViewerSearchDialog.java
@@ -30,7 +30,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.tcf.te.ui.activator.UIPlugin;
@@ -180,15 +179,14 @@ public class TreeViewerSearchDialog extends CustomTitleAreaDialog implements ISe
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
*/
- @Override
- protected Control createDialogArea(Composite parent) {
- // Create the main container
- Composite composite = (Composite) super.createDialogArea(parent);
- Composite container = new Composite(composite, SWT.NONE);
+ @Override
+ protected void createDialogAreaContent(Composite parent) {
+ super.createDialogAreaContent(parent);
+
+ Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout());
container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -204,8 +202,6 @@ public class TreeViewerSearchDialog extends CustomTitleAreaDialog implements ISe
String title = fSearchable.getSearchTitle();
getShell().setText(title);
this.setTitle(title);
-
- return composite;
}
/**

Back to the top