Search in sources :

Example 6 with IModelHandler

use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler 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 7 with IModelHandler

use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler 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 8 with IModelHandler

use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler 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 9 with IModelHandler

use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler 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)

Example 10 with IModelHandler

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

the class TestModelHandlers method testHTMLExists.

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

Aggregations

IModelHandler (org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler)41 ModelHandlerRegistry (org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry)14 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)9 CoreException (org.eclipse.core.runtime.CoreException)6 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)6 IContentType (org.eclipse.core.runtime.content.IContentType)5 IModelLoader (org.eclipse.wst.sse.core.internal.provisional.IModelLoader)5 InputStream (java.io.InputStream)4 IFile (org.eclipse.core.resources.IFile)4 IDocumentLoader (org.eclipse.wst.sse.core.internal.document.IDocumentLoader)4 ResourceInUse (org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse)4 IOException (java.io.IOException)3 IProject (org.eclipse.core.resources.IProject)3 BasicStructuredDocument (org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument)3 URIResolver (org.eclipse.wst.sse.core.internal.util.URIResolver)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)2 IDocument (org.eclipse.jface.text.IDocument)2 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)2