Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/interpreter/DefaultInterpreterContextFactory.java')
-rw-r--r--plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/interpreter/DefaultInterpreterContextFactory.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/interpreter/DefaultInterpreterContextFactory.java b/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/interpreter/DefaultInterpreterContextFactory.java
new file mode 100644
index 0000000000..24936a05f1
--- /dev/null
+++ b/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/interpreter/DefaultInterpreterContextFactory.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2012 THALES GLOBAL SERVICES.
+ * 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.sirius.common.tools.api.interpreter;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.sirius.common.tools.internal.interpreter.InterpretedContextImpl;
+
+/**
+ * Allows to create {@link IInterpreterContext}s.
+ *
+ * @since 3.2
+ * @author alagarde
+ */
+public final class DefaultInterpreterContextFactory {
+
+ private DefaultInterpreterContextFactory() {
+
+ }
+
+ /**
+ * Creates the {@link IInterpreterContext} allowing to validate the
+ * InterpretedExpression stored in the given feature.
+ *
+ * @param element
+ * the concerned element
+ * @param requiresTargetType
+ * indicates whether this expression requires a targetType for
+ * the "current" element
+ * @param feature
+ * the feature containing the expression to evaluate
+ * @param targetTypes
+ * targetDomainClasses
+ * @param avalaiblePackages
+ * the list of available EPackages
+ * @param variables
+ * the defined variables
+ * @param dependencies
+ * the list of available dependencies
+ *
+ * @return a {@link IInterpreterContext} created from the given informations
+ */
+ public static IInterpreterContext createInterpreterContext(EObject element, boolean requiresTargetType, EStructuralFeature feature, Collection<String> targetTypes,
+ Collection<EPackage> avalaiblePackages, Map<String, String> variables, Collection<String> dependencies) {
+ return new InterpretedContextImpl(element, requiresTargetType, feature, targetTypes, avalaiblePackages, variables, dependencies);
+ }
+
+}

Back to the top