Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetAttributeWidget.java81
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetOperationParameterWidget.java72
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetOperationWidget.java78
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetReferenceWidget.java81
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetSetWidget.java113
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetWidget.java168
6 files changed, 593 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetAttributeWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetAttributeWidget.java
new file mode 100644
index 00000000000..1a14e08b291
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetAttributeWidget.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.edition;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.component.properties.name.GetAttributeNameWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.creation.AbstractEStructuralFeatureWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name.AbstractGetElementNameWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Widget for the edition of a {@link FacetAttribute}.
+ */
+public class EditFacetAttributeWidget extends
+ AbstractEStructuralFeatureWidget<FacetAttribute> {
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param properties
+ * the properties.
+ * @param initialAttribut
+ * the {@link FacetAttribute} to edit.
+ */
+ public EditFacetAttributeWidget(final Composite parent,
+ final FacetAttribute initialAttribut,
+ final EditingDomain editingDomain,
+ final PropertyElement2<Facet> facetProperty,
+ final PropertyElement2<String> nameProperty,
+ final PropertyElement2<Integer> lowerBdProperty,
+ final PropertyElement2<Integer> upperBdProperty,
+ final PropertyElement2<EClassifier> typeProperty,
+ final PropertyElement2<Boolean> orderedProperty,
+ final PropertyElement2<Boolean> uniqueProperty,
+ final PropertyElement2<Query> queryProperty,
+ final PropertyElement2<Boolean> volatileProperty,
+ final PropertyElement2<Boolean> changeProperty,
+ final PropertyElement2<Boolean> derivedProperty,
+ final PropertyElement2<Boolean> transientProperty) {
+ super(initialAttribut, parent, editingDomain, facetProperty,
+ nameProperty,
+ lowerBdProperty, upperBdProperty, typeProperty,
+ orderedProperty, uniqueProperty, queryProperty,
+ volatileProperty, changeProperty, derivedProperty,
+ transientProperty);
+ }
+
+ @Override
+ protected AbstractGetElementNameWidget createGetElementNameSubWidgetComposite() {
+ return new GetAttributeNameWidget(this, this.getElementNameProperty());
+ }
+
+ @Override
+ protected Class<? extends EClassifier> getETypeSelectionOption() {
+ return EDataType.class;
+ }
+
+ @Override
+ public void onDialogValidation() {
+ // Nothing.
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetOperationParameterWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetOperationParameterWidget.java
new file mode 100644
index 00000000000..b469c8d53bc
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetOperationParameterWidget.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.edition;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.creation.AddParameterInOperationWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Widget for the edition of a {@link EParameter}.
+ */
+public class EditFacetOperationParameterWidget extends
+ AddParameterInOperationWidget {
+
+ private final EParameter initialParameter;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param properties
+ * the properties.
+ * @param initialParameter
+ * the {@link EParameter} to edit.
+ */
+ public EditFacetOperationParameterWidget(final Composite parent,
+ final EParameter initialParameter,
+ final EditingDomain editingDomain,
+ final PropertyElement2<FacetOperation> containerProperty,
+ final PropertyElement2<String> nameProperty,
+ final PropertyElement2<Integer> lowerBdProperty,
+ final PropertyElement2<Integer> upperBdProperty,
+ final PropertyElement2<EClassifier> typeProperty,
+ final PropertyElement2<Boolean> orderedProperty,
+ final PropertyElement2<Boolean> uniqueProperty) {
+ super(parent, editingDomain, containerProperty, nameProperty,
+ lowerBdProperty, upperBdProperty, typeProperty,
+ orderedProperty, uniqueProperty);
+ this.initialParameter = initialParameter;
+ }
+
+ @Override
+ protected EParameter getOperationParameter() {
+ return this.initialParameter;
+ }
+
+ @Override
+ public Command getCommand() {
+ return this.getCommandFactory().createEditOperationParameterCommand(
+ this.initialParameter, this.getContainer(), this.getElementName(),
+ this.getLowerBound(), this.getLowerBound(), this.getEType(),
+ this.isOrdered(), this.isUnique());
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetOperationWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetOperationWidget.java
new file mode 100644
index 00000000000..c4cf8e6152d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetOperationWidget.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.edition;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.creation.AddOperationInFacetWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Widget for the edition of a {@link FacetOperation}.
+ */
+public class EditFacetOperationWidget extends AddOperationInFacetWidget {
+
+ private final FacetOperation initialFacetOpe;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param properties
+ * the properties.
+ * @param initialFacetOpe
+ * the {@link FacetOperation} to edit.
+ * @param facet
+ */
+ public EditFacetOperationWidget(final Composite parent,
+ final FacetOperation initialFacetOpe,
+ final EditingDomain editingDomain,
+ final PropertyElement2<Facet> facetProperty,
+ final PropertyElement2<String> nameProperty,
+ final PropertyElement2<Integer> lowerBdProperty,
+ final PropertyElement2<Integer> upperBdProperty,
+ final PropertyElement2<EClassifier> typeProperty,
+ final PropertyElement2<Boolean> orderedProperty,
+ final PropertyElement2<Boolean> uniqueProperty,
+ final PropertyElement2<Query> queryProperty) {
+ super(parent, editingDomain, facetProperty, nameProperty,
+ lowerBdProperty, upperBdProperty, typeProperty,
+ orderedProperty, uniqueProperty, queryProperty);
+ this.initialFacetOpe = initialFacetOpe;
+ }
+
+ @Override
+ protected FacetOperation getFacetOperation() {
+ return this.initialFacetOpe;
+ }
+
+ @Override
+ public Command getCommand() {
+ final Facet facetContainer = this.getContainerPropery()
+ .getValue2();
+ final FacetOperation facetElement = createFacetOperation();
+ return this.getCommandFactory().createEditFacetOperationCommand(
+ facetElement, facetContainer, getElementName(), getLowerBound(),
+ getUpperBound(), getTypeProperty().getValue2(),
+ getOrderedProperty().getValue2().booleanValue(),
+ getUniqueProperty().getValue2().booleanValue(),
+ getQueryProperty().getValue2());
+
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetReferenceWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetReferenceWidget.java
new file mode 100644
index 00000000000..3ca2df9481b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetReferenceWidget.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.edition;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.component.properties.name.GetReferenceNameWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.creation.AbstractEStructuralFeatureWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name.AbstractGetElementNameWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Widget for the edition of a {@link FacetReference}.
+ */
+public class EditFacetReferenceWidget extends
+ AbstractEStructuralFeatureWidget<FacetReference> {
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param properties
+ * the properties.
+ * @param initialFacetRef
+ * the {@link FacetReference} to edit.
+ * @param facet
+ */
+ public EditFacetReferenceWidget(final Composite parent,
+ final FacetReference initialFacetRef,
+ final EditingDomain editingDomain,
+ final PropertyElement2<Facet> facetProperty,
+ final PropertyElement2<String> nameProperty,
+ final PropertyElement2<Integer> lowerBdProperty,
+ final PropertyElement2<Integer> upperBdProperty,
+ final PropertyElement2<EClassifier> typeProperty,
+ final PropertyElement2<Boolean> orderedProperty,
+ final PropertyElement2<Boolean> uniqueProperty,
+ final PropertyElement2<Query> queryProperty,
+ final PropertyElement2<Boolean> volatileProperty,
+ final PropertyElement2<Boolean> changeProperty,
+ final PropertyElement2<Boolean> derivedProperty,
+ final PropertyElement2<Boolean> transientProperty) {
+ super(initialFacetRef, parent, editingDomain, facetProperty,
+ nameProperty, lowerBdProperty, upperBdProperty, typeProperty,
+ orderedProperty, uniqueProperty, queryProperty,
+ volatileProperty, changeProperty, derivedProperty,
+ transientProperty);
+ }
+
+ @Override
+ protected AbstractGetElementNameWidget createGetElementNameSubWidgetComposite() {
+ return new GetReferenceNameWidget(this, this.getElementNameProperty());
+ }
+
+ @Override
+ protected Class<? extends EClassifier> getETypeSelectionOption() {
+ return EClass.class;
+ }
+
+ @Override
+ public void onDialogValidation() {
+ // Nothing.
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetSetWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetSetWidget.java
new file mode 100644
index 00000000000..cfba8816359
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetSetWidget.java
@@ -0,0 +1,113 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.edition;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.Messages;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.exported.widget.component.getorcreate.IGetOrCreateFacetSetWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.exported.widget.creation.IGetOrCreateFilteredFacetSetWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.component.getorcreate.GetOrCreateFacetSetWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.creation.AbstractENamedElementWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name.AbstractGetElementNameWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Widget for the edition of a {@link FacetSet}.
+ */
+public class EditFacetSetWidget
+ extends
+ AbstractENamedElementWidget<FacetSet, FacetSet, IGetOrCreateFilteredFacetSetWidget> {
+
+ private final PropertyElement2<FacetSet> containerProperty;
+ private final FacetSet editedFacetSet;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param properties
+ * the properties.
+ * @param editedFacetSet
+ * the {@link FacetSet} to edit.
+ * @param nameProperty
+ * @param containerProp
+ */
+ public EditFacetSetWidget(final Composite parent,
+ final FacetSet editedFacetSet, final EditingDomain editingDomain,
+ final PropertyElement2<String> nameProperty,
+ final PropertyElement2<FacetSet> containerProp) {
+ super(parent, editingDomain, containerProp, nameProperty);
+ this.containerProperty = containerProp;
+ this.editedFacetSet = editedFacetSet;
+ }
+
+ @Override
+ public Command getCommand() {
+ final FacetSet container = this.containerProperty.getValue2();
+ return this.getCommandFactory().createEditFacetSetCommand(
+ this.editedFacetSet, container,
+ this.getElementNamePropertyValue());
+ }
+
+ @Override
+ public void notifyChanged() {
+ // No action has to be done if a change appends.
+ }
+
+ @Override
+ public void onDialogValidation() {
+ // Nothing.
+ }
+
+
+ @Override
+ protected IGetOrCreateFacetSetWidget createGetOrCreateElementWidgetComposite() {
+ return new GetOrCreateFacetSetWidget(this, this.containerProperty,
+ this.getEditingDomain(), null);
+ }
+
+ @Override
+ protected AbstractGetElementNameWidget createGetElementNameSubWidgetComposite() {
+ final AbstractGetElementNameWidget widget = new AbstractGetElementNameWidget(
+ this, this.getElementNameProperty()) {
+ @Override
+ protected String getErrorMessage() {
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getLabel() {
+ return Messages.EditFacetSetWidget_FacetSetName;
+ }
+
+ @Override
+ public void notifyChanged() {
+ // Noting to do
+ }
+
+ };
+ return widget;
+ }
+
+
+ protected final PropertyElement getContainerProperty() {
+ return this.containerProperty;
+ }
+
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetWidget.java
new file mode 100644
index 00000000000..da8276d5b38
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.sdk.ui/src/org/eclipse/papyrus/emf/facet/efacet/sdk/ui/internal/widget/edition/EditFacetWidget.java
@@ -0,0 +1,168 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.edition;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.Messages;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.exported.widget.IFacetWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.exported.widget.component.getorcreate.IGetOrCreateFacetSetWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.exported.widget.component.metaclass.IGetExtendedMetaclassWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.exported.widget.creation.IGetOrCreateFilteredFacetSetWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.sync.generated.SynchronizedGetExtendedMetaclassWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.component.getorcreate.GetOrCreateFacetSetWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.component.metaclass.GetExtendedMetaclassWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.component.metaclass.SelectSubTypingTypeWidget;
+import org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.creation.AbstractENamedElementWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name.AbstractGetElementNameWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.widget.IAbstractWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Widget for the edition of a {@link Facet}.
+ */
+public class EditFacetWidget
+ extends
+ AbstractENamedElementWidget<Facet, FacetSet, IGetOrCreateFilteredFacetSetWidget> implements IFacetWidget {
+
+ private final Facet initialFacet;
+ private final PropertyElement2<String> facetNameProperty;
+ private final PropertyElement2<EClass> facetMetaclass;
+ private final PropertyElement2<ETypedElement> conformProperty;
+ private SelectSubTypingTypeWidget subTypingTypeW;
+ private GetExtendedMetaclassWidget extMetaclassW;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param properties
+ * the properties.
+ * @param initialFacet
+ * the {@link Facet} to edit.
+ * @param facetNameProperty
+ * @param containerProperty
+ * @param conformProperty
+ * @param facetMetaclass
+ */
+ public EditFacetWidget(final Composite parent,
+ final Facet initialFacet, final EditingDomain editingDomain,
+ final PropertyElement2<String> facetNameProperty,
+ final PropertyElement2<FacetSet> facetSetProperty,
+ final PropertyElement2<ETypedElement> conformProperty,
+ final PropertyElement2<EClass> facetMetaclass) {
+ super(parent, editingDomain, facetSetProperty, facetNameProperty);
+ this.facetNameProperty = facetNameProperty;
+ this.facetMetaclass = facetMetaclass;
+ this.conformProperty = conformProperty;
+ this.initialFacet = initialFacet;
+ }
+
+ @Override
+ public Command getCommand() {
+ return this.getCommandFactory().createEditFacetCommand(
+ this.initialFacet, this.getContainerPropery().getValue2(),
+ this.facetNameProperty.getValue2(),
+ this.conformProperty.getValue2(),
+ this.facetMetaclass.getValue2(), null);
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ super.addSubWidgets();
+ this.extMetaclassW = new GetExtendedMetaclassWidget(this,
+ this.facetMetaclass, this.getContainerPropery());
+ addSubWidget(this.extMetaclassW);
+ this.subTypingTypeW = new SelectSubTypingTypeWidget(this,
+ this.conformProperty, this.getEditingDomain(),
+ this.facetMetaclass.getValue2(), this.initialFacet);
+ addSubWidget(this.subTypingTypeW);
+ }
+
+ @Override
+ public void notifyChanged() {
+ // No action has to be done if a change appends.
+ }
+
+ @Override
+ public void onDialogValidation() {
+ // Nothing.
+ }
+
+ public IAbstractWidget getSelectSubTypingTypeWidget() {
+ return this.subTypingTypeW;
+ }
+
+ public IGetExtendedMetaclassWidget getGetExtendedMetaclassWidget() {
+ return new SynchronizedGetExtendedMetaclassWidget(this.extMetaclassW,
+ this.extMetaclassW.getDisplay());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.edition.IFacetWidget#setSubTypingFacetSelection(boolean)
+ */
+ public void setSubTypingFacetSelection(final boolean enable) {
+ this.subTypingTypeW.setSelection(enable);
+ }
+
+ public String getSubTypingFacet() {
+ return this.subTypingTypeW.getSubTypingText();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.facet.efacet.sdk.ui.internal.widget.edition.IFacetWidget#pressSubTypingButton()
+ */
+ public IDialog<IGetOrCreateFilteredElementCommmandWidget<ETypedElement, Object>> pressSubTypingButton() {
+ return this.subTypingTypeW.pressButton();
+ }
+
+ @Override
+ protected IGetOrCreateFacetSetWidget createGetOrCreateElementWidgetComposite() {
+ return new GetOrCreateFacetSetWidget(this, this.getContainerPropery(),
+ this.getEditingDomain(), null);
+ }
+
+ @Override
+ protected AbstractGetElementNameWidget createGetElementNameSubWidgetComposite() {
+ final AbstractGetElementNameWidget widget = new AbstractGetElementNameWidget(
+ this, this.facetNameProperty) {
+ @Override
+ protected String getErrorMessage() {
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getLabel() {
+ return Messages.EditFacetWidget_FacetName;
+ }
+
+ @Override
+ public void notifyChanged() {
+ // Noting to do
+ }
+
+ };
+ return widget;
+ }
+
+}

Back to the top