根据给定的IEditPar或IEditorInput获取IFile实例。
2012-09-03 14:53
281 查看
根据IEditorInput获取IFile实例
public static IFile getFile(IEditorInput editorInput) {
if (editorInput == null) {
return null;
}
Object o = editorInput.getAdapter(IFile.class);
if (o instanceof IFile) {
return (IFile) o;
}
return null;
}
根据IEditorPart获取IFile实例
The code below will demonstrate how to do this.
public static IFile getFile(IEditorInput editorInput) {
if (editorInput == null) {
return null;
}
Object o = editorInput.getAdapter(IFile.class);
if (o instanceof IFile) {
return (IFile) o;
}
return null;
}
根据IEditorPart获取IFile实例
The code below will demonstrate how to do this.
IFile file = (IFile) editorPart.getEditorInput().getAdapter(IFile.class); if (file != null) { // do stuff }
相关文章推荐
- jQuery 根据ID,获取input/checkbox/radio/select
- 根据ip获取当地天气预告的实现asp.net实例
- Ajax-ajax实例2-根据邮政编码获取地区信息
- 根据不同的实例自动获取类名和属性(通用显示工具)
- 正则根据name获取input的value值
- 根据ID获取CEdit的句柄实例
- 根据流程实例ID获取当前任务
- php 根据给定的一个查询关键字,获取百度的相关关键字,多个页面获取,非单页的相关搜索
- 使用反射创建Bean、Spring中是如何根据类名配置创建Bean实例、Java提供了Class类获取类别的字段和方法,包括构造方法
- Appium根据xpath获取控件实例随笔
- C# Type.GetConstructor() 根据构造函数参数获取实例对象(一)
- jquery根据name属性获取input的值
- 根据各视频网站网址获取SWF链接的PHP实例仅供参考
- 使用反射创建Bean、Spring中是如何根据类名配置创建Bean实例、Java提供了Class类获取类别的字段和方法,包括构造方法
- Java反射,根据类名创建带参数的实例(获取参数类型,参数等)
- GoogleMapAPI实例 根据地名定位获取经纬度
- 【转】Appium根据xpath获取控件实例随笔
- vue里input根据value改变背景色的实例
- 微信小程序input表单页面实例,redio和下拉列表获取数据
- python3.5爬虫实例:根据城市名称来获取该城市最近七天的天气预报