eclipse 一些知識彙總

2021-08-31 20:31:44 字數 1645 閱讀 9907

得到某plugin的路徑:  

platform.getbundle("mypluginid").getlocation().

eclipse採用osgi後好像還可以:

activator.getdefault().getbundle().getlocation().(前提是這個外掛程式有activator這個類.這個類繼承了eclipse的plugin類)

eclipse採用osgi前好像好像是:

myplugin.getdefault().getbundle().getlocation().(前提是這個外掛程式有myplugin這個類.這個類繼承了eclipse的plugin類)   

2. 得到工作區路徑: platform.getlocation();或

resourcesplugin.getworkspace();好像

platform.getinstancelocation()也可行

3. 得到eclipse安裝路徑

platform.getinstalllocation();

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

aaaaplugin.getdefault().getstatelocation().makeabsolute().tofile().getabsolutepath()

通過檔案得到project:

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

通過檔案得到全路徑:

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

得到整個workspace的根:

iworkspaceroot root = resourcesplugin.getworkspace().getroot();

從根來查詢資源:

iresource resource = root.findmember(new path(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)

獲取外掛程式的絕對路徑:

filelocator.resolve(builduiplugin.getdefault().getbundle().getentry("/")).getfile();  

一些知識點彙總

二 異常 區別 層次不同,http屬於應用層,tcp屬於傳輸層 3.http和tcp的聯絡 1 http是基於tcp,就相當於生活中的吃飯時候你都會用到碗,這個碗就是tcp,吃飯這件事情就相當於http,因為我們http傳送資料之前,會先進行tcp三次握手,記住這時候只是傳送一些狀態碼的確認等,並沒...

eclipse的一些奇葩事

1場景 newuserinfo userinfoservice.login userinfo newuserinfo 的值是null if stringutil.isempty newuserinfo else在執行stringutil.isempty newuserinfo 後,立馬跳到else中...

DataGridView 一些用法彙總

待續.1,獲取 datagridview選中的行數和列數 獲取總行數 datagridview1.rows.count if dgvresult.rows.count 0 return int i dgvresult.currentrow.index 獲取當前選中行索引 int j dgvresul...