Search in sources :

Example 6 with CSSMetaModel

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

Example 7 with CSSMetaModel

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

the class CSSMetaModelTest method testColorPropertyValues2r1.

public void testColorPropertyValues2r1() {
    CSSMetaModel model = CSSProfileRegistry.getInstance().getDefaultProfile().getMetaModel();
    if (model != null) {
        CSSMetaModelUtil util = new CSSMetaModelUtil(model);
        CSSMMProperty property = util.getProperty(PropCMProperty.P_COLOR);
        Iterator it = property.getValues();
        Set set = new HashSet(1);
        set.add(IValID.V_ORANGE);
        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

CSSMetaModel (org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel)7 HashSet (java.util.HashSet)6 Iterator (java.util.Iterator)6 Set (java.util.Set)6 CSSMMNode (org.eclipse.wst.css.core.internal.metamodel.CSSMMNode)6 CSSMetaModelUtil (org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil)6 CSSMMProperty (org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty)5 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 IPropertyDescriptor (org.eclipse.ui.views.properties.IPropertyDescriptor)1 CSSMMCategory (org.eclipse.wst.css.core.internal.metamodel.CSSMMCategory)1 CSSProfile (org.eclipse.wst.css.core.internal.metamodel.CSSProfile)1 ICSSNode (org.eclipse.wst.css.core.internal.provisional.document.ICSSNode)1 ICSSNodeList (org.eclipse.wst.css.core.internal.provisional.document.ICSSNodeList)1 ICSSStyleDeclItem (org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem)1 CSSStyleDeclaration (org.w3c.dom.css.CSSStyleDeclaration)1