Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Obuchowicz2019-06-17 16:37:54 -0400
committerAndrew Obuchowicz2019-06-21 10:24:10 -0400
commit4eff8d4b2f99b831a37349bf393acac911e6bea5 (patch)
tree5a27f08b2a34f5a369ec16b040f0c5dc9056ae10 /org.eclipse.debug.ui/ui/org/eclipse/debug/internal
parent8b4ed4f66f68932f9c2bd141ea8dfcc3dc1c9cdf (diff)
downloadeclipse.platform.debug-4eff8d4b2f99b831a37349bf393acac911e6bea5.tar.gz
eclipse.platform.debug-4eff8d4b2f99b831a37349bf393acac911e6bea5.tar.xz
eclipse.platform.debug-4eff8d4b2f99b831a37349bf393acac911e6bea5.zip
Bug 548344 - Add inline editing support for environment variables tableI20190621-1800
Applied requested changes. Patch ready for review. Change-Id: Idfce2e6549a6c13af2b96b8e8c9c37f762e58c51 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TextGetSetEditingSupport.java62
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/EnvironmentVariable.java11
2 files changed, 73 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TextGetSetEditingSupport.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TextGetSetEditingSupport.java
new file mode 100644
index 000000000..ed8c04ec4
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TextGetSetEditingSupport.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Bug 548344
+// *******************************************************************************/
+
+package org.eclipse.debug.internal.ui;
+
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.widgets.Composite;
+
+public class TextGetSetEditingSupport<T> extends EditingSupport {
+ private Function<T, String> getter;
+ private BiConsumer<T, String> setter;
+ private ColumnViewer viewer;
+ public TextGetSetEditingSupport(ColumnViewer viewer, Function<T, String> getter, BiConsumer<T, String> setter) {
+ super(viewer);
+ this.viewer = viewer;
+ this.getter = getter;
+ this.setter = setter;
+
+ }
+
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return new TextCellEditor((Composite) getViewer().getControl());
+
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ return getter.apply((T) element);
+ }
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ setter.accept((T) element, (String) value);
+ viewer.update(element, null);
+
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/EnvironmentVariable.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/EnvironmentVariable.java
index a72174f6c..263157f24 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/EnvironmentVariable.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/EnvironmentVariable.java
@@ -11,6 +11,7 @@
* Contributors:
* Keith Seitz (keiths@redhat.com) - initial implementation
* IBM Corporation - integration and code cleanup
+ * Red Hat - Bug 548344
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -52,6 +53,7 @@ public class EnvironmentVariable
return value;
}
+
/**
* Sets this variable's value
* @param value
@@ -61,6 +63,15 @@ public class EnvironmentVariable
this.value = value;
}
+ /**
+ * Sets this variable's name
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
@Override
public String toString() {
return getName();

Back to the top