當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。