Documents in default packages cannot be opened
When a document is located in a default package (e.g. directly under src), the editor crashes. This is because JavaModelUtils.getPackageContainingFile
and its caller always expects some nested package. The method uses JavaCore.create(IFolder)
, which normally returns an IPackageFragment
. When the folder corresponds to a default package, however, an IPackageFragmentRoot
is returned, instead, and this causes the attempted cast to fail.
Relevant portion of the stack trace:
Caused by: java.lang.NullPointerException at no.tobask.sb4e.JavaProjectGlossary.queryControllerClasses(JavaProjectGlossary.java:58) at com.oracle.javafx.scenebuilder.app.info.InfoPanelController.getSuggestedControllerClasses(InfoPanelController.java:421) at com.oracle.javafx.scenebuilder.app.info.InfoPanelController.performInitialization(InfoPanelController.java:187) at com.oracle.javafx.scenebuilder.app.info.InfoPanelController.controllerDidLoadFxml(InfoPanelController.java:174) at com.oracle.javafx.scenebuilder.kit.editor.panel.util.AbstractFxmlPanelController.makePanel(AbstractFxmlPanelController.java:89) ... 89 more