Java Code Examples for org.openide.nodes.Node.EMPTY

The following are Jave code examples for showing how to use EMPTY of the org.openide.nodes.Node class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-netbeans   File: CreateFolderAction.java   Source Code and License Vote up 6 votes
@Override
public boolean isEnabled() {
    Browser browser = getBrowser();
    if(browser == null) {
        return false;
    }        
    if(browser.getExplorerManager().getRootContext() == Node.EMPTY) {
        return false;
    }
    Node[] nodes = getBrowser().getSelectedNodes();
    if(nodes.length != 1) {
        return false;
    }
    return nodes[0] instanceof RepositoryPathNode && 
           ((RepositoryPathNode) nodes[0]).getEntry().getSvnNodeKind() == SVNNodeKind.DIR;
}
 
Example 2
Project: incubator-netbeans   File: ClusterizeInfo.java   Source Code and License Vote up 5 votes
private static Node findNode(File f) {
    try {
        if (f != null) {
            final FileObject fo = FileUtil.toFileObject(f);
            if (fo != null) {
                return DataObject.find(fo).getNodeDelegate();
            }
        }
    } catch (DataObjectNotFoundException ex) {
        Exceptions.printStackTrace(ex);
    }
    return Node.EMPTY;
}
 
Example 3
Project: incubator-netbeans   File: LibrariesNode.java   Source Code and License Vote up 5 votes
private Node createLibraryPackageViewNode(FileObject jfo) {
    Icon icon = getLibrariesIcon();
    FileObject root = FileUtil.getArchiveRoot(jfo);
    if (root == null) {
        return Node.EMPTY;
    }
    String name = String.format(getMessage("LBL_WrappedLibraryFmt"), FileUtil.toFile(jfo).getName());
    return ActionFilterNode.create(PackageView.createPackageView(new LibrariesSourceGroup(root, name, icon, icon)));
}
 
Example 4
Project: incubator-netbeans   File: TemplateWizardPanel1.java   Source Code and License Vote up 5 votes
/** Help for this panel.
* @return the help or <code>null</code> if no help is supplied
*/
public HelpCtx getHelp () {
    if (templateWizard1UI != null) {
        if (templateWizard1UI.getExplorerManager().getRootContext() != Node.EMPTY) {
            return new HelpCtx(TemplateWizard1.class.getName()+"."+ // NOI18N
                templateWizard1UI.getExplorerManager().getRootContext().getName());
        }
    }
    return new HelpCtx (TemplateWizard1.class);
}
 
Example 5
Project: incubator-netbeans   File: ElementSelectorPanel.java   Source Code and License Vote up 5 votes
public void setRootElement(ElementNode.Description elementDescription, boolean singleSelection) {  
    
    Node n;
    if ( elementDescription != null ) {
        ElementNode en = new ElementNode(elementDescription);
        en.setSingleSelection(singleSelection);
        n = en;        
    }
    else {
        n = Node.EMPTY;
    }
    manager.setRootContext(n);
    
}
 
Example 6
Project: incubator-netbeans   File: ProjectsRootNode.java   Source Code and License Vote up 4 votes
@NonNull
final Node logicalViewForProject(
        @NonNull final Project project,
        final Union2<LogicalViewProvider,org.openide.util.Pair<Sources,SourceGroup[]>> data,
        final boolean[] projectInLookup) {
    Node node;            
    if (!data.hasFirst()) {
        LOG.log(
                Level.WARNING,
                "Warning - project of {0} in {1} failed to supply a LogicalViewProvider in its lookup",  // NOI18N
                new Object[]{
                    project.getClass(),
                    FileUtil.getFileDisplayName(project.getProjectDirectory())
                });
        final Sources sources = data.second().first();
        final SourceGroup[] groups = data.second().second();
        sources.removeChangeListener(this);
        sources.addChangeListener(this);
        if (groups.length > 0) {
            node = PhysicalView.createNodeForSourceGroup(groups[0], project);
        } else {
            node = Node.EMPTY;
        }
    } else {
        final LogicalViewProvider lvp = data.first();
        node = lvp.createLogicalView();
        if (!project.equals(node.getLookup().lookup(Project.class))) {
            // Various actions, badging, etc. are not going to work.
            LOG.log(
                    Level.WARNING,
                    "Warning - project {0} failed to supply itself in the lookup of the root node of its own logical view",  // NOI18N
                    ProjectUtils.getInformation(project).getName());
            //#114664
            if (projectInLookup != null) {
                projectInLookup[0] = false;
            }
        }
    }                        
    node.addNodeListener(WeakListeners.create(NodeListener.class, this, node));
    return node;
}