Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schindl2010-05-25 15:48:31 +0000
committerThomas Schindl2010-05-25 15:48:31 +0000
commit2dd60db782930884044d6f4895807b9bc71a1a2e (patch)
treec296a7cce5f21963f69da6cf6955021462373e05
parentba72ade05968ba30b09bb383851441c3724fe384 (diff)
downloadorg.eclipse.e4.tools-2dd60db782930884044d6f4895807b9bc71a1a2e.tar.gz
org.eclipse.e4.tools-2dd60db782930884044d6f4895807b9bc71a1a2e.tar.xz
org.eclipse.e4.tools-2dd60db782930884044d6f4895807b9bc71a1a2e.zip
[Bug 304584] - [Tooling] Implement Workbench-Model-Toolingv20100525-1530
* added elementId for command parameters
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties1
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java40
3 files changed, 44 insertions, 0 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java
index 63842cab..f879dfc8 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java
@@ -53,6 +53,7 @@ public class Messages {
public static String CommandEditor_Down;
public static String CommandEditor_Add;
public static String CommandEditor_Remove;
+ public static String CommandEditor_ParameterId;
public static String DirectMenuItemEditor_Label;
public static String DirectMenuItemEditor_Description;
@@ -306,6 +307,8 @@ public class Messages {
public static String ContributionClassDialog_DialogTitle;
public static String ContributionClassDialog_Label_Classname;
public static String ContributionClassDialog_ShellTitle;
+
+
static {
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties
index 78ac0a14..4e9558a9 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties
@@ -48,6 +48,7 @@ CommandEditor_Up=Up
CommandEditor_Down=Down
CommandEditor_Add=Add ...
CommandEditor_Remove=Remove
+CommandEditor_ParameterId=Id
DirectMenuItemEditor_Label=DirectMenuItem
DirectMenuItemEditor_Description=DirectMenuItem bla bla bla
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java
index d22f35d8..9f0ad33d 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java
@@ -161,6 +161,46 @@ public class CommandEditor extends AbstractComponentEditor {
viewer.getControl().setLayoutData(gd);
{
+ IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID);
+
+ TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+ column.getColumn().setText(Messages.CommandEditor_ParameterId);
+ column.getColumn().setWidth(200);
+ column.setLabelProvider(new ObservableColumnLabelProvider<MCommandParameter>(prop.observeDetail(cp.getKnownElements())));
+ column.setEditingSupport(new EditingSupport(viewer) {
+ private TextCellEditor editor = new TextCellEditor(viewer.getTable());
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ if( value.toString().trim().length() == 0 ) {
+ value = null;
+ }
+
+ Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, value);
+ if( cmd.canExecute() ) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ MCommandParameter obj = (MCommandParameter) element;
+ return obj.getElementId() != null ? obj.getElementId() : ""; //$NON-NLS-1$
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return editor;
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+ });
+ }
+
+ {
IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME);
TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);

Back to the top