Java Code Examples for org.openide.explorer.ExplorerManager#getRootContext()

The following examples show how to use org.openide.explorer.ExplorerManager#getRootContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectServicesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public boolean openProject(URL url) {
    Project p = getProject(url);
    if (p == null) {
        return false;
    }
    OpenProjects.getDefault().open(new Project[] { p }, false);
    TopComponent projectsTC = WindowManager.getDefault().findTopComponent("projectTabLogical_tc"); // NOI18N
    projectsTC.requestActive();
    ExplorerManager em = ((ExplorerManager.Provider) projectsTC).getExplorerManager();

    Node root = em.getRootContext();
    Node projNode = null;
    for (Node n : root.getChildren().getNodes()) {
        Project prj = n.getLookup().lookup(Project.class);
        if (prj != null && prj.getProjectDirectory().equals(p.getProjectDirectory())) {
            projNode = n;
            break;
        }
    }
    if (projNode == null) { // fallback
        projNode = root.getChildren().findChild(ProjectUtils.getInformation(p).getName());
    }
    if (projNode != null) {
        try {
            em.setSelectedNodes(new Node[] { projNode });
        } catch (Exception ignore) { // may ignore it
        }
    }
    return true;
}
 
Example 2
Source File: PlatformsCustomizer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void expandPlatforms (JavaPlatform platform) {
    ExplorerManager mgr = this.getExplorerManager();
    Node node = mgr.getRootContext();
    expandAllNodes(this.platforms, node, mgr, platform);
}
 
Example 3
Source File: ServerManagerPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void expandServers(ServerInstance servInst) {
    ExplorerManager mgr = this.getExplorerManager();
    Node node = mgr.getRootContext();
    expandAllNodes(serversView, node, mgr, servInst);
}
 
Example 4
Source File: SdksCustomizer.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
private void expandPlatforms(AndroidSdk platform) {
    ExplorerManager mgr = this.getExplorerManager();
    Node node = mgr.getRootContext();
    expandAllNodes(this.platforms, node, mgr, platform);
}