From: Tuukka Lehtonen Date: Wed, 19 Apr 2017 08:02:46 +0000 (+0300) Subject: Automatic table column resizing for SCL console manage imports dialog. X-Git-Tag: v1.29.0~102 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F24%2F424%2F1;p=simantics%2Fplatform.git Automatic table column resizing for SCL console manage imports dialog. refs #7150 Change-Id: Ie951241aaccbaa266eaaa42369ced699dd56aafb --- 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);