Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java')
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java30
1 files changed, 30 insertions, 0 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 b97204dd..969e1814 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,6 +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
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
@@ -209,6 +210,35 @@ public class ControlFactory {
}
});
+ final TextCellEditor keyEditor = new TextCellEditor(tableviewer.getTable());
+ column.setEditingSupport(new EditingSupport(tableviewer) {
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ Command cmd = SetCommand.create(editor.getEditingDomain(), element, ApplicationPackageImpl.Literals.STRING_TO_STRING_MAP__KEY, value.toString().trim().length() == 0 ? null : value.toString());
+ if (cmd.canExecute()) {
+ editor.getEditingDomain().getCommandStack().execute(cmd);
+ tableviewer.refresh();
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ Entry<String, String> entry = (Entry<String, String>) element;
+ return entry.getKey();
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return keyEditor;
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+ });
+
// FIXME How can we react upon changes in the Map-Value?
column = new TableViewerColumn(tableviewer, SWT.NONE);
column.getColumn().setText(Messages.ControlFactory_Value);

Back to the top