[483577] Add getTypes(String) returning a list of matching EClassifiers
Sirius had to rely on IEPackageProvider.getType(String) which got
deprecated for good reasons as it would only return a single type
matching the name or throw an exception.
This commit introduce getTypes(String) which returns a collection of all
the types known by AQL which are matching the name, so that Sirius can
pass this information around.
Bug: 483577
diff --git a/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/IEPackageProvider.java b/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/IEPackageProvider.java
index 7b05f6e..4df65ad 100644
--- a/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/IEPackageProvider.java
+++ b/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/IEPackageProvider.java
@@ -75,6 +75,15 @@
Collection<EClassifier> getTypes(String name, String classifierName);
/**
+ * the list of classifiers known to the package provider with the specified name.
+ *
+ * @param classifierName
+ * the name of the searched classifier
+ * @return the list of classifiers matching the given {@link EClassifier} names.
+ */
+ Collection<EClassifier> getTypes(String name);
+
+ /**
* the classifier with the specified name in the package registered with the specified name.
*
* @param name
diff --git a/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/impl/EPackageProvider.java b/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/impl/EPackageProvider.java
index 732e15a..1594119 100644
--- a/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/impl/EPackageProvider.java
+++ b/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/impl/EPackageProvider.java
@@ -534,6 +534,23 @@
/**
* {@inheritDoc}
*
+ * @see org.eclipse.acceleo.query.runtime.IEPackageProvider#getTypes(java.lang.String)
+ */
+ @Override
+ public Collection<EClassifier> getTypes(String classifierName) {
+ Set<EClassifier> result = Sets.newLinkedHashSet();
+ for (EPackage ePackage : ePackages.values()) {
+ EClassifier foundClassifier = ePackage.getEClassifier(classifierName);
+ if (foundClassifier != null) {
+ result.add(foundClassifier);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.eclipse.acceleo.query.runtime.IEPackageProvider#getEnumLiteral(java.lang.String,
* java.lang.String, java.lang.String)
*/