我能够在eclipse中获得对项目的引用。喜欢这个
public void selectionChanged(IAction action,ISelection selection){
IStructuredSelection ss = (IStructuredSelection) selection;
IResource resource = (IResource) ss.getFirstElement();
project= resource.getProject();
}
但是我需要获得该项目中引用库的列表。谷歌没有帮助。请帮助。
感谢。
答案 0 :(得分:1)
I found the solution:
IStructuredSelection ss = (IStructuredSelection) selection;
IResource resource = (IResource) ss.getFirstElement();
project= resource.getProject();
IJavaProject javaProject= JavaCore.create(project);
classpath= javaProject.getRawClasspath();
for (IClasspathEntry entry : classpath) {
if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
libs [i] = entry.getPath();
}