Search in sources :

Example 6 with PropagatingAdapter

use of org.eclipse.wst.sse.core.internal.PropagatingAdapter in project webtools.sourceediting by eclipse.

the class JSPDocumentLoader method preLoadAdapt.

protected void preLoadAdapt(IStructuredModel structuredModel) {
    IDOMModel domModel = (IDOMModel) structuredModel;
    // 
    // document must have already been set for this to
    // work.
    Document document = domModel.getDocument();
    Assert.isNotNull(document, JSPCoreMessages.JSPDocumentLoader_1);
    // if there is a model in the adapter, this will adapt it to
    // first node. After that the PropagatingAdater spreads over the
    // children being
    // created. Each time that happends, a side effect is to
    // also "spread" sprecific registered adapters,
    // they two can propigate is needed.
    // This 'get' causes first to be be attached.
    PropagatingAdapter propagatingAdapter = (PropagatingAdapter) ((INodeNotifier) document).getAdapterFor(PropagatingAdapter.class);
    // may make this easier to use in futue
    propagatingAdapter.addAdaptOnCreateFactory(new PageDirectiveWatcherFactory());
    // For JSPs, the ModelQueryAdapter must be "attached" to the document
    // before content is set in the model, so taglib initization can
    // take place.
    ((INodeNotifier) document).getAdapterFor(ModelQueryAdapter.class);
}
Also used : IDOMModel(org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel) PropagatingAdapter(org.eclipse.wst.sse.core.internal.PropagatingAdapter) Document(org.w3c.dom.Document) IEncodedDocument(org.eclipse.wst.sse.core.internal.provisional.document.IEncodedDocument) BasicStructuredDocument(org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument) IStructuredDocument(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument) PageDirectiveWatcherFactory(org.eclipse.jst.jsp.core.internal.document.PageDirectiveWatcherFactory) INodeNotifier(org.eclipse.wst.sse.core.internal.provisional.INodeNotifier)

Aggregations

PropagatingAdapter (org.eclipse.wst.sse.core.internal.PropagatingAdapter)6 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)6 INodeNotifier (org.eclipse.wst.sse.core.internal.provisional.INodeNotifier)5 DebugAdapterFactory (org.eclipse.wst.xml.core.internal.DebugAdapterFactory)4 PageDirectiveWatcherFactory (org.eclipse.jst.jsp.core.internal.document.PageDirectiveWatcherFactory)2 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)2 BasicStructuredDocument (org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument)2 IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)2 Document (org.w3c.dom.Document)2 IDocument (org.eclipse.jface.text.IDocument)1 IEncodedDocument (org.eclipse.wst.sse.core.internal.provisional.document.IEncodedDocument)1