繁体   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