开发者

Find child plug-ins of features in eclipse workspace

开发者 https://www.devze.com 2023-02-15 09:55 出处:网络
I want to find all the child plug-ins of a 开发者_运维知识库feature ? I know the name of the feature, but IWorkspaceRoot.getProject(String) does not really help me. I get an IProject that I don\'t kno

I want to find all the child plug-ins of a 开发者_运维知识库feature ? I know the name of the feature, but IWorkspaceRoot.getProject(String) does not really help me. I get an IProject that I don't know how to convert to a feature object (IFeature ?). Maybe I am on the wrong track and there is a better / easier way to do this. Any ideas ?


You could check that a selected IProject is a feature project by checking for the nature called org.eclipse.pde.FeatureNature.

Then you could try to use IProject.getAdapter(IFeature.class) call, the cast the result to IFeature. I did not try this with feature projects, but works well with Java projects.

The correct answer is the use of PDECore static class. This class provides a FeatureModelManager, that would provide the corresponding information:

FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager();

How to obtain this information? I looked with the plug-in spy to find which project defines the 'Deployable Features' export wizard (use Alt+Shift+F3 when the wizard is selected), and then looked at the implementation of the wizard class, where the addPages() method contains the previously described code block.

0

精彩评论

暂无评论...
验证码 换一张
取 消