當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractNode類代碼示例

本文整理匯總了Java中org.openide.nodes.AbstractNode的典型用法代碼示例。如果您正苦於以下問題:Java AbstractNode類的具體用法?Java AbstractNode怎麽用?Java AbstractNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AbstractNode類屬於org.openide.nodes包,在下文中一共展示了AbstractNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showFinishedInfo

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
public void showFinishedInfo() {
    final AbstractNode an = new AbstractNode(Children.LEAF);
    an.setIconBaseWithExtension(
            "org/netbeans/modules/search/res/info.png");            //NOI18N
    an.setDisplayName(NbBundle.getMessage(ResultView.class,
            "TEXT_INFO_REPLACE_FINISHED", //NOI18N
            resultModel.getSelectedMatchesCount()));
    Mutex.EVENT.writeAccess(new Runnable() {
        @Override
        public void run() {
            getOutlineView().getOutline().setRootVisible(true);
            getExplorerManager().setRootContext(an);
            getOutlineView().validate();
            getOutlineView().repaint();
            btnNext.setEnabled(false);
            btnPrev.setEnabled(false);
            btnTreeView.setEnabled(false);
            btnFlatView.setEnabled(false);
            btnExpand.setEnabled(false);
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:BasicReplaceResultsPanel.java

示例2: getDataFolderNodeDelegate

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
private Node getDataFolderNodeDelegate() {
    DataFolder df = getLookup().lookup(DataFolder.class);
    try {
        if (df.isValid()) {
            return df.getNodeDelegate();
        } 
    } catch (IllegalStateException e) {
        //The data systems API is not thread save,
        //the DataObject may become invalid after isValid call and before
        //getNodeDelegate call, we have to catch the ISE. When the DataObject
        //is valid - other cause rethrow it otherwise return leaf node.
        //todo: The DataObject.getNodedelegate should throw specialized exception type.
        if (df.isValid()) {
            throw e;
        }
    }
    return new AbstractNode(Children.LEAF);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:PackageRootNode.java

示例3: testAddNodesDoesNotRecreateAllOfThem

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
public void testAddNodesDoesNotRecreateAllOfThem() {
    Keys keys = new Keys(true);
    AbstractNode an = new AbstractNode(keys);

    NodeTreeModel model = new NodeTreeModel();
    model.setNode(an);

    assertEquals("Node set", Visualizer.findVisualizer(an), model.getRoot());
    assertEquals("No children", 0, model.getChildCount(model.getRoot()));
    keys.keys("1", "2", "3");
    assertEquals("3 children", 3, model.getChildCount(model.getRoot()));
    keys.keys("2", "1", "3");
    assertEquals("still 3 children", 3, model.getChildCount(model.getRoot()));
    keys.keys("2");
    assertEquals("1 children", 1, model.getChildCount(model.getRoot()));

    assertEquals("No nodes created yet", 0, keys.cnt);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:NodeTreeModelTest.java

示例4: testChangeOfNodeDoesNotFireChangeInActionMap

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
public void testChangeOfNodeDoesNotFireChangeInActionMap() {
    ActionMap am = (ActionMap)tc.getLookup().lookup(ActionMap.class);
    assertNotNull(am);
    
    Node m1 = new AbstractNode(Children.LEAF);
    m1.setName("old m1");
    Node m2 = new AbstractNode(Children.LEAF);
    m2.setName("new m2");
    
    tc.setActivatedNodes(new Node[] { m1 });
    assertEquals("No change in ActionMap 1", 0, cnt);
    tc.setActivatedNodes(new Node[] { m2 });
    assertEquals("No change in ActionMap 2", 0, cnt);
    tc.setActivatedNodes(new Node[0]);
    assertEquals("No change in ActionMap 3", 0, cnt);
    tc.setActivatedNodes(null);
    assertEquals("No change in ActionMap 4", 0, cnt);
    
    ActionMap am2 = (ActionMap)tc.getLookup().lookup(ActionMap.class);
    assertEquals("Still the same action map", am, am2);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:PreventNeedlessChangesOfActionMapTest.java

示例5: createNodes

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
@Override
protected Node[] createNodes(StackTraceElement key) {
    AbstractNode an = new AbstractNode(Children.LEAF);
    an.setName(key.getClassName() + "." + key.getMethodName());
    an.setDisplayName(NbBundle.getMessage(UINode.class, "MSG_StackTraceElement", 
        new Object[] { 
            key.getFileName(),
            key.getClassName(),
            key.getMethodName(),
            key.getLineNumber(),
            afterLastDot(key.getClassName()),
        }
    ));
    an.setIconBaseWithExtension("org/netbeans/modules/uihandler/stackframe.gif"); // NOI18N
    return new Node[] { an };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:UINode.java

示例6: testLazyVisDestroy

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
public void testLazyVisDestroy() throws Exception {
    LazyChildren lch = new LazyChildren();
    AbstractNode a = new AbstractNode(lch);
    List<String> arr = Collections.nCopies(100, "A");
    lch.keys(arr.toArray(new String[0]));

    TreeNode ta = Visualizer.findVisualizer(a);
    final TreeNode snd = ta.getChildAt(2);

    Reference<Node> sndNode = new WeakReference<Node>(Visualizer.findNode(snd));

    assertEquals("Child check", "A", snd.toString());
    assertEquals("Counter should be 1", 1, lch.cnt);

    a.destroy();

    assertGC("Whole subtree under a can be GCed now", sndNode);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:VisualizerNodeTest.java

示例7: testNodeHtmlDescription

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
public void testNodeHtmlDescription() {
    AbstractNode n = new AbstractNode(Children.LEAF) {

        @Override
        public Image getIcon(int type) {
            return ImageUtilities.assignToolTipToImage(super.getIcon(type), "test");
        }

        @Override
        public String getShortDescription () {
            return "<html><strong>my description</strong><br>another description</html>";
        }

    };
    VisualizerNode vn = (VisualizerNode) Visualizer.findVisualizer(n);
    assertEquals(vn.getShortDescription(), "<html><strong>my description</strong><br>another description<br>test</html>");
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:VisualizerNodeTest.java

示例8: testSetNodesSurvivesMultipleAdd_RemoveNotifyCalls

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
public void testSetNodesSurvivesMultipleAdd_RemoveNotifyCalls() throws Exception {
    final PropertySheet ps = new PropertySheet();
    Node n = new AbstractNode( Children.LEAF );
    JWindow window = new JWindow();
    ps.setNodes( new Node[] {n} );
    window.add( ps );
    window.remove( ps );
    window.add( ps );
    window.remove( ps );
    window.add( ps );
    window.remove( ps );
    window.setVisible(true);
    assertNotNull(ps.helperNodes);
    assertEquals("Helper nodes are still available even after several addNotify()/removeNotify() calls",
            ps.helperNodes[0], n);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:MorePropertySheetTest.java

示例9: setupExplorerManager

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
/** Setups an explorer manager to be ready to delete something.
 * @param em manager 
 */
private static void setupExplorerManager (ExplorerManager em) throws Exception {
    AbstractNode root = new RootNode ();
    Node[] arr = new Node[] {
        new Del ("1"), new Del ("2")
    };
    root.getChildren().add (arr);
    
    em.setRootContext(root);
    em.setSelectedNodes(root.getChildren().getNodes());
    
    assertEquals (
        "Same nodes selected", 
        Arrays.asList (arr),
        Arrays.asList (root.getChildren ().getNodes ())
    );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:ExplorerActionsTest.java

示例10: run

import org.openide.nodes.AbstractNode; //導入依賴的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

示例11: openInVersioningView

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
public static void openInVersioningView (Collection<File> files, File repository, ProgressMonitor pm) {
    List<Node> nodes = new LinkedList<Node>();
    for (File file : files) {
        Node node = new AbstractNode(Children.LEAF, Lookups.fixed(file));
        nodes.add(node);
        // this will refresh seen roots
    }
    Git.getInstance().getFileStatusCache().refreshAllRoots(Collections.<File, Collection<File>>singletonMap(repository, files), pm);
    if (!pm.isCanceled()) {
        final VCSContext context = VCSContext.forNodes(nodes.toArray(new Node[nodes.size()]));
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                SystemAction.get(StatusAction.class).performContextAction(context);
            }
        });
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:GitUtils.java

示例12: addNotify

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
@Override
protected void addNotify () {
    super.addNotify();
    if (!initialized) {
        initialized = true;
        List<AbstractNode> keys = new LinkedList<AbstractNode>();
        if (options.contains(Option.DISPLAY_BRANCHES_LOCAL) || options.contains(Option.DISPLAY_BRANCHES_REMOTE)) {
            keys.add(new BranchesTopNode(((RepositoryNode) getNode()).getRepository()));
        }
        if (options.contains(Option.DISPLAY_TAGS)) {
            keys.add(new TagsNode(((RepositoryNode) getNode()).getRepository()));
        }
        if (options.contains(Option.DISPLAY_STASH)) {
            keys.add(new StashesNode(((RepositoryNode) getNode()).getRepository()));
        }
        if (options.contains(Option.DISPLAY_REMOTES)) {
            keys.add(new RemotesNode(((RepositoryNode) getNode()).getRepository()));
        }
        setKeys(keys);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:RepositoryBrowserPanel.java

示例13: createNodes

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
@Override
protected Node[] createNodes (AbstractNode key) {
    final Node toExpand;
    if (options.contains(Option.EXPAND_BRANCHES) && key instanceof BranchesTopNode) {
        toExpand = key;
    } else if (options.contains(Option.EXPAND_TAGS) && key instanceof TagsNode) {
        toExpand = key;
    } else {
        toExpand = null;
    }
    if (toExpand != null) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run () {
                tree.expandNode(toExpand);
            }
        });
    }
    return new Node[] { key };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:RepositoryBrowserPanel.java

示例14: openHistory

import org.openide.nodes.AbstractNode; //導入依賴的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

示例15: getNodeForFoundObject

import org.openide.nodes.AbstractNode; //導入依賴的package包/類
/** Gets node for found object. Implements superclass method.
 * @return node delegate for found data object or <code>null</code>
 * if the object is not of <code>DataObjectType</code> */
public Node getNodeForFoundObject(final Object object) {
    if (!(object instanceof FileObject)) {
        return null;
    }
    try {
        return DataObject.find((FileObject) object).getNodeDelegate();
    } catch (DataObjectNotFoundException dnfe) {
        return new AbstractNode(Children.LEAF) {
            @Override
            public String getName() {
                return ((FileObject) object).getName();
            }
        };
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:FileObjectSearchGroup.java


注:本文中的org.openide.nodes.AbstractNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。