/**
* 得到当前编辑器所属工程的绝对路径
*/
public static String getCurrentProjectFileAbsolutePath(){
String fullPath = "";
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
if (getActiveEditorInput() instanceof WorkflowEditorInput) {
IPath location = Path.fromOSString(((WorkflowEditorInput)getActiveEditorInput()).getRelateFilename());
IFile file = workspaceRoot.getFileForLocation(location);
fullPath = file.getProject().getLocation().toOSString();
}
return fullPath;
}
通过系统文件路径取得插件工程路径的方法
最新推荐文章于 2020-02-19 21:49:34 发布
本文介绍了一种方法,用于在特定编辑环境中获取当前编辑器所对应项目的绝对路径。此方法通过检查活动编辑器输入来确定文件位置,并从工作区根目录中获取项目的完整路径。
5231

被折叠的 条评论
为什么被折叠?



