use of org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.InferredGrammarBuildingCMDocumentLoader in project webtools.sourceediting by eclipse.
the class DOMObserver method invokeCMDocumentLoad.
public void invokeCMDocumentLoad() {
if (fIsDisabled)
return;
try {
fIsLoading = true;
ModelQuery modelQuery = ModelQueryUtil.getModelQuery(fDocument);
if ((modelQuery != null) && (modelQuery.getCMDocumentManager() != null)) {
CMDocumentLoader loader = isGrammarInferenceEnabled ? new InferredGrammarBuildingCMDocumentLoader(fDocument, modelQuery) : new CMDocumentLoader(fDocument, modelQuery);
loader.loadCMDocuments();
}
} finally {
fIsLoading = false;
}
}
use of org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.InferredGrammarBuildingCMDocumentLoader in project webtools.sourceediting by eclipse.
the class ReloadDependenciesHandler method execute.
/*
* (non-Javadoc)
*
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
ITextEditor textEditor = null;
if (editor instanceof ITextEditor)
textEditor = (ITextEditor) editor;
else {
Object o = editor.getAdapter(ITextEditor.class);
if (o != null)
textEditor = (ITextEditor) o;
}
if (textEditor != null) {
IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
if (model != null) {
ModelQuery modelQuery = null;
try {
modelQuery = ModelQueryUtil.getModelQuery(model);
} finally {
model.releaseFromRead();
}
Document domDocument = ((IDOMModel) model).getDocument();
if ((modelQuery != null) && (modelQuery.getCMDocumentManager() != null)) {
modelQuery.getCMDocumentManager().getCMDocumentCache().clear();
// TODO... need to figure out how to access the
// DOMObserver via ModelQuery
// ...why?
CMDocumentLoader loader = new InferredGrammarBuildingCMDocumentLoader(domDocument, modelQuery);
loader.loadCMDocuments();
}
}
}
return null;
}
Aggregations