eclipse外掛程式中取得路徑的方法

2021-08-29 22:26:40 字數 1041 閱讀 3753

從外掛程式中獲得絕對路徑:

plugin.getdefault().getstatelocation().makeabsolute().tofile().getabsolutepath());

通過檔案得到project:

=((ifile)o).getproject();

通過檔案得到全路徑:

=((ifile)o).getlocation().makeabsolute().tofile().getabsolutepath();

得到整個workspace的根:

iworkspaceroot root

=resourcesplugin.getworkspace().getroot();

從根來查詢資源:

iresource resource

=root.findmember(

newpath(containername));

從bundle來查詢資源:

bundle bundle

=platform.getbundle(pluginid);

url fullpathstring

=bundleutility.find(bundle, filepath);

platform.aslocalurl(product_bundle.getentry(

"")).getpath()).getabsolutepath();

得到runtimeworkspace:

platform.getinstancelocation().geturl().getpath();

從編輯器來獲得編輯檔案

ieditorpart editor

=((defaulteditdomain)(parent.getviewer().geteditdomain())).geteditorpart();

ieditorinput input

=editor.geteditorinput();

if(input

instanceof

ifileeditorinput)

獲取Eclipse及外掛程式路徑彙總

1.得到某plugin的路徑 platform.getbundle mypluginid getlocation eclipse採用osgi後好像還可以 activator.getdefault getbundle getlocation 前提是這個外掛程式有activator這個類.這個類繼承了e...

刪除eclipse中的外掛程式

1.到eclipse安裝目錄下的 plugins資料夾中找到需要刪除的外掛程式名稱,一般檔名中都會包含有外掛程式名,找出來刪除相關的檔案和資料夾。2.到eclipse安裝目錄下的 configuration資料夾下找到對應的檔案刪除 3.到eclipse安裝目錄下的 configuration or...

eclipse中Nodeclipse 外掛程式安裝使用

nodeclipse外掛程式安裝 建議使用eclipse4.0版本以上 install new software 填寫位址 直至finsh 安裝完之後 配置nodejs 環境 在eclipse 首選項上 修改nodejs安裝路徑 express 路徑可以不選 工程下 新建node hello.js ...