use of org.eclipse.wst.css.core.internal.provisional.adapters.IModelProvideAdapter in project webtools.sourceediting by eclipse.
the class CSSImportRuleImpl method releaseRule.
/**
*/
void releaseRule() {
if (fStyleSheet != null) {
ICSSStyleSheet sheet = fStyleSheet;
// to prevent loop, we must reset fStyleSheet
fStyleSheet = null;
// before all closing action
sheet.getModel().removeStyleListener(getOwnerDocument().getModel());
// get ModelProvideAdapter
IModelProvideAdapter adapter = (IModelProvideAdapter) getAdapterFor(IModelProvideAdapter.class);
// }
if (adapter != null)
adapter.modelReleased(sheet.getModel());
sheet.getModel().releaseFromRead();
}
}
use of org.eclipse.wst.css.core.internal.provisional.adapters.IModelProvideAdapter in project webtools.sourceediting by eclipse.
the class CSSImportRuleImpl method closeStyleSheet.
/**
*/
void closeStyleSheet() {
if (fStyleSheet != null) {
ICSSStyleSheet sheet = fStyleSheet;
// to prevent loop, we must reset fStyleSheet
fStyleSheet = null;
// before all closing action
sheet.getModel().removeStyleListener(getOwnerDocument().getModel());
// get ModelProvideAdapter
IModelProvideAdapter adapter = (IModelProvideAdapter) getAdapterFor(IModelProvideAdapter.class);
// }
if (adapter != null)
adapter.modelRemoved(sheet.getModel());
sheet.getModel().releaseFromRead();
}
}
use of org.eclipse.wst.css.core.internal.provisional.adapters.IModelProvideAdapter in project webtools.sourceediting by eclipse.
the class StyleElementAdapter method getModel.
/**
*/
public ICSSModel getModel() {
ICSSModel model = getExistingModel();
if (this.replaceModel) {
ICSSModel oldModel = model;
model = createModel(false);
// need to set before contentChanged()
setModel(model, false);
contentChanged();
// from super.createModel()
// get ModelProvideAdapter
IModelProvideAdapter modelProvideAdapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
// notify adapter
if (modelProvideAdapter != null)
modelProvideAdapter.modelProvided(model);
// from createModel()
IStructuredDocument structuredDocument = null;
if (model != null)
structuredDocument = model.getStructuredDocument();
if (structuredDocument == null)
return null;
structuredDocument.addDocumentChangedListener(this);
// from setModel()
if (oldModel != null)
oldModel.removeStyleListener(this);
if (model != null)
model.addStyleListener(this);
if (oldModel != null) {
// get ModelProvideAdapter
IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
if (adapter != null) {
adapter.modelRemoved(oldModel);
}
}
this.replaceModel = false;
}
return model;
}
use of org.eclipse.wst.css.core.internal.provisional.adapters.IModelProvideAdapter in project webtools.sourceediting by eclipse.
the class AbstractStyleSheetAdapter method released.
/**
*/
public void released() {
ICSSModel currentModel = getModel();
// get ModelProvideAdapter
IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
setElement(null);
setModel(null);
if (adapter != null)
adapter.modelReleased(currentModel);
if (currentModel != null)
currentModel.releaseFromRead();
}
use of org.eclipse.wst.css.core.internal.provisional.adapters.IModelProvideAdapter 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;
}
Aggregations