Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Spungin2014-03-20 07:50:25 -0400
committerSteven Spungin2014-03-20 11:49:14 -0400
commita670d891f14225ec7fef98426e235b750d049c68 (patch)
treeb30173692a0d7957b5b7fce336c171638c4eb6d1
parentd9b5a4e6142989fb1bc0d416f9c1b4172723894f (diff)
downloadorg.eclipse.e4.tools-a670d891f14225ec7fef98426e235b750d049c68.tar.gz
org.eclipse.e4.tools-a670d891f14225ec7fef98426e235b750d049c68.tar.xz
org.eclipse.e4.tools-a670d891f14225ec7fef98426e235b750d049c68.zip
resize key column after editing resize key column when provider adds row instead of when handler adds row (allows for resizing during init, and handles forms with multiple instances of editor on different tabs) no need to check for minimum width when packing Change-Id: Ia58ec1810c68a3ca2611a5a1c88327020168bcee Signed-off-by: Steven Spungin <steven@spungin.tv>
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java
index 9c73ca48..6775e46d 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java
@@ -8,7 +8,7 @@
* Contributors:
* Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
* Dirk Fauth <dirk.fauth@googlemail.com> - Bug 426986
- * Steven Spungin <steven@spungin.tv> - Bug 430660, 430664
+ * Steven Spungin <steven@spungin.tv> - Bug 430660, 430664, Bug 430809
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
@@ -17,7 +17,9 @@ import java.util.List;
import java.util.Map.Entry;
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.observable.list.IListChangeListener;
import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.list.ListChangeEvent;
import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.IValueChangeListener;
@@ -99,7 +101,6 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
public class ControlFactory {
@@ -220,6 +221,7 @@ public class ControlFactory {
if (cmd.canExecute()) {
editor.getEditingDomain().getCommandStack().execute(cmd);
tableviewer.refresh();
+ tableviewer.getTable().getColumn(0).pack();
}
}
@@ -284,7 +286,15 @@ public class ControlFactory {
});
IEMFEditListProperty prop = EMFEditProperties.list(editor.getEditingDomain(), feature);
- tableviewer.setInput(prop.observeDetail(editor.getMaster()));
+ IObservableList observableList = prop.observeDetail(editor.getMaster());
+ tableviewer.setInput(observableList);
+ observableList.addListChangeListener(new IListChangeListener() {
+
+ @Override
+ public void handleListChange(ListChangeEvent event) {
+ tableviewer.getTable().getColumn(0).pack();
+ }
+ });
final Composite buttonComp = new Composite(parent, SWT.NONE);
buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false));
@@ -341,15 +351,6 @@ public class ControlFactory {
editor.getEditingDomain().getCommandStack().execute(cmd);
super.okPressed();
}
-
- // pack the first column
- if (tableviewer.getTable().getColumns().length > 0) {
- TableColumn tableColumn = tableviewer.getTable().getColumns()[0];
- tableColumn.pack();
- if (tableColumn.getWidth() < 20) {
- tableColumn.setWidth(20);
- }
- }
}
}
};

Back to the top