Search in sources :

Example 1 with ModelHandlerRegistry

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

the class ModelManagerImpl method calculateType.

private IModelHandler calculateType(String filename, InputStream inputStream) throws IOException {
    ModelHandlerRegistry cr = getModelHandlerRegistry();
    IModelHandler cd = cr.getHandlerFor(filename, inputStream);
    return cd;
}
Also used : ModelHandlerRegistry(org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry) IModelHandler(org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler)

Example 2 with ModelHandlerRegistry

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

the class ModelManagerImpl method createUnManagedStructuredModelFor.

/**
 * Conveience method. It depends on the loaders newModel method to return
 * an appropriate StrucuturedModel appropriately initialized.
 */
public IStructuredModel createUnManagedStructuredModelFor(String contentTypeId, URIResolver resolver) {
    IStructuredModel result = null;
    ModelHandlerRegistry cr = getModelHandlerRegistry();
    IModelHandler handler = cr.getHandlerForContentTypeId(contentTypeId);
    try {
        // $NON-NLS-1$
        result = _commonCreateModel(UNMANAGED_MODEL, handler, resolver);
    } catch (ResourceInUse e) {
        // this may need to be re-examined.
        if (Logger.DEBUG_MODELMANAGER)
            // $NON-NLS-1$ //$NON-NLS-2$
            Logger.log(Logger.INFO, "ModelMangerImpl::createUnManagedStructuredModelFor. Model unexpectedly in use.");
    }
    return result;
}
Also used : ModelHandlerRegistry(org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel) IModelHandler(org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler) ResourceInUse(org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse)

Example 3 with ModelHandlerRegistry

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

the class TestModelHandlers method testCSSExistsFromFilename.

public void testCSSExistsFromFilename() throws IOException {
    String filename = "test.css";
    ModelHandlerRegistry registry = getModelHandlerRegistry();
    IModelHandler handler = registry.getHandlerFor(filename, null);
    assertTrue("model handler registry does not have CSS type ", handler != null && handler.getAssociatedContentTypeId().equals(ContentTypeIdForCSS.ContentTypeID_CSS));
}
Also used : ModelHandlerRegistry(org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry) IModelHandler(org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler)

Example 4 with ModelHandlerRegistry

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

the class TestModelHandlers method testHTMLExistsFromFilename.

public void testHTMLExistsFromFilename() throws IOException {
    String filename = "test.html";
    ModelHandlerRegistry registry = getModelHandlerRegistry();
    IModelHandler handler = registry.getHandlerFor(filename, null);
    assertTrue("model handler registry does not have HTML type ", handler != null && handler.getAssociatedContentTypeId().equals(ContentTypeIdForHTML.ContentTypeID_HTML));
}
Also used : ModelHandlerRegistry(org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry) IModelHandler(org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler)

Example 5 with ModelHandlerRegistry

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

the class TestModelHandlers method testDTDExistsFromFilename.

public void testDTDExistsFromFilename() throws IOException {
    String filename = "test.dtd";
    ModelHandlerRegistry registry = getModelHandlerRegistry();
    IModelHandler handler = registry.getHandlerFor(filename, null);
    assertTrue("model handler registry does not have DTD type ", handler != null && handler.getAssociatedContentTypeId().equals("org.eclipse.wst.dtd.core.dtdsource"));
}
Also used : ModelHandlerRegistry(org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry) IModelHandler(org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler)

Aggregations

ModelHandlerRegistry (org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry)15 IModelHandler (org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler)14 IDocumentLoader (org.eclipse.wst.sse.core.internal.document.IDocumentLoader)1 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)1 ResourceInUse (org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse)1 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)1