当前位置: 代码迷 >> Java相关 >> Eclipse插件开发 - 项目属性页properties中的location属性如何获得
  详细解决方案

Eclipse插件开发 - 项目属性页properties中的location属性如何获得

热度:81   发布时间:2016-04-22 20:55:07.0
Eclipse插件开发 - 项目属性页properties中的location属性怎么获得?

------解决思路----------------------
如果你就是想拿到这个值的话,去研究一下IResource, Property  dialog的 eclipse 源代码。
  
    URL url = YourPlugin.getDefault().getBundle().getResource(pathName);
    try
    {
      url = FileLocator.toFileURL(url);
    }
    catch (IOException e)
    {
      return null;
    }
    return url != null ? url.getPath() : null;
当然通过这种方式得到插件中某一资源的绝对路径 会有一个小问题 : /D:/myproject/...  而不是 D:/myproject
不过你通过inputstream 读取文件是木有问题的
希望能帮到你! good luck

------解决思路----------------------
就是资源在插件中的相对位置, 你上传图上的 /123
  相关解决方案