use of org.eclipse.wst.css.core.internal.formatter.AttrChangeContext in project webtools.sourceediting by eclipse.
the class CSSModelUpdater method attrInserted.
/**
* @param parentNode
* org.eclipse.wst.css.core.model.CSSNodeImpl
* @param node
* org.eclipse.wst.css.core.model.CSSNodeImpl
*/
private void attrInserted(CSSNodeImpl parentNode, CSSAttrImpl attr) {
CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter(parentNode);
if (formatter == null) {
// $NON-NLS-1$
CSSUtil.debugOut("Cannot get format adapter : " + parentNode.getClass().toString());
return;
}
short updateMode = CSSModelUpdateContext.UPDATE_INSERT_RCONTAINER;
fParser.setupUpdateContext(updateMode, parentNode, attr);
// get formatted info
AttrChangeContext region = new AttrChangeContext();
String text = new String(formatter.formatAttrChanged(parentNode, attr, true, region));
// set text
insertText(region.start, region.end - region.start, text);
fParser.cleanupUpdateContext();
}
use of org.eclipse.wst.css.core.internal.formatter.AttrChangeContext in project webtools.sourceediting by eclipse.
the class CSSModelUpdater method attrRemoved.
/**
* @param parentNode
* org.eclipse.wst.css.core.model.CSSNodeImpl
* @param node
* org.eclipse.wst.css.core.model.CSSNodeImpl
*/
private void attrRemoved(CSSNodeImpl parentNode, CSSAttrImpl attr) {
CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter(parentNode);
if (formatter == null) {
// $NON-NLS-1$
CSSUtil.debugOut("Cannot get format adapter : " + parentNode.getClass().toString());
return;
}
short updateMode = CSSModelUpdateContext.UPDATE_REMOVE_RCONTAINER;
fParser.setupUpdateContext(updateMode, parentNode, attr);
// get formatted info
AttrChangeContext region = new AttrChangeContext();
String text = new String(formatter.formatAttrChanged(parentNode, attr, false, region));
// set text
insertText(region.start, region.end - region.start, text);
fParser.cleanupUpdateContext();
}
Aggregations