use of org.eclipse.wst.css.core.internal.provisional.document.ICSSModel in project webtools.sourceediting by eclipse.
the class LinkElementAdapter method released.
/**
*/
public void released() {
ICSSModel model = getExistingModel();
if (model != null) {
try {
// get ModelProvideAdapter
IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
// set element to null first, so that no document wide updates
setElement(null);
setModel(null);
if (adapter != null)
adapter.modelReleased(model);
} finally {
model.releaseFromRead();
}
}
this.replaceModel = false;
}
use of org.eclipse.wst.css.core.internal.provisional.document.ICSSModel in project webtools.sourceediting by eclipse.
the class StyleAttrAdapter method getModel.
/**
*/
public ICSSModel getModel() {
ICSSModel model = getExistingModel();
if (model == null && isModelNecessary()) {
model = createModel();
if (model == null)
return null;
IStructuredDocument structuredDocument = model.getStructuredDocument();
if (structuredDocument == null)
return null;
RegionParser parser = structuredDocument.getParser();
if (parser instanceof CSSSourceParser) {
((CSSSourceParser) parser).setParserMode(CSSSourceParser.MODE_DECLARATION);
} else {
return null;
}
structuredDocument.addDocumentChangedListener(this);
// need to set before valueChanged()
setModel(model);
valueChanged();
}
if (model != null && !isModelNecessary()) {
model = null;
valueChanged();
}
return model;
}
Aggregations