use of org.eclipse.core.runtime.content.IContentTypeManager in project webtools.sourceediting by eclipse.
the class TestContentTypeHandlers method testDTDExists.
public void testDTDExists() {
String id = "org.eclipse.wst.dtd.core.dtdsource";
IContentTypeManager registry = getContentTypeRegistry();
IContentType identifier = registry.getContentType(id);
assertTrue("content type identifier " + id + " does not have DTD type ", identifier != null);
}
use of org.eclipse.core.runtime.content.IContentTypeManager in project webtools.sourceediting by eclipse.
the class TestContentTypeHandlers method testXMLExistsByFileExtension.
public void testXMLExistsByFileExtension() throws IOException {
String filename = "test.xml";
IContentTypeManager registry = getContentTypeRegistry();
IContentType identifier = registry.getDescriptionFor(new NullStream(), filename, IContentDescription.ALL).getContentType();
assertTrue("content type identifier for " + filename + " does not have XML type ", identifier != null);
}
use of org.eclipse.core.runtime.content.IContentTypeManager in project webtools.sourceediting by eclipse.
the class TestContentTypeHandlers method testMultipleDefinitions.
public void testMultipleDefinitions() throws IOException {
String id = ContentTypeIdForCSS.ContentTypeID_CSS;
String filename = "test.css";
IContentTypeManager registry = getContentTypeRegistry();
IContentType identifier1 = registry.getContentType(id);
IContentType identifier2 = registry.getDescriptionFor(new NullStream(), filename, IContentDescription.ALL).getContentType();
assertTrue("mulitple content type identifiers need to be equal (but not same instance) ", identifier1.equals(identifier2));
}
use of org.eclipse.core.runtime.content.IContentTypeManager in project webtools.sourceediting by eclipse.
the class TestContentTypeHandlers method testHTMLExistsByFileExtension.
public void testHTMLExistsByFileExtension() throws IOException {
String filename = "test.html";
IContentTypeManager registry = getContentTypeRegistry();
IContentType identifier = registry.getDescriptionFor(new NullStream(), filename, IContentDescription.ALL).getContentType();
assertTrue("content type identifier for " + filename + " does not have HTML type ", identifier != null);
}
use of org.eclipse.core.runtime.content.IContentTypeManager in project webtools.sourceediting by eclipse.
the class FileUtil method isXSLFile.
/**
* Determines if a file is a XSLT File.
* @param file The input IFile to check.
* @return True if it is a XSLT file, false otherwise.
*/
public static boolean isXSLFile(IFile file) {
IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
IContentType[] types = contentTypeManager.findContentTypesFor(file.getName());
for (IContentType contentType : types) {
if (contentType.equals(contentTypeManager.getContentType(XSLCore.XSL_CONTENT_TYPE))) {
return true;
}
}
return false;
}
Aggregations