use of org.eclipse.wst.css.core.internal.provisional.document.ICSSNode in project webtools.sourceediting by eclipse.
the class CSSStyleDeclarationImpl method getLength.
/**
* @return int
*/
public int getLength() {
int i = 0;
ICSSNode node = getFirstChild();
while (node != null) {
if (node instanceof CSSStyleDeclItemImpl)
i++;
node = node.getNextSibling();
}
return i;
}
use of org.eclipse.wst.css.core.internal.provisional.document.ICSSNode in project webtools.sourceediting by eclipse.
the class CSSModelDeletionContext method findContainer.
/**
*/
private CSSStructuredDocumentRegionContainer findContainer(CSSNodeImpl parent, IStructuredDocumentRegion flatNode) {
if (parent instanceof CSSStructuredDocumentRegionContainer) {
// Am i a container of flatNode?
IStructuredDocumentRegion firstNode = ((CSSStructuredDocumentRegionContainer) parent).getFirstStructuredDocumentRegion();
IStructuredDocumentRegion lastNode = ((CSSStructuredDocumentRegionContainer) parent).getLastStructuredDocumentRegion();
int firstStart = getOriginalOffset(firstNode);
int lastStart = getOriginalOffset(lastNode);
int start = flatNode.getStart();
if (firstStart <= start && start <= lastStart) {
// I am a container, is my child a container ?
for (ICSSNode node = parent.getFirstChild(); node != null; node = node.getNextSibling()) {
if (node instanceof CSSNodeImpl) {
CSSStructuredDocumentRegionContainer container = findContainer((CSSNodeImpl) node, flatNode);
if (container != null) {
return container;
}
}
}
return (CSSStructuredDocumentRegionContainer) parent;
}
}
return null;
}
use of org.eclipse.wst.css.core.internal.provisional.document.ICSSNode in project webtools.sourceediting by eclipse.
the class CSSModelUpdateContext method getCSSStyleDeclItem.
/**
*/
CSSStyleDeclItemImpl getCSSStyleDeclItem(String propertyName) {
ICSSNode node = getNode();
if (node instanceof CSSStyleDeclItemImpl && ((CSSStyleDeclItemImpl) node).getPropertyName().equalsIgnoreCase(propertyName)) {
return (CSSStyleDeclItemImpl) node;
} else {
CSSUtil.debugOut(// $NON-NLS-1$
"CSSStyleDeclItemImpl(" + propertyName + ") is expected, but " + // $NON-NLS-1$
CSSUtil.getClassString(node));
ungetNode();
// $NON-NLS-1$
throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");
}
}
use of org.eclipse.wst.css.core.internal.provisional.document.ICSSNode in project webtools.sourceediting by eclipse.
the class CSSModelUpdateContext method getNode.
/**
*/
private ICSSNode getNode() {
ICSSNode node = null;
if (fNodeList != null && 0 < fNodeList.size()) {
node = (ICSSNode) fNodeList.removeFirst();
}
fLastNode = node;
return node;
}
use of org.eclipse.wst.css.core.internal.provisional.document.ICSSNode in project webtools.sourceediting by eclipse.
the class CSSModelUpdateContext method getCSSImportRule.
/**
*/
CSSImportRuleImpl getCSSImportRule() {
ICSSNode node = getNode();
if (node instanceof CSSImportRuleImpl) {
return (CSSImportRuleImpl) node;
} else {
CSSUtil.debugOut(// $NON-NLS-1$
"CSSImportRuleImpl is expected, but " + CSSUtil.getClassString(node));
ungetNode();
// $NON-NLS-1$
throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");
}
}
Aggregations