Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/org.eclipse.papyrus.infra.elementtypesconfigurations/src/org/eclipse/papyrus/infra/elementtypesconfigurations/utils/ElementTypeRegistryUtils.java')
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.elementtypesconfigurations/src/org/eclipse/papyrus/infra/elementtypesconfigurations/utils/ElementTypeRegistryUtils.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.elementtypesconfigurations/src/org/eclipse/papyrus/infra/elementtypesconfigurations/utils/ElementTypeRegistryUtils.java b/plugins/infra/org.eclipse.papyrus.infra.elementtypesconfigurations/src/org/eclipse/papyrus/infra/elementtypesconfigurations/utils/ElementTypeRegistryUtils.java
index 74281a506b0..b767cfc9fc8 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.elementtypesconfigurations/src/org/eclipse/papyrus/infra/elementtypesconfigurations/utils/ElementTypeRegistryUtils.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.elementtypesconfigurations/src/org/eclipse/papyrus/infra/elementtypesconfigurations/utils/ElementTypeRegistryUtils.java
@@ -13,12 +13,18 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.elementtypesconfigurations.utils;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.gmf.runtime.emf.type.core.ClientContext;
import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
import org.eclipse.gmf.runtime.emf.type.core.IAdviceBindingDescriptor;
import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.elementtypesconfigurations.Activator;
+import org.eclipse.papyrus.infra.services.edit.internal.context.TypeContext;
public class ElementTypeRegistryUtils {
@@ -47,4 +53,28 @@ public class ElementTypeRegistryUtils {
Activator.log.warn("Cannot unbind type ID from context of unknown class: " + context.getClass().getName());
}
}
+
+ static public List<IElementType> getElementTypesBySemanticHint(String semanticHint) {
+ List<IElementType> matchingElementTypes = new ArrayList<IElementType>();
+
+ IClientContext context;
+ try {
+ context = TypeContext.getContext();
+ IElementType[] elementTypes = ElementTypeRegistry.getInstance().getElementTypes(context);
+
+ for (IElementType iElementType : elementTypes) {
+ if (iElementType instanceof IHintedType) {
+ if (((IHintedType) iElementType).getSemanticHint().equals(semanticHint)) {
+ matchingElementTypes.add(iElementType);
+ }
+ }
+ }
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+
+
+
+ return matchingElementTypes;
+ }
}

Back to the top