use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler 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.ltk.modelhandler.IModelHandler in project webtools.sourceediting by eclipse.
the class PositionUpdatingCornerCasesTest method createDocument.
private IDocument createDocument(String contents) {
IModelHandler handler = ModelHandlerRegistry.getInstance().getHandlerForContentTypeId("org.eclipse.jst.jsp.jspsource");
BasicStructuredDocument document = (BasicStructuredDocument) handler.getDocumentLoader().createNewStructuredDocument();
document.set(contents);
return document;
}
use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler in project webtools.sourceediting by eclipse.
the class DocumentImpl method isJSPType.
/**
*/
public boolean isJSPType() {
if (this.model == null)
return false;
IModelHandler handler = this.model.getModelHandler();
if (handler == null)
return false;
String id = handler.getAssociatedContentTypeId();
if (id == null)
return false;
// $NON-NLS-1$
return id.equals("org.eclipse.jst.jsp.core.jspsource");
}
use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler in project webtools.sourceediting by eclipse.
the class ModelHandlerRegistryTest method testGetHandlerWithDefault.
public void testGetHandlerWithDefault() throws Exception {
IProject project = setUp(getName());
IFile file = project.getFile(FILE);
IModelHandler handler;
try {
handler = ModelHandlerRegistry.getInstance().getHandlerFor(file, true);
assertNotNull("Model handler default should not be null.", handler);
assertEquals("Proper default model handler was not returned.", handler.getId(), "org.eclipse.wst.xml.core.modelhandler");
} catch (CoreException e) {
fail("Caught exception: " + e);
}
tearDown(getName());
}
use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler in project webtools.sourceediting by eclipse.
the class ModelHandlerRegistryTest method testGetHandlerWithoutDefault.
public void testGetHandlerWithoutDefault() throws Exception {
IProject project = setUp(getName());
IFile file = project.getFile(FILE);
IModelHandler handler;
try {
handler = ModelHandlerRegistry.getInstance().getHandlerFor(file, false);
assertNull("Model handler should not have returned a handler.", handler);
} catch (CoreException e) {
fail("Caught exception: " + e);
}
tearDown(getName());
}
Aggregations