本文整理了Java中org.eclipse.ui.ide.IDE.getContentType()
方法的一些代码示例,展示了IDE.getContentType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IDE.getContentType()
方法的具体详情如下:
包路径:org.eclipse.ui.ide.IDE
类名称:IDE
方法名:getContentType
[英]Return the content type for the given file.
[中]返回给定文件的内容类型。
代码示例来源:origin: ajermakovics/eclipse-instasearch
/**
* @param file
* @return
* @throws CoreException
*/
private boolean isTextFile(IFile file) throws CoreException {
if( !file.isSynchronized(IResource.DEPTH_ZERO) )
return false;
IContentType contentType = IDE.getContentType(file);
if( contentType == null ) contentType = IDE.guessContentType(file);
if( contentType == null ) return false;
if( TEXT_CONTENT_TYPE != null && contentType.isKindOf(TEXT_CONTENT_TYPE) )
return true;
return false;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
@Override
public ImageDescriptor getImageDescriptor() {
IContentType contentType = IDE.getContentType(file);
return PlatformUI.getWorkbench().getEditorRegistry()
.getImageDescriptor(file.getName(), contentType);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui
/**
* Returns if the given extension is a known extension to Ant i.e. a supported content type extension.
*
* @param resource
* @return true if the file extension is supported false otherwise
*
* @since 3.6
*/
public static boolean isKnownAntFile(IResource resource) {
if (resource != null) {
// workspace file
IFile file = null;
if (resource.getType() == IResource.FILE) {
file = (IFile) resource;
} else {
file = resource.getAdapter(IFile.class);
}
if (file != null) {
IContentType fileType = IDE.getContentType(file);
if (fileType == null) {
return false;
}
IContentType antType = Platform.getContentTypeManager().getContentType(AntCorePlugin.ANT_BUILDFILE_CONTENT_TYPE);
if (antType != null) {
return fileType.isKindOf(antType);
}
}
}
return false;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
IContentType contentType= IDE.getContentType(file);
FileEditorInput editorInput= new FileEditorInput(file);
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui
IFile file = WorkbenchResourceHelper.getFile((EObject)obj);
if(file != null) {
IContentType contentType = IDE.getContentType(file);
currentDescriptor = registry.getDefaultEditor(file.getName(), contentType);
} else {
IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
IFile file = WorkbenchResourceHelper.getFile((Resource)obj);
IContentType contentType = IDE.getContentType(file);
currentDescriptor = registry.getDefaultEditor(file.getName(), contentType);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
contentType = getContentType(file);
内容来源于网络,如有侵权,请联系作者删除!