簡體   English   中英

在PropertyPage中獲取IProject

[英]Get IProject in PropertyPage

我正在創建一個Eclipse PropertyPage。 在屬性中,我想獲取用戶項目。 為了使用戶能夠使用該屬性,他必須右鍵單擊該項目,然后單擊屬性。 因此,我假設有可能獲得用戶項目。 您可以在PropertyPage中獲取用戶項目嗎?

PropertyPagegetElement()方法返回屬性頁的選定對象。 因此,使用類似:

IAdaptable adaptable = getElement();

IProject project = (IProject)adaptable.getAdapter(IProject.class);

這是createContents方法,該元素在構造函數中尚不可用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM