public static Control createControl(final Composite parent, final Object value,
final String type, final String objectName, final String attributeName,
final boolean writable, final IWritableAttributeHandler handler,
final FormToolkit toolkit) {
IAttributeControlFactory factory = null;
if (objectName != null && attributeName != null) {
Map<Pattern, IAttributeControlFactory> patterns = patternFactories.get(attributeName);
if (patterns != null) {
for (Map.Entry<Pattern, IAttributeControlFactory> entry : patterns.entrySet()) {
if (entry.getKey().matcher(objectName).matches()) {
factory = entry.getValue();
}
}
}
}
if (factory == null) {
Class<? extends Object> clazz = value == null ? getClass(type) : value.getClass();
if (clazz == null) {
factory = defaultFactory;
} else {
List<IAttributeControlFactory> factories = findFactories(clazz);
if (factories == null) {
factory = value.getClass().isArray() ? arrayFactory : defaultFactory;
} else {
factory = factories.get(0);
}
}
}
return factory.createControl(parent, toolkit, writable, type, value, handler);
}