diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/StructuredTextTypesCollector.java')
-rw-r--r-- | bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/StructuredTextTypesCollector.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/StructuredTextTypesCollector.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/StructuredTextTypesCollector.java index 4ac825541..4ba133306 100644 --- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/StructuredTextTypesCollector.java +++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/StructuredTextTypesCollector.java @@ -30,8 +30,8 @@ public class StructuredTextTypesCollector implements IRegistryEventListener { private static final String ATTR_TYPE = "type"; //$NON-NLS-1$ private static final String ATTR_HANDLER = "class"; //$NON-NLS-1$ - private Map types; - private Map factories; + private Map<String, StructuredTextTypeHandler> types; + private Map<String, IConfigurationElement> factories; static private StructuredTextTypesCollector instance = new StructuredTextTypesCollector(); @@ -76,12 +76,12 @@ public class StructuredTextTypesCollector implements IRegistryEventListener { private void read() { if (types == null) - types = new HashMap(); + types = new HashMap<>(); else types.clear(); if (factories == null) - factories = new HashMap(); + factories = new HashMap<String, IConfigurationElement>(); else factories.clear(); @@ -107,8 +107,10 @@ public class StructuredTextTypesCollector implements IRegistryEventListener { StructuredTextActivator.logError("BiDi types: unable to create handler for " + type, e); //$NON-NLS-1$ continue; } - types.put(type, handler); - factories.put(type, confElements[j]); + if (handler instanceof StructuredTextTypeHandler) { + types.put(type, (StructuredTextTypeHandler) handler); + factories.put(type, confElements[j]); + } } } } @@ -140,8 +142,8 @@ public class StructuredTextTypesCollector implements IRegistryEventListener { * @return a map from structured text type handler identifier (key type: {@link String}) * to structured text type handler (value type: {@link StructuredTextTypeHandler}). */ - public static Map getDefaultTypeHandlers() { - Map types = new LinkedHashMap(); + public static Map<String, StructuredTextTypeHandler> getDefaultTypeHandlers() { + Map<String, StructuredTextTypeHandler> types = new LinkedHashMap<String, StructuredTextTypeHandler>(); types.put(StructuredTextTypeHandlerFactory.COMMA_DELIMITED, new StructuredTextComma()); types.put(StructuredTextTypeHandlerFactory.EMAIL, new StructuredTextEmail()); |