* getExistingModelFor*(IDocument). Supported document
* providers ensure that the document maps to a shared
* structured model.
*/
public IStructuredModel getModel() {
IDocumentProvider documentProvider = getDocumentProvider();
if (documentProvider == null) {
// this indicated an error in startup sequence
Logger.trace(getClass().getName(), "Program Info Only: document provider was null when model requested"); //$NON-NLS-1$ //$NON-NLS-2$
}
// Remember if we entered this method without a model existing
boolean initialModelNull = (fStructuredModel == null);
if (fStructuredModel == null && documentProvider != null) {
// lazily set the model instance, although this is an ABNORMAL
// CODE PATH
if (documentProvider instanceof IModelProvider) {
fStructuredModel = ((IModelProvider) documentProvider).getModel(getEditorInput());
fisReleased = false;
}
else {
IDocument doc = documentProvider.getDocument(getEditorInput());
if (doc instanceof IStructuredDocument) {
/*
* Called in this manner because getExistingModel can skip
* some calculations always performed in getModelForEdit
*/