我明白了:
Java Model Exception: Java Model Status [SomeProjectMadeByMe does not exist]
at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:544)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:247)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:557)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:294)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:280)
at org.eclipse.jdt.internal.core.JavaElement.getChildren(JavaElement.java:235)
at org.eclipse.jdt.internal.core.JavaProject.getPackageFragmentRoots(JavaProject.java:1850)
at org.eclipse.jdt.internal.core.JavaProject.getPackageFragments(JavaProject.java:1872)
当尝试在IJavaProject中获取所有包片段时,此项目在工作空间中引用另一个项目并且后者关闭(因此无法打开)。
如何跳过已关闭项目中的片段而不是让方法抛出异常?我是否必须编写自己的方法?