From 233d645861c82dddfc49e3c8a144ce0d0cbf4319 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Wed, 19 Apr 2017 11:02:46 +0300 Subject: [PATCH] Automatic table column resizing for SCL console manage imports dialog. refs #7150 Change-Id: Ie951241aaccbaa266eaaa42369ced699dd56aafb --- .../ui/imports/internal/ManageImportsDialog.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManageImportsDialog.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManageImportsDialog.java index 082a15114..f8fb202e3 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManageImportsDialog.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManageImportsDialog.java @@ -10,10 +10,12 @@ import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.TrayDialog; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.layout.TableColumnLayout; import org.eclipse.jface.resource.FontDescriptor; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; @@ -77,9 +79,13 @@ public class ManageImportsDialog extends TrayDialog { final Composite composite = (Composite) super.createDialogArea(parent); GridLayoutFactory.fillDefaults().margins(10,10).numColumns(2).applyTo(composite); GridDataFactory.fillDefaults().grab(true,true).applyTo(composite); - - tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); - GridDataFactory.fillDefaults().grab(true, true).applyTo(tableViewer.getControl()); + + Composite tableComposite = new Composite(composite, SWT.NONE); + TableColumnLayout tcl = new TableColumnLayout(); + tableComposite.setLayout(tcl); + GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite); + + tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); // Colors Display display = getShell().getDisplay(); @@ -186,6 +192,10 @@ public class ManageImportsDialog extends TrayDialog { } }); + tcl.setColumnData(column1.getColumn(), new ColumnWeightData(5, 300)); + tcl.setColumnData(column2.getColumn(), new ColumnWeightData(1, 150)); + tcl.setColumnData(column3.getColumn(), new ColumnWeightData(1, 200)); + // Decorations tableViewer.getTable().setHeaderVisible(true); tableViewer.getTable().setLinesVisible(true); -- 2.47.1