Search in sources :

Example 1 with CSSMMNumber

use of org.eclipse.wst.css.core.internal.metamodel.CSSMMNumber in project webtools.sourceediting by eclipse.

the class CSSProposalGeneratorForDeclarationValue method getCandidates.

/**
 * getCandidates method comment.
 */
protected Iterator getCandidates() {
    List candidates = new ArrayList();
    // check should add semi-colon or not
    checkSemiColon();
    String name = getPropertyName();
    if (name != null) {
        CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
        Iterator i = Collections.EMPTY_LIST.iterator();
        if (isFontFaceRule()) {
            CSSMMDescriptor desc = util.getDescriptor(name);
            if (desc != null) {
                i = desc.getValues();
            }
        } else {
            CSSMMProperty prop = util.getProperty(name);
            if (prop != null) {
                i = prop.getValues();
            }
        }
        while (i.hasNext()) {
            CSSMMNode val = (CSSMMNode) i.next();
            String valueType = val.getType();
            if (valueType == CSSMMNode.TYPE_KEYWORD) {
                addString(candidates, val.toString());
            } else if (valueType == CSSMMNode.TYPE_NUMBER) {
                addNumber(candidates, (CSSMMNumber) val);
            } else if (valueType == CSSMMNode.TYPE_FUNCTION) {
                addFunction(candidates, (CSSMMFunction) val);
            }
        }
    }
    addImportant(candidates);
    addSemiColon(candidates);
    return candidates.iterator();
}
Also used : CSSMMNode(org.eclipse.wst.css.core.internal.metamodel.CSSMMNode) CSSMetaModelUtil(org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil) CSSMMProperty(org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty) ArrayList(java.util.ArrayList) RegionIterator(org.eclipse.wst.css.core.internal.util.RegionIterator) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) CSSMMDescriptor(org.eclipse.wst.css.core.internal.metamodel.CSSMMDescriptor) CSSMMNumber(org.eclipse.wst.css.core.internal.metamodel.CSSMMNumber)

Aggregations

ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 CSSMMDescriptor (org.eclipse.wst.css.core.internal.metamodel.CSSMMDescriptor)1 CSSMMNode (org.eclipse.wst.css.core.internal.metamodel.CSSMMNode)1 CSSMMNumber (org.eclipse.wst.css.core.internal.metamodel.CSSMMNumber)1 CSSMMProperty (org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty)1 CSSMetaModelUtil (org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil)1 RegionIterator (org.eclipse.wst.css.core.internal.util.RegionIterator)1