setModel(model, false); // need to set before contentChanged()
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;
}