Search in sources :

Example 1 with EnumeratedStringPropertyDescriptor

use of org.eclipse.wst.xml.ui.internal.properties.EnumeratedStringPropertyDescriptor in project webtools.sourceediting by eclipse.

the class XMLTableTreePropertyDescriptorFactory method createPropertyDescriptorHelper.

protected IPropertyDescriptor createPropertyDescriptorHelper(String name, Element element, CMNode cmNode) {
    IPropertyDescriptor result = null;
    ModelQuery mq = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
    String[] valuesArray = null;
    if (mq != null) {
        valuesArray = mq.getPossibleDataTypeValues(element, cmNode);
    }
    if ((valuesArray != null) && (valuesArray.length > 0)) {
        result = new EnumeratedStringPropertyDescriptor(name, name, valuesArray);
    } else {
        result = createDefaultPropertyDescriptor(name);
    }
    return result;
}
Also used : ModelQuery(org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery) IPropertyDescriptor(org.eclipse.ui.views.properties.IPropertyDescriptor) EnumeratedStringPropertyDescriptor(org.eclipse.wst.xml.ui.internal.properties.EnumeratedStringPropertyDescriptor)

Example 2 with EnumeratedStringPropertyDescriptor

use of org.eclipse.wst.xml.ui.internal.properties.EnumeratedStringPropertyDescriptor in project webtools.sourceediting by eclipse.

the class DOMPropertyDescriptorFactory method createAttributePropertyDescriptor.

public IPropertyDescriptor createAttributePropertyDescriptor(Attr attr) {
    IPropertyDescriptor result = null;
    String attributeName = attr.getName();
    ModelQuery mq = ModelQueryUtil.getModelQuery(attr.getOwnerDocument());
    if (mq != null) {
        CMAttributeDeclaration ad = mq.getCMAttributeDeclaration(attr);
        if (ad != null) {
            String[] valuesArray = mq.getPossibleDataTypeValues(attr.getOwnerElement(), ad);
            if ((valuesArray != null) && (valuesArray.length > 0)) {
                result = new EnumeratedStringPropertyDescriptor(attributeName, attributeName, valuesArray);
            }
        }
    }
    if (result == null) {
        result = createDefaultPropertyDescriptor(attributeName);
    }
    return result;
}
Also used : ModelQuery(org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery) CMAttributeDeclaration(org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration) IPropertyDescriptor(org.eclipse.ui.views.properties.IPropertyDescriptor) EnumeratedStringPropertyDescriptor(org.eclipse.wst.xml.ui.internal.properties.EnumeratedStringPropertyDescriptor)

Aggregations

IPropertyDescriptor (org.eclipse.ui.views.properties.IPropertyDescriptor)2 ModelQuery (org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery)2 EnumeratedStringPropertyDescriptor (org.eclipse.wst.xml.ui.internal.properties.EnumeratedStringPropertyDescriptor)2 CMAttributeDeclaration (org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration)1