Search in sources :

Example 1 with NullMemento

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

the class ModelManagerImpl method createStructuredDocumentFor.

/**
 * Convenience method. This method can be used when the resource does not
 * really exist (e.g. when content is being created, but hasn't been
 * written to disk yet). Note that since the content is being provided as
 * a String, it is assumed to already be decoded correctly so no
 * transformation is done.
 */
public IStructuredDocument createStructuredDocumentFor(String filename, String content, URIResolver resolver) throws IOException {
    IDocumentLoader loader = null;
    IModelHandler handler = calculateType(filename, null);
    loader = handler.getDocumentLoader();
    IStructuredDocument result = (IStructuredDocument) loader.createNewStructuredDocument();
    result.setEncodingMemento(new NullMemento());
    result.setText(this, content);
    return result;
}
Also used : IDocumentLoader(org.eclipse.wst.sse.core.internal.document.IDocumentLoader) NullMemento(org.eclipse.wst.sse.core.internal.NullMemento) IStructuredDocument(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument) IModelHandler(org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler)

Aggregations

NullMemento (org.eclipse.wst.sse.core.internal.NullMemento)1 IDocumentLoader (org.eclipse.wst.sse.core.internal.document.IDocumentLoader)1 IModelHandler (org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler)1 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)1