Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/plugins/toolsmiths/org.eclipse.papyrus.toolsmiths.validation.properties.tests/resources/org.eclipse.papyrus.toolsmiths.validation.properties.example/src/org/eclipse/papyrus/toolsmiths/validation/properties/example/modelelement/VendorModelElementFactory.java')
-rw-r--r--tests/junit/plugins/toolsmiths/org.eclipse.papyrus.toolsmiths.validation.properties.tests/resources/org.eclipse.papyrus.toolsmiths.validation.properties.example/src/org/eclipse/papyrus/toolsmiths/validation/properties/example/modelelement/VendorModelElementFactory.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/junit/plugins/toolsmiths/org.eclipse.papyrus.toolsmiths.validation.properties.tests/resources/org.eclipse.papyrus.toolsmiths.validation.properties.example/src/org/eclipse/papyrus/toolsmiths/validation/properties/example/modelelement/VendorModelElementFactory.java b/tests/junit/plugins/toolsmiths/org.eclipse.papyrus.toolsmiths.validation.properties.tests/resources/org.eclipse.papyrus.toolsmiths.validation.properties.example/src/org/eclipse/papyrus/toolsmiths/validation/properties/example/modelelement/VendorModelElementFactory.java
new file mode 100644
index 00000000000..2eee8150613
--- /dev/null
+++ b/tests/junit/plugins/toolsmiths/org.eclipse.papyrus.toolsmiths.validation.properties.tests/resources/org.eclipse.papyrus.toolsmiths.validation.properties.example/src/org/eclipse/papyrus/toolsmiths/validation/properties/example/modelelement/VendorModelElementFactory.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * Copyright (c) 2021 Christian W. Damus, CEA LIST, and others.
+ *
+ * All rights reserved. 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:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.toolsmiths.validation.properties.example.modelelement;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement;
+import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElementFactory;
+
+public class VendorModelElementFactory extends EMFModelElementFactory {
+
+ @Override
+ protected EMFModelElement doCreateFromSource(Object sourceElement, DataContextElement context) {
+ EObject source = EMFHelper.getEObject(sourceElement);
+ if (source == null) {
+ System.err.println("Unable to resolve the selected element to an EObject"); //$NON-NLS-1$
+ return null;
+ }
+
+ EditingDomain domain = EMFHelper.resolveEditingDomain(source);
+ return new VendorModelElement(source, domain);
+ }
+
+}

Back to the top