*/
public DialogField createDialogField(IPropertyPageDescriptor attr) {
String type = attr.getValueType();
IPossibleValues pvs = (IPossibleValues)attr.getAdapter(IPossibleValues.class);
// IDefaultValue defaultValue = (IDefaultValue)attr.getAdapter(IDefaultValue.class);
// ICellEditorValidator validator = (ICellEditorValidator)attr.getAdapter(ICellEditorValidator.class);
if (IAttributeRuntimeValueType.RELATIVEPATH.equals(type) ||
IAttributeRuntimeValueType.WEBPATH.equals(type)) {
//FIXME - should not be passing null project
final IMetaDataDomainContext context = MetaDataQueryContextFactory.getInstance().createTaglibDomainModelContext((IProject)null);
final ITaglibDomainMetaDataQuery query = MetaDataQueryFactory.getInstance().createQuery(context);
Trait fileExt = query.findTrait(attr.getMetaDataContext().getEntity(), "file-extensions"); //$NON-NLS-1$
Trait seperator = query.findTrait(attr.getMetaDataContext().getEntity(), "separator"); //$NON-NLS-1$
String[] fileExts = null;
if (fileExt != null){
List exts = TraitValueHelper.getValueAsListOfStrings(fileExt);
fileExts = (String[])exts.toArray(new String[exts.size()]);
}
String sep = null;
if (seperator != null)
sep = TraitValueHelper.getValueAsString(seperator);
ContextableResourceButtonDialogField field = new ContextableResourceButtonDialogField();
field.setLabelText(attr.getLabel());
if (fileExts != null) {
field.setSuffixs(fileExts);
}
if (sep != null) {
field.setSeparator(sep);
}
if ("".equalsIgnoreCase(field.getSeparator())) { //$NON-NLS-1$
field.setResourceDescription(ResourceBoundle
.getString("FileCellEditor.Msg")); //$NON-NLS-1$
} else {
field.setResourceDescription(ResourceBoundle
.getString("FileCellEditor.Msg1")); //$NON-NLS-1$
}
field.setWebPath(IAttributeRuntimeValueType.WEBPATH.equals(type));
field.setRequired(attr.isRequired());
field.setToolTip(attr.getDescription());
return field;
} else if (IAttributeRuntimeValueType.CLASSPATH_RESOURCE.equals(type) ||
IAttributeRuntimeValueType.RESOURCEBUNDLE.equals(type)) {
ClasspathResourceButtonDialogField field = new ClasspathResourceButtonDialogField();
field.setRequired(attr.isRequired());
field.setToolTip(attr.getDescription());
field.setLabelText(attr.getLabel());
return field;
} else if (IAttributeRuntimeValueType.CSSSTYLE.equalsIgnoreCase(type)) {
// String param = getParamterValue(attr, "style");
// if (!"STYLE".equalsIgnoreCase(param)) {
// return null;
// }
StyleButtonDialogField field = new StyleButtonDialogField();
field.setRequired(attr.isRequired());
field.setToolTip(attr.getDescription());
field.setLabelText(attr.getLabel());
return field;
// // if there is no type or type unknown, then we just return null. and
// // system will
// // create default (text cell editor).
} else if (pvs != null && pvs.getPossibleValues().size() > 0) {
MDEnabledComboDialogField field = new MDEnabledComboDialogField(SWT.None);
field.setLabelText(attr.getLabel());
field.setToolTip(attr.getDescription());
field.setRequired(attr.isRequired());
return field;