当前位置: 首页>>代码示例>>Java>>正文


Java Children类代码示例

本文整理汇总了Java中org.openide.nodes.Children的典型用法代码示例。如果您正苦于以下问题:Java Children类的具体用法?Java Children怎么用?Java Children使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Children类属于org.openide.nodes包,在下文中一共展示了Children类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renameNode

import org.openide.nodes.Children; //导入依赖的package包/类
private void renameNode (RepositoryPathNode node, String newParentsName, int level) {
    node.entry = new RepositoryPathEntry(
                    node.entry.getRepositoryFile().replaceLastSegment(newParentsName, level),
                    node.entry.getSvnNodeKind(),
                    node.entry.getLastChangedRevision(),
                    node.entry.getLastChangedDate(),
                    node.entry.getLastChangedAuthor()
                );
    Children childern = node.getChildren();
    Node[] childernNodes = childern.getNodes();
    level++;
    for (Node childernNode : childernNodes) {
        if (childernNode instanceof RepositoryPathNode) {
            renameNode((RepositoryPathNode) childernNode, newParentsName, level);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:RepositoryPathNode.java

示例2: expandOnlyChilds

import org.openide.nodes.Children; //导入依赖的package包/类
private void expandOnlyChilds(Node parent) {
    setExpansionListenerEnabled(false);
    try {
        Node node = parent;
        while (node != null) {
            Children children = node.getChildren();
            if (children.getNodesCount(true) == 1) {
                node = children.getNodeAt(0);
                outlineView.expandNode(node);
            } else {
                node = null;
            }
        }
    } finally {
        setExpansionListenerEnabled(true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ResultsOutlineSupport.java

示例3: setUp

import org.openide.nodes.Children; //导入依赖的package包/类
protected @Override void setUp() throws Exception {
    n1 = new AbstractNode(Children.LEAF);
    n1.setName("n1");
    n2 = new AbstractNode(Children.LEAF);
    n2.setName("n2");
    n3 = new AbstractNode(Children.LEAF);
    n3.setName("n3");
    final Index.ArrayChildren c = new Index.ArrayChildren() {
        {
            add(new Node[] {n1, n2, n3});
        }
        public @Override void reorder() {
            reorder(new int[] {1, 2, 0});
        }
    };
    n = new AbstractNode(c) {
        {
            getCookieSet().add(c);
        }
    };
    n.setName("n");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:MoveUpActionTest.java

示例4: testClipboardCopy

import org.openide.nodes.Children; //导入依赖的package包/类
public void testClipboardCopy() throws IOException, ClassNotFoundException, UnsupportedFlavorException {
    DataFlavor uriListFlavor = new DataFlavor("text/uri-list;class=java.lang.String");

    FileObject fo = FileUtil.createData( testFileSystem.getRoot(), "dndtest.txt" );
    File tmpFile = FileUtil.toFile( fo );

    DataObject dob = DataObject.find( fo );
    DataNode node = new DataNode( dob, Children.LEAF );

    Transferable t = node.clipboardCopy();
    assertTrue( t.isDataFlavorSupported( DataFlavor.javaFileListFlavor ) );
    List fileList = (List) t.getTransferData( DataFlavor.javaFileListFlavor );
    assertNotNull( fileList );
    assertEquals( 1, fileList.size() );
    assertTrue( fileList.contains( tmpFile ) );

    assertTrue( t.isDataFlavorSupported( uriListFlavor ) );
    String uriList = (String) t.getTransferData( uriListFlavor );
    assertEquals( Utilities.toURI(tmpFile)+"\r\n", uriList );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:DragAndDropDataNodeTest.java

示例5: M2RepositoryBrowser

import org.openide.nodes.Children; //导入依赖的package包/类
private M2RepositoryBrowser() {
    super(Children.create(new RootNodes(), true));
    setName(NAME);
    setDisplayName(CTL_M2RepositoryBrowserTopComponent2(RepositoryPreferences.isIndexRepositories() ? "" : CTL_M2RepositoriesDisabled()));
    setShortDescription(HINT_M2RepositoryBrowserTopComponent());
    setIconBaseWithExtension(ICON_PATH);
    NbPreferences.root().node("org/netbeans/modules/maven/nexus/indexing").addPreferenceChangeListener(new PreferenceChangeListener() {

        @Override
        public void preferenceChange(PreferenceChangeEvent evt) {
            if (RepositoryPreferences.PROP_INDEX.equals(evt.getKey())) {
                setDisplayName(CTL_M2RepositoryBrowserTopComponent2(RepositoryPreferences.isIndexRepositories() ? "" : CTL_M2RepositoriesDisabled()));
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:M2RepositoryBrowser.java

示例6: expandAllNodes

import org.openide.nodes.Children; //导入依赖的package包/类
private static void expandAllNodes (BeanTreeView btv, Node node, ExplorerManager mgr, JavaPlatform platform) {
    btv.expandNode (node);
    Children ch = node.getChildren();
    if ( ch == Children.LEAF ) {
        if (platform != null && platform.equals(node.getLookup().lookup(JavaPlatform.class))) {
            try {
                mgr.setSelectedNodes (new Node[] {node});
            } catch (PropertyVetoException e) {
                //Ignore it
            }
        }
        return;
    }
    Node nodes[] = ch.getNodes( true );
    for ( int i = 0; i < nodes.length; i++ ) {
        expandAllNodes( btv, nodes[i], mgr, platform);
    }

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PlatformsCustomizer.java

示例7: FilterNode

import org.openide.nodes.Children; //导入依赖的package包/类
private FilterNode(Filter filter, InstanceContent content) {
    super(Children.LEAF, new AbstractLookup(content));
    content.add(filter);

    content.add(filter.getEditor());
    this.filter = filter;
    filter.getChangedEvent().addListener(new ChangedListener<Filter>() {

        @Override
        public void changed(Filter source) {
            update();
        }
    });

    update();

    Lookup.Template<FilterChain> tpl = new Lookup.Template<>(FilterChain.class);
    result = Utilities.actionsGlobalContext().lookup(tpl);
    result.addLookupListener(this);

    FilterTopComponent.findInstance().getFilterSettingsChangedEvent().addListener(this);
    resultChanged(null);
    
    setShortDescription("Double-click to open filter");
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:26,代码来源:FilterNode.java

示例8: addExtCluster

import org.openide.nodes.Children; //导入依赖的package包/类
private void addExtCluster(ClusterInfo ci) {
    Set<String> disabledModuleCNB = new HashSet<String>(Arrays.asList(getProperties().getDisabledModules()));
    Children.SortedArray moduleCh = new Children.SortedArray();
    try {
        ModuleList ml = ModuleList.scanCluster(ci.getClusterDir(), null, false, ci);
        moduleCh.setComparator(MODULES_COMPARATOR);
        for (ModuleEntry entry : ml.getAllEntries()) {
            moduleCh.add(new Node[] { new BinaryModuleNode(entry, 
                    ! disabledModuleCNB.contains(entry.getCodeNameBase()) && ci.isEnabled()) });
            extraBinaryModules.add(entry);
        }
    } catch (IOException e) {
        ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
    }
    initNodes();
    synchronized (libChildren.extraNodes) {
        libChildren.extraNodes.add(new ClusterNode(ci, moduleCh));
    }
    libChildren.setMergedKeys();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:SuiteCustomizerLibraries.java

示例9: GraphNode

import org.openide.nodes.Children; //导入依赖的package包/类
private GraphNode(InputGraph graph, InstanceContent content) {
    super(Children.LEAF, new AbstractLookup(content));
    this.graph = graph;
    this.setDisplayName(graph.getName());
    content.add(graph);

    final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class);

    if (viewer != null) {
        // Action for opening the graph
        content.add(new GraphOpenCookie(viewer, graph));
    }

    // Action for removing a graph
    content.add(new GraphRemoveCookie(graph));

    // Action for diffing to the current graph
    content.add(new DiffGraphCookie(graph));

    // Action for cloning to the current graph
    content.add(new GraphCloneCookie(viewer, graph));
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:23,代码来源:GraphNode.java

示例10: openHistory

import org.openide.nodes.Children; //导入依赖的package包/类
private void openHistory(File[] files) {
    if(files == null || files.length == 0) {
        return;
    }
    Set<File> repositories = getRepositoryRoots(files);
    if(repositories == null || repositories.isEmpty()) {
        return;
    }
    List<Node> nodes = new ArrayList<Node>(files.length);
    for (File f : files) {
        nodes.add(new AbstractNode(Children.LEAF, Lookups.fixed(f)) {
            @Override
            public String getDisplayName() {
                return getLookup().lookup(File.class).getName();
            }
        });
    }
    SearchHistoryAction.openSearch(repositories.iterator().next(), files, Utils.getContextDisplayName(VCSContext.forNodes(nodes.toArray(new Node[nodes.size()]))));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:HistoryProvider.java

示例11: VersionNode

import org.openide.nodes.Children; //导入依赖的package包/类
/** Creates a new instance of VersionNode */
public VersionNode(NBVersionInfo versionInfo, boolean javadoc, boolean source) {
    super(Children.LEAF);
 
    hasJavadoc = javadoc;
    hasSources = source;
    this.nbvi = versionInfo;
    
        setName(versionInfo.getVersion());
        setDisplayName(versionInfo.getVersion() + " [ " + versionInfo.getType() 
                + (versionInfo.getClassifier() != null ? ("," + versionInfo.getClassifier()) : "") + " ] "
                + " - "+versionInfo.getRepoId()
                
                );
    
    setIconBaseWithExtension(IconResources.ICON_DEPENDENCY_JAR);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:VersionNode.java

示例12: testChildrenCanGC

import org.openide.nodes.Children; //导入依赖的package包/类
public void testChildrenCanGC () throws Exception {
    Filter filter = new Filter();
    holder = filter;

    String pref = getName() + '/';
    FileObject bb = FileUtil.createFolder(FileUtil.getConfigRoot(), pref + "/BB");
    bb.createData("Ahoj.txt");
    bb.createData("Hi.txt");
    DataFolder folder = DataFolder.findFolder(bb);

    Children ch = folder.createNodeChildren(filter);
    LOG.info("children created: " + ch);
    Node[] arr = ch.getNodes(true);
    LOG.info("nodes obtained" + arr);
    assertEquals("Accepts only Ahoj", 1, arr.length);
    LOG.info("The one node" + arr[0]);

    WeakReference<Children> ref = new WeakReference<Children>(ch);
    ch = null;
    arr = null;

    assertGC("Children can disappear even we hold the filter", ref);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:FolderChildrenTest.java

示例13: run

import org.openide.nodes.Children; //导入依赖的package包/类
@Override
public void run() {
            NbMavenProject nbprj = currentProject.getLookup().lookup(NbMavenProject.class);
    List<MavenEmbedder.ModelDescription> lin = null;
    if (nbprj != null) {
        lin = MavenEmbedder.getModelDescriptors(nbprj.getMavenProject());
    }
    if (lin != null) {
                final Children ch = new PomChildren(lin);
                SwingUtilities.invokeLater(new Runnable() {
            @Override
                    public void run() {
                       treeView.setRootVisible(false);
                       explorerManager.setRootContext(new AbstractNode(ch));
                        try {
                            explorerManager.setSelectedNodes(new Node[]{
                                explorerManager.getRootContext().getChildren().getNodes()[0]
                            });
                        } catch (PropertyVetoException ex) {
                            Exceptions.printStackTrace(ex);
                        }
                    }
                });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:MoveToDependencyManagementPanel.java

示例14: getActions

import org.openide.nodes.Children; //导入依赖的package包/类
/** Getter for set of actions that should be present in the
* popup menu of this node. This set is used in construction of
* menu returned from getContextMenu and specially when a menu for
* more nodes is constructed.
*
* @return array of system actions that should be in popup menu
*/
@Override
public Action[] getActions ( boolean context ) {
    if ( context ) {
        return super.getActions( true );
    }
    else {
        Children ch = getChildren();
        Node[] nodes = ch.getNodes();
        if ( nodes == null )
            return new SystemAction[0];

        if( nodes.length == 0 || ( nodes[0] != null && ((BiFeatureNode)nodes[0]).getBiFeature() instanceof BiFeature.Descriptor) )
            return new SystemAction[0];

        return new SystemAction[] {
                                SystemAction.get (BiIncludeAllAction.class),
                                SystemAction.get (BiExcludeAllAction.class),
                                null
                            };
    }                          
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:BiNode.java

示例15: BytecodeNode

import org.openide.nodes.Children; //导入依赖的package包/类
public BytecodeNode(InputBytecode bytecode, InputGraph graph, String bciValue) {

        super(Children.LEAF);
        String displayName = bytecode.getBci() + " " + bytecode.getName() + " " + bytecode.getOperands();

        bciValue = bytecode.getBci() + " " + bciValue;
        bciValue = bciValue.trim();

        Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<>(graph.getNodes());
        StringPropertyMatcher matcher = new StringPropertyMatcher("bci", bciValue);
        List<InputNode> nodeList = selector.selectMultiple(matcher);
        if (nodeList.size() > 0) {
            nodes = new LinkedHashSet<>();
            for (InputNode n : nodeList) {
                nodes.add(n);
            }
            displayName += " (" + nodes.size() + " nodes)";
        }
        
        if (bytecode.getComment() != null) {
            displayName += " // " + bytecode.getComment();
        }
        
        this.setDisplayName(displayName);
    }
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:26,代码来源:BytecodeNode.java


注:本文中的org.openide.nodes.Children类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。