通过系统文件路径取得插件工程路径的方法

/**
  * 得到当前编辑器所属工程的绝对路径
  */
 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;
 }

你可能感兴趣的:(文件)