Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2016-02-05 10:25:54 +0000
committerPierre-Charles David2016-02-08 13:23:57 +0000
commit2637da44591a4b636954f025060b9752be4eec4e (patch)
tree1bf7e0a9a2fa0241b2a5e91933eb66db12961c42
parent3e9d7941680a0cc77a4a36069f5dc6b0f10fa72e (diff)
downloadorg.eclipse.eef-2637da44591a4b636954f025060b9752be4eec4e.tar.gz
org.eclipse.eef-2637da44591a4b636954f025060b9752be4eec4e.tar.xz
org.eclipse.eef-2637da44591a4b636954f025060b9752be4eec4e.zip
Add support for button widgets
Bug: 482528 Change-Id: I35761c5fdcdc3f199e51aabfa45d5e2f88156126 Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/EEFControllersFactory.java20
-rw-r--r--plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFButtonController.java38
-rw-r--r--plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFButtonController.java107
-rw-r--r--plugins/org.eclipse.eef.edit/icons/full/obj16/EEFButtonDescription.gifbin0 -> 129 bytes
-rw-r--r--plugins/org.eclipse.eef.edit/plugin.properties3
-rw-r--r--plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFButtonDescriptionItemProvider.java150
-rw-r--r--plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFContainerDescriptionItemProvider.java3
-rw-r--r--plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFDynamicMappingCaseItemProvider.java3
-rw-r--r--plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EefItemProviderAdapterFactory.java26
-rw-r--r--plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFButtonLifecycleManager.java176
-rw-r--r--plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java9
-rw-r--r--plugins/org.eclipse.eef/model/eef.ecore13
-rw-r--r--plugins/org.eclipse.eef/model/eef.genmodel20
-rw-r--r--plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EEFButtonDescription.java75
-rw-r--r--plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefFactory.java8
-rw-r--r--plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefPackage.java121
-rw-r--r--plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EEFButtonDescriptionImpl.java230
-rw-r--r--plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefFactoryImpl.java14
-rw-r--r--plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefPackageImpl.java54
-rw-r--r--plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefAdapterFactory.java20
-rw-r--r--plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefSwitch.java27
21 files changed, 1106 insertions, 11 deletions
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/EEFControllersFactory.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/EEFControllersFactory.java
index b561aa45f..04b0e4a59 100644
--- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/EEFControllersFactory.java
+++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/EEFControllersFactory.java
@@ -10,11 +10,13 @@
*******************************************************************************/
package org.eclipse.eef.core.api.controllers;
+import org.eclipse.eef.EEFButtonDescription;
import org.eclipse.eef.EEFCheckboxDescription;
import org.eclipse.eef.EEFGroupDescription;
import org.eclipse.eef.EEFLabelDescription;
import org.eclipse.eef.EEFSelectDescription;
import org.eclipse.eef.EEFTextDescription;
+import org.eclipse.eef.core.internal.controllers.EEFButtonController;
import org.eclipse.eef.core.internal.controllers.EEFCheckboxController;
import org.eclipse.eef.core.internal.controllers.EEFGroupController;
import org.eclipse.eef.core.internal.controllers.EEFLabelController;
@@ -80,6 +82,24 @@ public class EEFControllersFactory {
}
/**
+ * Creates a new button controller.
+ *
+ * @param description
+ * The description
+ * @param variableManager
+ * The variable manager
+ * @param interpreter
+ * The interpreter
+ * @param editingDomain
+ * The editing domain
+ * @return A button controller
+ */
+ public IEEFButtonController createButtonController(EEFButtonDescription description, IVariableManager variableManager, IInterpreter interpreter,
+ TransactionalEditingDomain editingDomain) {
+ return new EEFButtonController(description, variableManager, interpreter, editingDomain);
+ }
+
+ /**
* Creates a new select controller.
*
* @param description
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFButtonController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFButtonController.java
new file mode 100644
index 000000000..6241acad2
--- /dev/null
+++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFButtonController.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2015, 2016 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.eef.core.api.controllers;
+
+/**
+ * The IEEFButtonController is responsible of supporting all the interactions with the widgets created for an
+ * EEFButtonDescription.
+ *
+ * @author sbegaudeau, pcdavid
+ */
+public interface IEEFButtonController extends IEEFWidgetController {
+ /**
+ * Register a consumer which will be called with the new value of the button's label when it will change.
+ *
+ * @param consumer
+ * The consumer of the new value of the button's label
+ */
+ void onNewButtonLabel(IConsumer<String> consumer);
+
+ /**
+ * Remove the consumer of the new value of the button's label.
+ */
+ void removeNewButtonLabelConsumer();
+
+ /**
+ * Invoked when the user pushes the button.
+ */
+ void pushed();
+
+}
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFButtonController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFButtonController.java
new file mode 100644
index 000000000..0e0deee0d
--- /dev/null
+++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFButtonController.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.eef.core.internal.controllers;
+
+import org.eclipse.eef.EEFButtonDescription;
+import org.eclipse.eef.EEFWidgetDescription;
+import org.eclipse.eef.EefPackage;
+import org.eclipse.eef.core.api.controllers.IConsumer;
+import org.eclipse.eef.core.api.controllers.IEEFButtonController;
+import org.eclipse.eef.core.api.utils.ISuccessfulResultConsumer;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.sirius.common.interpreter.api.IInterpreter;
+import org.eclipse.sirius.common.interpreter.api.IVariableManager;
+
+/**
+ * This class will be used in order to manage the behavior of the button.
+ *
+ * @author pcdavid
+ */
+public class EEFButtonController extends AbstractEEFWidgetController implements IEEFButtonController {
+ /**
+ * The description.
+ */
+ private EEFButtonDescription description;
+
+ /**
+ * The editing domain.
+ */
+ private TransactionalEditingDomain editingDomain;
+
+ /**
+ * The consumer of a new value of the button's label.
+ */
+ private IConsumer<String> newButtonLabelConsumer;
+
+ /**
+ * The constructor.
+ *
+ * @param description
+ * The description
+ * @param variableManager
+ * The variable manager
+ * @param interpreter
+ * The interpreter
+ * @param editingDomain
+ * The editing domain
+ */
+ public EEFButtonController(EEFButtonDescription description, IVariableManager variableManager, IInterpreter interpreter,
+ TransactionalEditingDomain editingDomain) {
+ super(variableManager, interpreter);
+ this.description = description;
+ this.editingDomain = editingDomain;
+ }
+
+ @Override
+ public void onNewButtonLabel(IConsumer<String> consumer) {
+ this.newButtonLabelConsumer = consumer;
+ }
+
+ @Override
+ public void removeNewButtonLabelConsumer() {
+ this.newButtonLabelConsumer = null;
+ }
+
+ @Override
+ protected EEFWidgetDescription getDescription() {
+ return this.description;
+ }
+
+ @Override
+ public void refresh() {
+ super.refresh();
+ String buttonLabelExpression = this.description.getButtonLabelExpression();
+ EAttribute eAttribute = EefPackage.Literals.EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION;
+
+ this.newEval().call(eAttribute, buttonLabelExpression, String.class, new ISuccessfulResultConsumer<String>() {
+ @Override
+ public void apply(String value) {
+ EEFButtonController.this.newButtonLabelConsumer.apply(value);
+ }
+ });
+ }
+
+ @Override
+ public void pushed() {
+ final Command command = new RecordingCommand(this.editingDomain) {
+ @Override
+ protected void doExecute() {
+ String pushExpression = EEFButtonController.this.description.getPushExpression();
+ EAttribute attr = EefPackage.Literals.EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION;
+ EEFButtonController.this.newEval().call(attr, pushExpression);
+ }
+ };
+ this.editingDomain.getCommandStack().execute(command);
+ }
+}
diff --git a/plugins/org.eclipse.eef.edit/icons/full/obj16/EEFButtonDescription.gif b/plugins/org.eclipse.eef.edit/icons/full/obj16/EEFButtonDescription.gif
new file mode 100644
index 000000000..ef56c1408
--- /dev/null
+++ b/plugins/org.eclipse.eef.edit/icons/full/obj16/EEFButtonDescription.gif
Binary files differ
diff --git a/plugins/org.eclipse.eef.edit/plugin.properties b/plugins/org.eclipse.eef.edit/plugin.properties
index a0ce1fbff..7296ff70f 100644
--- a/plugins/org.eclipse.eef.edit/plugin.properties
+++ b/plugins/org.eclipse.eef.edit/plugin.properties
@@ -67,3 +67,6 @@ _UI_EEFDynamicMappingCase_caseExpression_feature = Case Expression
_UI_EEFDynamicMappingCase_widget_feature = Widget
_UI_Unknown_feature = Unspecified
+_UI_EEFButtonDescription_type = EEF Button Description
+_UI_EEFButtonDescription_pushExpression_feature = Push Expression
+_UI_EEFButtonDescription_buttonLabelExpression_feature = Button Label Expression
diff --git a/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFButtonDescriptionItemProvider.java b/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFButtonDescriptionItemProvider.java
new file mode 100644
index 000000000..741833d71
--- /dev/null
+++ b/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFButtonDescriptionItemProvider.java
@@ -0,0 +1,150 @@
+/**
+ * Copyright (c) 2015 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.htm
+ * Contributors: Obeo - initial API and implementation
+ */
+package org.eclipse.eef.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.eef.EEFButtonDescription;
+import org.eclipse.eef.EefPackage;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.eef.EEFButtonDescription} object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class EEFButtonDescriptionItemProvider extends EEFWidgetDescriptionItemProvider {
+ /**
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EEFButtonDescriptionItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addButtonLabelExpressionPropertyDescriptor(object);
+ addPushExpressionPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Button Label Expression feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addButtonLabelExpressionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_EEFButtonDescription_buttonLabelExpression_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_EEFButtonDescription_buttonLabelExpression_feature", "_UI_EEFButtonDescription_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ EefPackage.Literals.EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Push Expression feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addPushExpressionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_EEFButtonDescription_pushExpression_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_EEFButtonDescription_pushExpression_feature", "_UI_EEFButtonDescription_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ EefPackage.Literals.EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null,
+ null));
+ }
+
+ /**
+ * This returns EEFButtonDescription.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/EEFButtonDescription")); //$NON-NLS-1$
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected boolean shouldComposeCreationImage() {
+ return true;
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((EEFButtonDescription) object).getIdentifier();
+ return label == null || label.length() == 0 ? getString("_UI_EEFButtonDescription_type") : //$NON-NLS-1$
+ getString("_UI_EEFButtonDescription_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating
+ * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(EEFButtonDescription.class)) {
+ case EefPackage.EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION:
+ case EefPackage.EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created
+ * under this object. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFContainerDescriptionItemProvider.java b/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFContainerDescriptionItemProvider.java
index bcdea8f1c..2e2d8c2da 100644
--- a/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFContainerDescriptionItemProvider.java
+++ b/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFContainerDescriptionItemProvider.java
@@ -181,6 +181,9 @@ ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
EefFactory.eINSTANCE.createEEFLabelDescription()));
newChildDescriptors.add(createChildParameter(EefPackage.Literals.EEF_CONTAINER_DESCRIPTION__WIDGETS,
+ EefFactory.eINSTANCE.createEEFButtonDescription()));
+
+ newChildDescriptors.add(createChildParameter(EefPackage.Literals.EEF_CONTAINER_DESCRIPTION__WIDGETS,
EefFactory.eINSTANCE.createEEFCheckboxDescription()));
newChildDescriptors.add(createChildParameter(EefPackage.Literals.EEF_CONTAINER_DESCRIPTION__WIDGETS,
diff --git a/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFDynamicMappingCaseItemProvider.java b/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFDynamicMappingCaseItemProvider.java
index ad83476c3..88351a92c 100644
--- a/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFDynamicMappingCaseItemProvider.java
+++ b/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EEFDynamicMappingCaseItemProvider.java
@@ -179,6 +179,9 @@ ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
EefFactory.eINSTANCE.createEEFLabelDescription()));
newChildDescriptors.add(createChildParameter(EefPackage.Literals.EEF_DYNAMIC_MAPPING_CASE__WIDGET,
+ EefFactory.eINSTANCE.createEEFButtonDescription()));
+
+ newChildDescriptors.add(createChildParameter(EefPackage.Literals.EEF_DYNAMIC_MAPPING_CASE__WIDGET,
EefFactory.eINSTANCE.createEEFCheckboxDescription()));
newChildDescriptors.add(createChildParameter(EefPackage.Literals.EEF_DYNAMIC_MAPPING_CASE__WIDGET,
diff --git a/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EefItemProviderAdapterFactory.java b/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EefItemProviderAdapterFactory.java
index 8aa2a4748..7ef6fcc9a 100644
--- a/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EefItemProviderAdapterFactory.java
+++ b/plugins/org.eclipse.eef.edit/src-gen/org/eclipse/eef/provider/EefItemProviderAdapterFactory.java
@@ -212,6 +212,29 @@ public class EefItemProviderAdapterFactory extends EefAdapterFactory implements
}
/**
+ * This keeps track of the one adapter used for all {@link org.eclipse.eef.EEFButtonDescription} instances. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected EEFButtonDescriptionItemProvider eefButtonDescriptionItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.eef.EEFButtonDescription}. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createEEFButtonDescriptionAdapter() {
+ if (eefButtonDescriptionItemProvider == null) {
+ eefButtonDescriptionItemProvider = new EEFButtonDescriptionItemProvider(this);
+ }
+
+ return eefButtonDescriptionItemProvider;
+ }
+
+ /**
* This keeps track of the one adapter used for all {@link org.eclipse.eef.EEFCheckboxDescription} instances. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
@@ -444,6 +467,9 @@ public class EefItemProviderAdapterFactory extends EefAdapterFactory implements
if (eefLabelDescriptionItemProvider != null) {
eefLabelDescriptionItemProvider.dispose();
}
+ if (eefButtonDescriptionItemProvider != null) {
+ eefButtonDescriptionItemProvider.dispose();
+ }
if (eefCheckboxDescriptionItemProvider != null) {
eefCheckboxDescriptionItemProvider.dispose();
}
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFButtonLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFButtonLifecycleManager.java
new file mode 100644
index 000000000..81bc14bb4
--- /dev/null
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFButtonLifecycleManager.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2015, 2016 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.eef.ide.ui.internal.widgets;
+
+import org.eclipse.eef.EEFButtonDescription;
+import org.eclipse.eef.core.api.controllers.EEFControllersFactory;
+import org.eclipse.eef.core.api.controllers.IConsumer;
+import org.eclipse.eef.core.api.controllers.IEEFButtonController;
+import org.eclipse.eef.properties.ui.api.EEFTabbedPropertySheetPage;
+import org.eclipse.eef.properties.ui.api.EEFTabbedPropertySheetWidgetFactory;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.sirius.common.interpreter.api.IInterpreter;
+import org.eclipse.sirius.common.interpreter.api.IVariableManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * This class will be used in order to manager the lifecycle of a button.
+ *
+ * @author pcdavid
+ */
+public class EEFButtonLifecycleManager implements ILifecycleManager {
+ /**
+ * The key used for the help image.
+ */
+ private static final String DLG_IMG_HELP = "dialog_help_image"; //$NON-NLS-1$
+
+ /**
+ * The description.
+ */
+ private EEFButtonDescription description;
+
+ /**
+ * The variable manager.
+ */
+ private IVariableManager variableManager;
+
+ /**
+ * The interpreter.
+ */
+ private IInterpreter interpreter;
+
+ /**
+ * The editing domain.
+ */
+ private TransactionalEditingDomain editingDomain;
+
+ /**
+ * The button.
+ */
+ private Button button;
+
+ /**
+ * The label.
+ */
+ private Label label;
+
+ /**
+ * The help label.
+ */
+ private Label help;
+
+ /**
+ * The controller.
+ */
+ private IEEFButtonController controller;
+
+ /**
+ * The listener on the button.
+ */
+ private SelectionListener selectionListener;
+
+ /**
+ * The constructor.
+ *
+ * @param description
+ * The description
+ * @param variableManager
+ * The variable manager
+ * @param interpreter
+ * The interpreter
+ * @param editingDomain
+ * The editing domain
+ */
+ public EEFButtonLifecycleManager(EEFButtonDescription description, IVariableManager variableManager, IInterpreter interpreter,
+ TransactionalEditingDomain editingDomain) {
+ this.description = description;
+ this.variableManager = variableManager;
+ this.interpreter = interpreter;
+ this.editingDomain = editingDomain;
+ }
+
+ @Override
+ public void createControl(Composite parent, EEFTabbedPropertySheetPage tabbedPropertySheetPage) {
+ EEFTabbedPropertySheetWidgetFactory widgetFactory = tabbedPropertySheetPage.getWidgetFactory();
+
+ this.label = widgetFactory.createLabel(parent, ""); //$NON-NLS-1$
+
+ this.button = widgetFactory.createButton(parent, "DO IT", SWT.NONE); //$NON-NLS-1$
+ // this.button.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
+ widgetFactory.paintBordersFor(parent);
+ GridData nameData = new GridData(GridData.BEGINNING);
+ this.button.setLayoutData(nameData);
+
+ this.help = widgetFactory.createLabel(parent, ""); //$NON-NLS-1$
+ Image image = JFaceResources.getImage(DLG_IMG_HELP);
+ help.setImage(image);
+ help.setToolTipText("There should be some help in this tooltip..."); //$NON-NLS-1$
+
+ this.controller = new EEFControllersFactory().createButtonController(this.description, this.variableManager, this.interpreter,
+ this.editingDomain);
+ }
+
+ @Override
+ public void aboutToBeShown() {
+ this.selectionListener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ controller.pushed();
+ }
+ };
+ this.button.addSelectionListener(this.selectionListener);
+
+ this.controller.onNewLabel(new IConsumer<String>() {
+ @Override
+ public void apply(String value) {
+ if (!label.isDisposed() && !(label.getText() != null && label.getText().equals(value))) {
+ label.setText(value);
+ }
+ }
+ });
+ this.controller.onNewButtonLabel(new IConsumer<String>() {
+ @Override
+ public void apply(String value) {
+ if (!button.isDisposed() && !(button.getText() != null && button.getText().equals(value))) {
+ button.setText(value);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void refresh() {
+ this.controller.refresh();
+ }
+
+ @Override
+ public void aboutToBeHidden() {
+ if (!button.isDisposed()) {
+ this.button.removeSelectionListener(this.selectionListener);
+ }
+ this.controller.removeNewLabelConsumer();
+ this.controller.removeNewButtonLabelConsumer();
+ }
+
+ @Override
+ public void dispose() {
+ // do nothing
+ }
+}
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java
index 2abcc7e44..f636e2a63 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java
@@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.eef.EEFButtonDescription;
import org.eclipse.eef.EEFCheckboxDescription;
import org.eclipse.eef.EEFContainerDescription;
import org.eclipse.eef.EEFDynamicMappingCase;
@@ -152,6 +153,14 @@ public class EEFContainerLifecycleManager implements ILifecycleManager {
eefCheckboxLifecycleManager.createControl(parent, tabbedPropertySheetPage);
this.lifecycleManagers.add(eefCheckboxLifecycleManager);
+ } else if (eefWidgetDescription instanceof EEFButtonDescription) {
+ EEFButtonDescription eefButtonDescription = (EEFButtonDescription) eefWidgetDescription;
+
+ EEFButtonLifecycleManager eefButtonLifecycleManager = new EEFButtonLifecycleManager(eefButtonDescription, childVariableManager,
+ interpreter, editingDomain);
+ eefButtonLifecycleManager.createControl(parent, tabbedPropertySheetPage);
+
+ this.lifecycleManagers.add(eefButtonLifecycleManager);
}
}
diff --git a/plugins/org.eclipse.eef/model/eef.ecore b/plugins/org.eclipse.eef/model/eef.ecore
index fec44f149..ab47c144f 100644
--- a/plugins/org.eclipse.eef/model/eef.ecore
+++ b/plugins/org.eclipse.eef/model/eef.ecore
@@ -124,6 +124,19 @@
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="EEFLabelDescription" eSuperTypes="#//EEFWidgetDescription"/>
+ <eClassifiers xsi:type="ecore:EClass" name="EEFButtonDescription" eSuperTypes="#//EEFWidgetDescription">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="buttonLabelExpression"
+ eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Indicates how to display the input value."/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="pushExpression" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Defines the behavior executed when the end-user updates the value of the text field."/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="EEFCheckboxDescription" eSuperTypes="#//EEFWidgetDescription">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Represents a checkbox used to edit a boolean property."/>
diff --git a/plugins/org.eclipse.eef/model/eef.genmodel b/plugins/org.eclipse.eef/model/eef.genmodel
index 08014c6bb..52b88bc95 100644
--- a/plugins/org.eclipse.eef/model/eef.genmodel
+++ b/plugins/org.eclipse.eef/model/eef.genmodel
@@ -43,6 +43,20 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFTextDescription/editExpression"/>
</genClasses>
<genClasses ecoreClass="eef.ecore#//EEFLabelDescription"/>
+ <genClasses ecoreClass="eef.ecore#//EEFButtonDescription">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFButtonDescription/buttonLabelExpression"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFButtonDescription/pushExpression"/>
+ </genClasses>
+ <genClasses ecoreClass="eef.ecore#//EEFCheckboxDescription">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFCheckboxDescription/valueExpression"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFCheckboxDescription/editExpression"/>
+ </genClasses>
+ <genClasses ecoreClass="eef.ecore#//EEFSelectDescription">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFSelectDescription/valueExpression"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFSelectDescription/editExpression"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFSelectDescription/candidatesExpression"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFSelectDescription/candidateDisplayExpression"/>
+ </genClasses>
<genClasses ecoreClass="eef.ecore#//EEFDynamicMappingFor">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFDynamicMappingFor/iterator"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFDynamicMappingFor/domainClassExpression"/>
@@ -56,11 +70,5 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFDynamicMappingCase/caseExpression"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference eef.ecore#//EEFDynamicMappingCase/widget"/>
</genClasses>
- <genClasses ecoreClass="eef.ecore#//EEFSelectDescription">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFSelectDescription/valueExpression"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFSelectDescription/editExpression"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFSelectDescription/candidatesExpression"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eef.ecore#//EEFSelectDescription/candidateDisplayExpression"/>
- </genClasses>
</genPackages>
</genmodel:GenModel>
diff --git a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EEFButtonDescription.java b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EEFButtonDescription.java
new file mode 100644
index 000000000..7cafc4a89
--- /dev/null
+++ b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EEFButtonDescription.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2015 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.htm
+ * Contributors: Obeo - initial API and implementation
+ */
+package org.eclipse.eef;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>EEF Button Description</b></em>'. <!--
+ * end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.eef.EEFButtonDescription#getButtonLabelExpression <em>Button Label Expression</em>}</li>
+ * <li>{@link org.eclipse.eef.EEFButtonDescription#getPushExpression <em>Push Expression</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.eef.EefPackage#getEEFButtonDescription()
+ * @model
+ * @generated
+ */
+public interface EEFButtonDescription extends EEFWidgetDescription {
+ /**
+ * Returns the value of the '<em><b>Button Label Expression</b></em>' attribute. <!-- begin-user-doc --> <!--
+ * end-user-doc --> <!-- begin-model-doc --> Indicates how to display the input value. <!-- end-model-doc -->
+ *
+ * @return the value of the '<em>Button Label Expression</em>' attribute.
+ * @see #setButtonLabelExpression(String)
+ * @see org.eclipse.eef.EefPackage#getEEFButtonDescription_ButtonLabelExpression()
+ * @model
+ * @generated
+ */
+ String getButtonLabelExpression();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.eef.EEFButtonDescription#getButtonLabelExpression
+ * <em>Button Label Expression</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Button Label Expression</em>' attribute.
+ * @see #getButtonLabelExpression()
+ * @generated
+ */
+ void setButtonLabelExpression(String value);
+
+ /**
+ * Returns the value of the '<em><b>Push Expression</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc
+ * --> <!-- begin-model-doc --> Defines the behavior executed when the end-user updates the value of the text field.
+ * <!-- end-model-doc -->
+ *
+ * @return the value of the '<em>Push Expression</em>' attribute.
+ * @see #setPushExpression(String)
+ * @see org.eclipse.eef.EefPackage#getEEFButtonDescription_PushExpression()
+ * @model
+ * @generated
+ */
+ String getPushExpression();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.eef.EEFButtonDescription#getPushExpression <em>Push Expression</em>}'
+ * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Push Expression</em>' attribute.
+ * @see #getPushExpression()
+ * @generated
+ */
+ void setPushExpression(String value);
+
+} // EEFButtonDescription
diff --git a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefFactory.java b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefFactory.java
index 9942d51ac..342e9a35d 100644
--- a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefFactory.java
+++ b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefFactory.java
@@ -74,6 +74,14 @@ public interface EefFactory extends EFactory {
EEFLabelDescription createEEFLabelDescription();
/**
+ * Returns a new object of class '<em>EEF Button Description</em>'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return a new object of class '<em>EEF Button Description</em>'.
+ * @generated
+ */
+ EEFButtonDescription createEEFButtonDescription();
+
+ /**
* Returns a new object of class '<em>EEF Checkbox Description</em>'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return a new object of class '<em>EEF Checkbox Description</em>'.
diff --git a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefPackage.java b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefPackage.java
index e76ae846e..e6e88dc50 100644
--- a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefPackage.java
+++ b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/EefPackage.java
@@ -396,6 +396,59 @@ public interface EefPackage extends EPackage {
int EEF_LABEL_DESCRIPTION_FEATURE_COUNT = EefPackage.EEF_WIDGET_DESCRIPTION_FEATURE_COUNT + 0;
/**
+ * The meta object id for the '{@link org.eclipse.eef.impl.EEFButtonDescriptionImpl <em>EEF Button Description</em>}
+ * ' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.eef.impl.EEFButtonDescriptionImpl
+ * @see org.eclipse.eef.impl.EefPackageImpl#getEEFButtonDescription()
+ * @generated
+ */
+ int EEF_BUTTON_DESCRIPTION = 7;
+
+ /**
+ * The feature id for the '<em><b>Identifier</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EEF_BUTTON_DESCRIPTION__IDENTIFIER = EefPackage.EEF_WIDGET_DESCRIPTION__IDENTIFIER;
+
+ /**
+ * The feature id for the '<em><b>Label Expression</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EEF_BUTTON_DESCRIPTION__LABEL_EXPRESSION = EefPackage.EEF_WIDGET_DESCRIPTION__LABEL_EXPRESSION;
+
+ /**
+ * The feature id for the '<em><b>Button Label Expression</b></em>' attribute. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION = EefPackage.EEF_WIDGET_DESCRIPTION_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Push Expression</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION = EefPackage.EEF_WIDGET_DESCRIPTION_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>EEF Button Description</em>' class. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EEF_BUTTON_DESCRIPTION_FEATURE_COUNT = EefPackage.EEF_WIDGET_DESCRIPTION_FEATURE_COUNT + 2;
+
+ /**
* The meta object id for the '{@link org.eclipse.eef.impl.EEFCheckboxDescriptionImpl
* <em>EEF Checkbox Description</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
*
@@ -403,7 +456,7 @@ public interface EefPackage extends EPackage {
* @see org.eclipse.eef.impl.EefPackageImpl#getEEFCheckboxDescription()
* @generated
*/
- int EEF_CHECKBOX_DESCRIPTION = 7;
+ int EEF_CHECKBOX_DESCRIPTION = 8;
/**
* The feature id for the '<em><b>Identifier</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -456,7 +509,7 @@ public interface EefPackage extends EPackage {
* @see org.eclipse.eef.impl.EefPackageImpl#getEEFSelectDescription()
* @generated
*/
- int EEF_SELECT_DESCRIPTION = 8;
+ int EEF_SELECT_DESCRIPTION = 9;
/**
* The feature id for the '<em><b>Identifier</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -527,7 +580,7 @@ public interface EefPackage extends EPackage {
* @see org.eclipse.eef.impl.EefPackageImpl#getEEFDynamicMappingFor()
* @generated
*/
- int EEF_DYNAMIC_MAPPING_FOR = 9;
+ int EEF_DYNAMIC_MAPPING_FOR = 10;
/**
* The feature id for the '<em><b>Iterator</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -572,7 +625,7 @@ public interface EefPackage extends EPackage {
* @see org.eclipse.eef.impl.EefPackageImpl#getEEFDynamicMappingSwitch()
* @generated
*/
- int EEF_DYNAMIC_MAPPING_SWITCH = 10;
+ int EEF_DYNAMIC_MAPPING_SWITCH = 11;
/**
* The feature id for the '<em><b>Switch Expression</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc
@@ -609,7 +662,7 @@ public interface EefPackage extends EPackage {
* @see org.eclipse.eef.impl.EefPackageImpl#getEEFDynamicMappingCase()
* @generated
*/
- int EEF_DYNAMIC_MAPPING_CASE = 11;
+ int EEF_DYNAMIC_MAPPING_CASE = 12;
/**
* The feature id for the '<em><b>Case Expression</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -932,6 +985,38 @@ public interface EefPackage extends EPackage {
EClass getEEFLabelDescription();
/**
+ * Returns the meta object for class '{@link org.eclipse.eef.EEFButtonDescription <em>EEF Button Description</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>EEF Button Description</em>'.
+ * @see org.eclipse.eef.EEFButtonDescription
+ * @generated
+ */
+ EClass getEEFButtonDescription();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.eef.EEFButtonDescription#getButtonLabelExpression
+ * <em>Button Label Expression</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Button Label Expression</em>'.
+ * @see org.eclipse.eef.EEFButtonDescription#getButtonLabelExpression()
+ * @see #getEEFButtonDescription()
+ * @generated
+ */
+ EAttribute getEEFButtonDescription_ButtonLabelExpression();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.eef.EEFButtonDescription#getPushExpression
+ * <em>Push Expression</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Push Expression</em>'.
+ * @see org.eclipse.eef.EEFButtonDescription#getPushExpression()
+ * @see #getEEFButtonDescription()
+ * @generated
+ */
+ EAttribute getEEFButtonDescription_PushExpression();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.eef.EEFCheckboxDescription
* <em>EEF Checkbox Description</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
@@ -1378,6 +1463,32 @@ public interface EefPackage extends EPackage {
EClass EEF_LABEL_DESCRIPTION = EefPackage.eINSTANCE.getEEFLabelDescription();
/**
+ * The meta object literal for the '{@link org.eclipse.eef.impl.EEFButtonDescriptionImpl
+ * <em>EEF Button Description</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.eef.impl.EEFButtonDescriptionImpl
+ * @see org.eclipse.eef.impl.EefPackageImpl#getEEFButtonDescription()
+ * @generated
+ */
+ EClass EEF_BUTTON_DESCRIPTION = EefPackage.eINSTANCE.getEEFButtonDescription();
+
+ /**
+ * The meta object literal for the '<em><b>Button Label Expression</b></em>' attribute feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION = EefPackage.eINSTANCE.getEEFButtonDescription_ButtonLabelExpression();
+
+ /**
+ * The meta object literal for the '<em><b>Push Expression</b></em>' attribute feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION = EefPackage.eINSTANCE.getEEFButtonDescription_PushExpression();
+
+ /**
* The meta object literal for the '{@link org.eclipse.eef.impl.EEFCheckboxDescriptionImpl
* <em>EEF Checkbox Description</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
*
diff --git a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EEFButtonDescriptionImpl.java b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EEFButtonDescriptionImpl.java
new file mode 100644
index 000000000..86f10c9cd
--- /dev/null
+++ b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EEFButtonDescriptionImpl.java
@@ -0,0 +1,230 @@
+/**
+ * Copyright (c) 2015 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.htm
+ * Contributors: Obeo - initial API and implementation
+ */
+package org.eclipse.eef.impl;
+
+import org.eclipse.eef.EEFButtonDescription;
+import org.eclipse.eef.EefPackage;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>EEF Button Description</b></em>'. <!--
+ * end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.eef.impl.EEFButtonDescriptionImpl#getButtonLabelExpression <em>Button Label Expression</em>}</li>
+ * <li>{@link org.eclipse.eef.impl.EEFButtonDescriptionImpl#getPushExpression <em>Push Expression</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class EEFButtonDescriptionImpl extends EEFWidgetDescriptionImpl implements EEFButtonDescription {
+ /**
+ * The default value of the '{@link #getButtonLabelExpression() <em>Button Label Expression</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getButtonLabelExpression()
+ * @generated
+ * @ordered
+ */
+ protected static final String BUTTON_LABEL_EXPRESSION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getButtonLabelExpression() <em>Button Label Expression</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getButtonLabelExpression()
+ * @generated
+ * @ordered
+ */
+ protected String buttonLabelExpression = EEFButtonDescriptionImpl.BUTTON_LABEL_EXPRESSION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getPushExpression() <em>Push Expression</em>}' attribute. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @see #getPushExpression()
+ * @generated
+ * @ordered
+ */
+ protected static final String PUSH_EXPRESSION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getPushExpression() <em>Push Expression</em>}' attribute. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @see #getPushExpression()
+ * @generated
+ * @ordered
+ */
+ protected String pushExpression = EEFButtonDescriptionImpl.PUSH_EXPRESSION_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected EEFButtonDescriptionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return EefPackage.Literals.EEF_BUTTON_DESCRIPTION;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String getButtonLabelExpression() {
+ return buttonLabelExpression;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void setButtonLabelExpression(String newButtonLabelExpression) {
+ String oldButtonLabelExpression = buttonLabelExpression;
+ buttonLabelExpression = newButtonLabelExpression;
+ if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.SET, EefPackage.EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION,
+ oldButtonLabelExpression, buttonLabelExpression));
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String getPushExpression() {
+ return pushExpression;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void setPushExpression(String newPushExpression) {
+ String oldPushExpression = pushExpression;
+ pushExpression = newPushExpression;
+ if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.SET, EefPackage.EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION, oldPushExpression,
+ pushExpression));
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case EefPackage.EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION:
+ return getButtonLabelExpression();
+ case EefPackage.EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION:
+ return getPushExpression();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case EefPackage.EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION:
+ setButtonLabelExpression((String) newValue);
+ return;
+ case EefPackage.EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION:
+ setPushExpression((String) newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case EefPackage.EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION:
+ setButtonLabelExpression(EEFButtonDescriptionImpl.BUTTON_LABEL_EXPRESSION_EDEFAULT);
+ return;
+ case EefPackage.EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION:
+ setPushExpression(EEFButtonDescriptionImpl.PUSH_EXPRESSION_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case EefPackage.EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION:
+ return EEFButtonDescriptionImpl.BUTTON_LABEL_EXPRESSION_EDEFAULT == null ? buttonLabelExpression != null
+ : !EEFButtonDescriptionImpl.BUTTON_LABEL_EXPRESSION_EDEFAULT.equals(buttonLabelExpression);
+ case EefPackage.EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION:
+ return EEFButtonDescriptionImpl.PUSH_EXPRESSION_EDEFAULT == null ? pushExpression != null
+ : !EEFButtonDescriptionImpl.PUSH_EXPRESSION_EDEFAULT.equals(pushExpression);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) {
+ return super.toString();
+ }
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (buttonLabelExpression: "); //$NON-NLS-1$
+ result.append(buttonLabelExpression);
+ result.append(", pushExpression: "); //$NON-NLS-1$
+ result.append(pushExpression);
+ result.append(')');
+ return result.toString();
+ }
+
+} // EEFButtonDescriptionImpl
diff --git a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefFactoryImpl.java b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefFactoryImpl.java
index be3163d5f..459e207d5 100644
--- a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefFactoryImpl.java
+++ b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefFactoryImpl.java
@@ -8,6 +8,7 @@
*/
package org.eclipse.eef.impl;
+import org.eclipse.eef.EEFButtonDescription;
import org.eclipse.eef.EEFCheckboxDescription;
import org.eclipse.eef.EEFContainerDescription;
import org.eclipse.eef.EEFDynamicMappingCase;
@@ -79,6 +80,8 @@ public class EefFactoryImpl extends EFactoryImpl implements EefFactory {
return createEEFTextDescription();
case EefPackage.EEF_LABEL_DESCRIPTION:
return createEEFLabelDescription();
+ case EefPackage.EEF_BUTTON_DESCRIPTION:
+ return createEEFButtonDescription();
case EefPackage.EEF_CHECKBOX_DESCRIPTION:
return createEEFCheckboxDescription();
case EefPackage.EEF_SELECT_DESCRIPTION:
@@ -166,6 +169,17 @@ public class EefFactoryImpl extends EFactoryImpl implements EefFactory {
* @generated
*/
@Override
+ public EEFButtonDescription createEEFButtonDescription() {
+ EEFButtonDescriptionImpl eefButtonDescription = new EEFButtonDescriptionImpl();
+ return eefButtonDescription;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
public EEFCheckboxDescription createEEFCheckboxDescription() {
EEFCheckboxDescriptionImpl eefCheckboxDescription = new EEFCheckboxDescriptionImpl();
return eefCheckboxDescription;
diff --git a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefPackageImpl.java b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefPackageImpl.java
index c892e0b00..661b2688f 100644
--- a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefPackageImpl.java
+++ b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/impl/EefPackageImpl.java
@@ -8,6 +8,7 @@
*/
package org.eclipse.eef.impl;
+import org.eclipse.eef.EEFButtonDescription;
import org.eclipse.eef.EEFCheckboxDescription;
import org.eclipse.eef.EEFContainerDescription;
import org.eclipse.eef.EEFDynamicMappingCase;
@@ -89,6 +90,13 @@ public class EefPackageImpl extends EPackageImpl implements EefPackage {
*
* @generated
*/
+ private EClass eefButtonDescriptionEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
private EClass eefCheckboxDescriptionEClass = null;
/**
@@ -460,6 +468,36 @@ public class EefPackageImpl extends EPackageImpl implements EefPackage {
* @generated
*/
@Override
+ public EClass getEEFButtonDescription() {
+ return eefButtonDescriptionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public EAttribute getEEFButtonDescription_ButtonLabelExpression() {
+ return (EAttribute) eefButtonDescriptionEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public EAttribute getEEFButtonDescription_PushExpression() {
+ return (EAttribute) eefButtonDescriptionEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
public EClass getEEFCheckboxDescription() {
return eefCheckboxDescriptionEClass;
}
@@ -698,6 +736,10 @@ public class EefPackageImpl extends EPackageImpl implements EefPackage {
eefLabelDescriptionEClass = createEClass(EefPackage.EEF_LABEL_DESCRIPTION);
+ eefButtonDescriptionEClass = createEClass(EefPackage.EEF_BUTTON_DESCRIPTION);
+ createEAttribute(eefButtonDescriptionEClass, EefPackage.EEF_BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION);
+ createEAttribute(eefButtonDescriptionEClass, EefPackage.EEF_BUTTON_DESCRIPTION__PUSH_EXPRESSION);
+
eefCheckboxDescriptionEClass = createEClass(EefPackage.EEF_CHECKBOX_DESCRIPTION);
createEAttribute(eefCheckboxDescriptionEClass, EefPackage.EEF_CHECKBOX_DESCRIPTION__VALUE_EXPRESSION);
createEAttribute(eefCheckboxDescriptionEClass, EefPackage.EEF_CHECKBOX_DESCRIPTION__EDIT_EXPRESSION);
@@ -756,6 +798,7 @@ public class EefPackageImpl extends EPackageImpl implements EefPackage {
// Add supertypes to classes
eefTextDescriptionEClass.getESuperTypes().add(this.getEEFWidgetDescription());
eefLabelDescriptionEClass.getESuperTypes().add(this.getEEFWidgetDescription());
+ eefButtonDescriptionEClass.getESuperTypes().add(this.getEEFWidgetDescription());
eefCheckboxDescriptionEClass.getESuperTypes().add(this.getEEFWidgetDescription());
eefSelectDescriptionEClass.getESuperTypes().add(this.getEEFWidgetDescription());
@@ -868,6 +911,17 @@ public class EefPackageImpl extends EPackageImpl implements EefPackage {
initEClass(eefLabelDescriptionEClass, EEFLabelDescription.class,
"EEFLabelDescription", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEClass(eefButtonDescriptionEClass, EEFButtonDescription.class,
+ "EEFButtonDescription", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(
+ getEEFButtonDescription_ButtonLabelExpression(),
+ theEcorePackage.getEString(),
+ "buttonLabelExpression", null, 0, 1, EEFButtonDescription.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(
+ getEEFButtonDescription_PushExpression(),
+ theEcorePackage.getEString(),
+ "pushExpression", null, 0, 1, EEFButtonDescription.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
+
initEClass(eefCheckboxDescriptionEClass, EEFCheckboxDescription.class,
"EEFCheckboxDescription", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
initEAttribute(
diff --git a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefAdapterFactory.java b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefAdapterFactory.java
index c69d569c2..d5285b6ab 100644
--- a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefAdapterFactory.java
+++ b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefAdapterFactory.java
@@ -8,6 +8,7 @@
*/
package org.eclipse.eef.util;
+import org.eclipse.eef.EEFButtonDescription;
import org.eclipse.eef.EEFCheckboxDescription;
import org.eclipse.eef.EEFContainerDescription;
import org.eclipse.eef.EEFDynamicMappingCase;
@@ -113,6 +114,11 @@ public class EefAdapterFactory extends AdapterFactoryImpl {
}
@Override
+ public Adapter caseEEFButtonDescription(EEFButtonDescription object) {
+ return createEEFButtonDescriptionAdapter();
+ }
+
+ @Override
public Adapter caseEEFCheckboxDescription(EEFCheckboxDescription object) {
return createEEFCheckboxDescriptionAdapter();
}
@@ -255,6 +261,20 @@ public class EefAdapterFactory extends AdapterFactoryImpl {
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.eef.EEFButtonDescription
+ * <em>EEF Button Description</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we
+ * can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!--
+ * end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.eef.EEFButtonDescription
+ * @generated
+ */
+ public Adapter createEEFButtonDescriptionAdapter() {
+ return null;
+ }
+
+ /**
* Creates a new adapter for an object of class '{@link org.eclipse.eef.EEFCheckboxDescription
* <em>EEF Checkbox Description</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we
* can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!--
diff --git a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefSwitch.java b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefSwitch.java
index f63d0580f..49555a750 100644
--- a/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefSwitch.java
+++ b/plugins/org.eclipse.eef/src-gen/org/eclipse/eef/util/EefSwitch.java
@@ -8,6 +8,7 @@
*/
package org.eclipse.eef.util;
+import org.eclipse.eef.EEFButtonDescription;
import org.eclipse.eef.EEFCheckboxDescription;
import org.eclipse.eef.EEFContainerDescription;
import org.eclipse.eef.EEFDynamicMappingCase;
@@ -137,6 +138,17 @@ public class EefSwitch<T> extends Switch<T> {
}
return result;
}
+ case EefPackage.EEF_BUTTON_DESCRIPTION: {
+ EEFButtonDescription eefButtonDescription = (EEFButtonDescription) theEObject;
+ T result = caseEEFButtonDescription(eefButtonDescription);
+ if (result == null) {
+ result = caseEEFWidgetDescription(eefButtonDescription);
+ }
+ if (result == null) {
+ result = defaultCase(theEObject);
+ }
+ return result;
+ }
case EefPackage.EEF_CHECKBOX_DESCRIPTION: {
EEFCheckboxDescription eefCheckboxDescription = (EEFCheckboxDescription) theEObject;
T result = caseEEFCheckboxDescription(eefCheckboxDescription);
@@ -294,6 +306,21 @@ public class EefSwitch<T> extends Switch<T> {
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>EEF Button Description</em>'. <!--
+ * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!--
+ * end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EEF Button Description</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEEFButtonDescription(EEFButtonDescription object) {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>EEF Checkbox Description</em>'. <!--
* begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!--
* end-user-doc -->

Back to the top