I want to create a new node from BeanTreeView, and when I add the node constructor to the constructor, run the application, and then I try to view the window with the tree, it gives this error
java.lang.AssertionError: Component cannot be created for {component = null, displayName = Exploirer, instanceCreate = AlwaysEnabledAction [Exploirer]}
at org.openide.windows.OpenComponentAction.getTopComponent (OpenComponentAction.java:71)
Why? And how to add node there? See Code.
private ProjectsChildren projectsChildren;
private final ExplorerManager mgr = new ExplorerManager();
private ProjectNode projectNode = new ProjectNode(new MainProject("ggg"), projectsChildren);
public ExploirerTopComponent() {
initComponents();
setName(NbBundle.getMessage(ExploirerTopComponent.class, "CTL_ExploirerTopComponent"));
setToolTipText(NbBundle.getMessage(ExploirerTopComponent.class, "HINT_ExploirerTopComponent"));
associateLookup (ExplorerUtils.createLookup(mgr, getActionMap()));
mgr.setRootContext(projectNode);
ProjectNode[] pr = null;
pr[0] = projectNode;
mgr.getRootContext().getChildren().add(pr);
}
source
share