Search in sources :

Example 11 with CSSMMNode

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

the class CSSMetaModelImpl method getCategories.

public Iterator getCategories() {
    List categories = new ArrayList();
    Iterator i = getChildNodes();
    while (i.hasNext()) {
        CSSMMNode node = (CSSMMNode) i.next();
        if (node.getType() == TYPE_CATEGORY) {
            categories.add(node);
        }
    }
    return categories.iterator();
}
Also used : CSSMMNode(org.eclipse.wst.css.core.internal.metamodel.CSSMMNode) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList)

Example 12 with CSSMMNode

use of org.eclipse.wst.css.core.internal.metamodel.CSSMMNode 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 13 with CSSMMNode

use of org.eclipse.wst.css.core.internal.metamodel.CSSMMNode 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 14 with CSSMMNode

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

Iterator (java.util.Iterator)14 CSSMMNode (org.eclipse.wst.css.core.internal.metamodel.CSSMMNode)14 CSSMetaModelUtil (org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil)8 ArrayList (java.util.ArrayList)6 HashSet (java.util.HashSet)6 List (java.util.List)6 Set (java.util.Set)6 CSSMMProperty (org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty)6 CSSMetaModel (org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel)6 ICSSNode (org.eclipse.wst.css.core.internal.provisional.document.ICSSNode)4 ICSSStyleDeclItem (org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem)3 HashMap (java.util.HashMap)2 ICSSStyleDeclaration (org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration)2 ICSSStyleRule (org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule)2 Map (java.util.Map)1 Preferences (org.eclipse.core.runtime.Preferences)1 IPropertyDescriptor (org.eclipse.ui.views.properties.IPropertyDescriptor)1 CSSMMCategory (org.eclipse.wst.css.core.internal.metamodel.CSSMMCategory)1 CSSMMDescriptor (org.eclipse.wst.css.core.internal.metamodel.CSSMMDescriptor)1 CSSMMNumber (org.eclipse.wst.css.core.internal.metamodel.CSSMMNumber)1