2009-09-22 61 views

回答

2

This answer顯示如何獲取特定類型的類型層次結構。您可以使用類似的處理來獲取接口的TypeHierarchy,然後用結果類型填充列表。

IProject project; //currently selected project 

//get the java project and locate the interface type 
JavaProject javaProject = JavaCore.create(project); 
IType myInterface = 
    javaProject.findType("MyInterface","name.seller.rich"); 

//get the sub types from the interface's type hierarchy 
ITypeHierarchy hierarchy = 
    myInterface .newTypeHierarchy(new NullProgressMonitor()); 

IType[] subTypes = hierarchy.getAllSubtypes(myInterface); 

//do something with the sub types 
... 
相關問題