Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Spungin2014-03-18 22:59:57 -0400
committerSteven Spungin2014-03-18 23:27:44 -0400
commit279e6c716749bcfd6c53973a39337d977070ca8a (patch)
tree91460f38534d89fa10e6738210de2d9b92f25515
parentd848adeda39ba939bb91005d46dd69e3b7289508 (diff)
downloadorg.eclipse.e4.tools-279e6c716749bcfd6c53973a39337d977070ca8a.tar.gz
org.eclipse.e4.tools-279e6c716749bcfd6c53973a39337d977070ca8a.tar.xz
org.eclipse.e4.tools-279e6c716749bcfd6c53973a39337d977070ca8a.zip
Bug 430660 - unable to edit keys in application editor
Change-Id: I9babd958d11c1aff0450975581ff935b85bd3ce0 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.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