Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-04-11 10:51:59 +0000
committerUwe Stieber2013-04-11 10:51:59 +0000
commitd2c30d669b6f356278c16cd106391f75561bc37f (patch)
treeedd23e3d106eb93ad506956e580167bfcaf4bfb9 /target_explorer/plugins
parent88da84a4a2b52b5a274c6260b5f8a5317253d18b (diff)
downloadorg.eclipse.tcf-d2c30d669b6f356278c16cd106391f75561bc37f.tar.gz
org.eclipse.tcf-d2c30d669b6f356278c16cd106391f75561bc37f.tar.xz
org.eclipse.tcf-d2c30d669b6f356278c16cd106391f75561bc37f.zip
Target Explorer: Fix MemoryMapTable layouts columns badly if embedded in editor page. Table is to width and user must scroll to see buttons.
Diffstat (limited to 'target_explorer/plugins')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/MemoryMapTab.java66
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/TableUtils.java15
2 files changed, 50 insertions, 31 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/MemoryMapTab.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/MemoryMapTab.java
index ea9df2020..82c0a0833 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/MemoryMapTab.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/MemoryMapTab.java
@@ -10,7 +10,6 @@
package org.eclipse.tcf.te.tcf.launch.ui.editor.tabs;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@@ -42,38 +41,47 @@ public class MemoryMapTab extends TCFMemoryMapTab {
*/
public MyMemoryMapWidget(Composite composite, TCFNode node) {
super(composite, node);
+ }
- TableViewer viewer = getViewer();
- if (viewer != null) {
- Table table = viewer.getTable();
- Object layoutData = table.getLayoutData();
- if (layoutData instanceof GridData) {
- ((GridData)layoutData).widthHint = SWT.DEFAULT;
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.internal.debug.ui.commands.MemoryMapWidget#configureTableLayout(org.eclipse.swt.widgets.Table, int, int, java.lang.String[])
+ */
+ @Override
+ protected void configureTableLayout(Table table, int widthHint, int heighHint, String[] columnNames) {
+ Assert.isNotNull(table);
- TableColumn[] columns = table.getColumns();
- for (int i = 0; i < columns.length; i++) {
- switch (i) {
- case 0:
- columns[i].setData("widthHint", Integer.valueOf(37)); //$NON-NLS-1$
- break;
- case 1:
- case 2:
- columns[i].setData("widthHint", Integer.valueOf(10)); //$NON-NLS-1$
- break;
- case 4:
- columns[i].setData("widthHint", Integer.valueOf(18)); //$NON-NLS-1$
- break;
- default:
- columns[i].setData("widthHint", Integer.valueOf(7)); //$NON-NLS-1$
- break;
- }
- }
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = SWT.DEFAULT;
+ data.heightHint = heighHint;
+ table.setLayoutData(data);
- TableUtils.adjustTableColumnWidth(viewer);
- }
- }
+ for (int i = 0; i < columnNames.length; i++) {
+ final TableColumn column = new TableColumn(table, SWT.LEAD, i);
+ column.setMoveable(false);
+ column.setText(columnNames[i]);
+ switch (i) {
+ case 0:
+ column.setWidth(37);
+ column.setData("widthHint", Integer.valueOf(37)); //$NON-NLS-1$
+ break;
+ case 1:
+ case 2:
+ column.setWidth(10);
+ column.setData("widthHint", Integer.valueOf(10)); //$NON-NLS-1$
+ break;
+ case 4:
+ column.setWidth(18);
+ column.setData("widthHint", Integer.valueOf(18)); //$NON-NLS-1$
+ break;
+ default:
+ column.setWidth(7);
+ column.setData("widthHint", Integer.valueOf(7)); //$NON-NLS-1$
+ break;
+ }
+ }
+ TableUtils.adjustTableColumnWidth(table);
+ }
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/TableUtils.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/TableUtils.java
index e58dc4164..a4a67a7c2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/TableUtils.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/TableUtils.java
@@ -30,8 +30,19 @@ public final class TableUtils {
public static void adjustTableColumnWidth(Viewer viewer) {
if (!(viewer instanceof TableViewer)) return;
- final TableViewer tableViewer = (TableViewer)viewer;
- final Table table = tableViewer.getTable();
+ TableViewer tableViewer = (TableViewer)viewer;
+ adjustTableColumnWidth(tableViewer.getTable());
+ }
+
+ /**
+ * Determines the current visible width of the table and
+ * adjust the column width according to there relative weight.
+ *
+ * @param table The table or <code>null</code>.
+ */
+ public static void adjustTableColumnWidth(final Table table) {
+ if (table == null) return;
+
table.addControlListener(new ControlListener() {
@Override

Back to the top