本文整理汇总了Java中org.eclipse.core.filebuffers.FileBuffers.getWorkspaceFileAtLocation方法的典型用法代码示例。如果您正苦于以下问题:Java FileBuffers.getWorkspaceFileAtLocation方法的具体用法?Java FileBuffers.getWorkspaceFileAtLocation怎么用?Java FileBuffers.getWorkspaceFileAtLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.filebuffers.FileBuffers
的用法示例。
在下文中一共展示了FileBuffers.getWorkspaceFileAtLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAnnotationModel
import org.eclipse.core.filebuffers.FileBuffers; //导入方法依赖的package包/类
@Override
public IAnnotationModel createAnnotationModel(IPath location)
{
//First see if this is a workbench file
IFile file= FileBuffers.getWorkspaceFileAtLocation(location);
if(file == null) {
try {
File f = new File(location.toOSString());
if(f.exists()) {
//This is an external file. Return a generic annotation model.
return new AnnotationModel();
}
}
catch(Exception ex) {
}
}
return super.createAnnotationModel(location);
}
示例2: createAnnotationModel
import org.eclipse.core.filebuffers.FileBuffers; //导入方法依赖的package包/类
@Override
public IAnnotationModel createAnnotationModel(IPath location)
{
String editorId = null;
try {
//First see if this is a workbench file
IFile file= FileBuffers.getWorkspaceFileAtLocation(location);
editorId = file.getPersistentProperty(IDE.EDITOR_KEY);
}
catch(Exception e) {
try {
File f = new File(location.toOSString());
if(f.exists()) {
//This is an external file. Check the default editor for it.
IEditorDescriptor descriptor= mEditorRegistry.getDefaultEditor(f.getName());
if (descriptor != null) {
editorId = descriptor.getId();
}
}
}
catch(Exception ex) {
editorId = null;
}
}
if(IInstallOptionsConstants.INSTALLOPTIONS_DESIGN_EDITOR_ID.equals(editorId) ||
IInstallOptionsConstants.INSTALLOPTIONS_SOURCE_EDITOR_ID.equals(editorId)) {
return new AnnotationModel();
}
return super.createAnnotationModel(location);
}
示例3: getProject
import org.eclipse.core.filebuffers.FileBuffers; //导入方法依赖的package包/类
public static IProject getProject(IFileBuffer fileBuffer) {
/* TODO : improve the API to get a project, or ignore project altogheter */
IFile file= FileBuffers.getWorkspaceFileAtLocation(fileBuffer.getLocation(), true);
if (file == null) {
return null;
}
return file.getProject();
}