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

The following examples show how to use org.openide.nodes.Node#EMPTY . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: netbeans   File: InstanceTargetXNode.java    License: Apache License 2.0 6 votes vote down vote up
public void updateNodes(final InstanceTargetXNode parent) {
    if (original == Node.EMPTY) {
        changeOriginal(createWaitNode());
        UI_REFRESH_PROCESSOR.post(new Runnable() {
            public void run() {
                Node newOriginal = null;
                if (parent != null) {
                    newOriginal = parent.getDelegateTargetNode();
                    lastDelegateTargetNode = newOriginal;
                }
                if (newOriginal != null) {
                    changeOriginal(newOriginal);
                } else {
                    changeOriginal(Node.EMPTY);
                }
            }
        });
    }
}
 
Example 2
Source Project: netbeans   File: CreateFolderAction.java    License: Apache License 2.0 6 votes vote down vote up
@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 3
Source Project: netbeans   File: ElementSelectorPanel.java    License: Apache License 2.0 5 votes vote down vote up
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 4
Source Project: netbeans   File: TemplateWizardPanel1.java    License: Apache License 2.0 5 votes vote down vote up
/** 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
Source Project: netbeans   File: ClusterizeInfo.java    License: Apache License 2.0 5 votes vote down vote up
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 6
Source Project: netbeans   File: LibrariesNode.java    License: Apache License 2.0 5 votes vote down vote up
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 7
Source Project: netbeans   File: InstanceTargetXNode.java    License: Apache License 2.0 5 votes vote down vote up
public Node getDelegateTargetNode() {
    Node xnode = getXNode();
    if (xnode != null && xnode != Node.EMPTY)
        return xnode;
    ServerTarget st = getServerTarget();
    if (st == null)
        return xnode;
    Node tn = instance.getServer().getNodeProvider().createTargetNode(st);
    if (tn != null)
        xnode = tn;
    return xnode;
}
 
Example 8
Source Project: NBANDROID-V2   File: GoalsPanel.java    License: Apache License 2.0 5 votes vote down vote up
protected @Override
Node createNodeForKey(Object mdl) {
    if (mdl instanceof TaskInfo) {
        return new MojoNode((TaskInfo) mdl, gradleProject);
    } else if (mdl instanceof GradleCommandTemplate) {
        return new UserTaskNode((GradleCommandTemplate) mdl, gradleProject);
    } else {
        return Node.EMPTY;
    }
}
 
Example 9
Source Project: netbeans   File: InstanceTargetXNode.java    License: Apache License 2.0 4 votes vote down vote up
public InstanceTargetXNode(Node instanceNode, ServerInstance instance) {
    this(instanceNode, Node.EMPTY, new InstanceTargetChildren(Node.EMPTY));
    this.instance = instance;
    instance.addStateListener(this);
}
 
Example 10
Source Project: netbeans   File: ProjectsRootNode.java    License: Apache License 2.0 4 votes vote down vote up
@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;
}
 
Example 11
public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) {
    return new Node[]{Node.EMPTY};
}