Search in sources :

Example 1 with JSPModelQueryAdapterImpl

use of org.eclipse.jst.jsp.core.internal.modelquery.JSPModelQueryAdapterImpl in project webtools.sourceediting by eclipse.

the class JSPModelLoader method createModel.

public IStructuredModel createModel(IStructuredModel oldModel) {
    IStructuredModel model = super.createModel(oldModel);
    // For JSPs, the ModelQueryAdapter must be "attached" to the document
    // before content is set in the model, so taglib initialization can
    // take place.
    // In this "clone model" case, we create a ModelQuery adapter
    // create a new instance from the old data. Note: I think this
    // "forced fit" only works here since the implementation of
    // ModelQueryAdapter does not
    // have to be released.
    ModelQueryAdapter modelQueryAdapter = getModelQueryAdapter(model);
    if (modelQueryAdapter == null) {
        modelQueryAdapter = getModelQueryAdapter(oldModel);
        IDOMDocument document = ((IDOMModel) model).getDocument();
        document.addAdapter(new JSPModelQueryAdapterImpl(modelQueryAdapter.getCMDocumentCache(), modelQueryAdapter.getModelQuery(), modelQueryAdapter.getIdResolver()));
    }
    return model;
}
Also used : ModelQueryAdapter(org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter) IDOMModel(org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel) JSPModelQueryAdapterImpl(org.eclipse.jst.jsp.core.internal.modelquery.JSPModelQueryAdapterImpl) IDOMDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)

Aggregations

JSPModelQueryAdapterImpl (org.eclipse.jst.jsp.core.internal.modelquery.JSPModelQueryAdapterImpl)1 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)1 IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)1 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)1 ModelQueryAdapter (org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter)1