Search in sources :

Example 1 with CSSMMProperty

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

the class CSSMetaModelTest method testDisplayPropertyValues2r1.

public void testDisplayPropertyValues2r1() {
    CSSMetaModel model = CSSProfileRegistry.getInstance().getDefaultProfile().getMetaModel();
    if (model != null) {
        CSSMetaModelUtil util = new CSSMetaModelUtil(model);
        CSSMMProperty property = util.getProperty(PropCMProperty.P_DISPLAY);
        Iterator it = property.getValues();
        Set set = new HashSet(1);
        set.add(IValID.V_INLINE_BLOCK);
        while (it.hasNext()) {
            CSSMMNode node = (CSSMMNode) it.next();
            if (set.contains(node.getName())) {
                assertEquals("Property should be a keyword", CSSMMNode.TYPE_KEYWORD, node.getType());
                set.remove(node.getName());
            }
        }
        assertTrue("The content property is missing values added for CSS 2 revision 1.", set.isEmpty());
    }
}
Also used : CSSMMNode(org.eclipse.wst.css.core.internal.metamodel.CSSMMNode) HashSet(java.util.HashSet) Set(java.util.Set) CSSMetaModelUtil(org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil) CSSMMProperty(org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty) CSSMetaModel(org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel) Iterator(java.util.Iterator) HashSet(java.util.HashSet)

Example 2 with CSSMMProperty

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

the class CSSMetaModelTest method testWhitespacePropertyValues2r1.

public void testWhitespacePropertyValues2r1() {
    CSSMetaModel model = CSSProfileRegistry.getInstance().getDefaultProfile().getMetaModel();
    if (model != null) {
        CSSMetaModelUtil util = new CSSMetaModelUtil(model);
        CSSMMProperty property = util.getProperty(PropCMProperty.P_WHITE_SPACE);
        Iterator it = property.getValues();
        Set set = new HashSet(1);
        set.add(IValID.V_PRE_LINE);
        set.add(IValID.V_PRE_WRAP);
        while (it.hasNext()) {
            CSSMMNode node = (CSSMMNode) it.next();
            if (set.contains(node.getName())) {
                assertEquals("Property should be a keyword", CSSMMNode.TYPE_KEYWORD, node.getType());
                set.remove(node.getName());
            }
        }
        assertTrue("The content property is missing values added for CSS 2 revision 1.", set.isEmpty());
    }
}
Also used : CSSMMNode(org.eclipse.wst.css.core.internal.metamodel.CSSMMNode) HashSet(java.util.HashSet) Set(java.util.Set) CSSMetaModelUtil(org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil) CSSMMProperty(org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty) CSSMetaModel(org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel) Iterator(java.util.Iterator) HashSet(java.util.HashSet)

Example 3 with CSSMMProperty

use of org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty 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)

Example 4 with CSSMMProperty

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

the class CSSMetaModelTest method testCursorPropertyValues2r1.

public void testCursorPropertyValues2r1() {
    CSSMetaModel model = CSSProfileRegistry.getInstance().getDefaultProfile().getMetaModel();
    if (model != null) {
        CSSMetaModelUtil util = new CSSMetaModelUtil(model);
        CSSMMProperty property = util.getProperty(PropCMProperty.P_CURSOR);
        Iterator it = property.getValues();
        Set set = new HashSet(1);
        set.add(IValID.V_PROGRESS);
        while (it.hasNext()) {
            CSSMMNode node = (CSSMMNode) it.next();
            if (set.contains(node.getName())) {
                assertEquals("Property should be a keyword", CSSMMNode.TYPE_KEYWORD, node.getType());
                set.remove(node.getName());
            }
        }
        assertTrue("The content property is missing values added for CSS 2 revision 1.", set.isEmpty());
    }
}
Also used : CSSMMNode(org.eclipse.wst.css.core.internal.metamodel.CSSMMNode) HashSet(java.util.HashSet) Set(java.util.Set) CSSMetaModelUtil(org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil) CSSMMProperty(org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty) CSSMetaModel(org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel) Iterator(java.util.Iterator) HashSet(java.util.HashSet)

Example 5 with CSSMMProperty

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

the class CSSMetaModelTest method testContentPropertyValues2r1.

public void testContentPropertyValues2r1() {
    CSSMetaModel model = CSSProfileRegistry.getInstance().getDefaultProfile().getMetaModel();
    if (model != null) {
        CSSMetaModelUtil util = new CSSMetaModelUtil(model);
        CSSMMProperty property = util.getProperty(PropCMProperty.P_CONTENT);
        Iterator it = property.getValues();
        Set set = new HashSet(2);
        set.add(IValID.V_NORMAL);
        set.add(IValID.V_NONE);
        while (it.hasNext()) {
            CSSMMNode node = (CSSMMNode) it.next();
            if (set.contains(node.getName())) {
                assertEquals("Property should be a keyword", CSSMMNode.TYPE_KEYWORD, node.getType());
                set.remove(node.getName());
            }
        }
        assertTrue("The content property is missing values added for CSS 2 revision 1.", set.isEmpty());
    }
}
Also used : CSSMMNode(org.eclipse.wst.css.core.internal.metamodel.CSSMMNode) HashSet(java.util.HashSet) Set(java.util.Set) CSSMetaModelUtil(org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil) CSSMMProperty(org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty) CSSMetaModel(org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel) Iterator(java.util.Iterator) HashSet(java.util.HashSet)

Aggregations

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