use of org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry 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));
}
use of org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry in project webtools.sourceediting by eclipse.
the class TestModelHandlers method testXMLExistsFromFilename.
public void testXMLExistsFromFilename() throws IOException {
String filename = "test.xml";
ModelHandlerRegistry registry = getModelHandlerRegistry();
IModelHandler handler = registry.getHandlerFor(filename, null);
assertEquals("model handler registry does not have XML type ", ContentTypeIdForXML.ContentTypeID_XML, handler.getAssociatedContentTypeId());
}
use of org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry in project webtools.sourceediting by eclipse.
the class ModelManagerImpl method calculateType.
private IModelHandler calculateType(IFile iFile) throws CoreException {
// IModelManager mm = ((ModelManagerPlugin)
// Platform.getPlugin(ModelManagerPlugin.ID)).getModelManager();
ModelHandlerRegistry cr = getModelHandlerRegistry();
IModelHandler cd = cr.getHandlerFor(iFile);
return cd;
}
use of org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry in project webtools.sourceediting by eclipse.
the class ModelManagerImpl method createStructuredDocumentFor.
/**
* Conveience method, since a proper IStructuredDocument must have a
* proper parser assigned. It should only be used when an empty
* structuredDocument is needed. Otherwise, use IFile form.
*
* @deprecated - TODO: to be removed by C4 do we really need this? I
* recommend to - use createStructuredDocumentFor(filename,
* null, null) - the filename does not need to represent a
* real - file, but can take for form of dummy.jsp, test.xml,
* etc. - That way we don't hard code the handler, but specify
* we - want the handler that "goes with" a certain type of -
* file.
*/
public IStructuredDocument createStructuredDocumentFor(String contentTypeId) {
IDocumentLoader loader = null;
ModelHandlerRegistry cr = getModelHandlerRegistry();
IModelHandler handler = cr.getHandlerForContentTypeId(contentTypeId);
if (handler == null)
// $NON-NLS-1$
Logger.log(Logger.ERROR, "Program error: no model handler found for " + contentTypeId);
loader = handler.getDocumentLoader();
IStructuredDocument result = (IStructuredDocument) loader.createNewStructuredDocument();
return result;
}
use of org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry in project webtools.sourceediting by eclipse.
the class TestModelHandlers method testXMLExists.
public void testXMLExists() {
String id = ContentTypeIdForXML.ContentTypeID_XML;
ModelHandlerRegistry registry = getModelHandlerRegistry();
IModelHandler handler = registry.getHandlerForContentTypeId(id);
assertEquals("model handler registry does not have XML type ", id, handler.getAssociatedContentTypeId());
}
Aggregations