• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NodeOp类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testReducedTreePathFinder

import org.openide.nodes.NodeOp; //导入依赖的package包/类
public void testReducedTreePathFinder() throws Exception {
    SourceGroup g = sampleGroup();
    final Node r = new TreeRootNode(g, true);
    final FileObject rootFolder = g.getRootFolder();
    final TreeRootNode.PathFinder pf = new TreeRootNode.PathFinder(g, true);
    class A {
        void assertPath(String expected, String resource) {
            FileObject f = rootFolder.getFileObject(resource);
            assertNotNull(resource, f);
            Node n = pf.findPath(r, f);
            if (expected == null) {
                assertNull(resource, n);
            } else {
                assertNotNull(resource, n);
                assertEquals(expected, Arrays.toString(NodeOp.createPath(n, r)));
            }
        }
    }
    new A().assertPath("[org.netbeans, api.stuff, Stuff]", "org/netbeans/api/stuff/Stuff.java");
    new A().assertPath("[org.netbeans, api.stuff]", "org/netbeans/api/stuff");
    new A().assertPath(null, "org/netbeans/api"); // displayed only in Files
    new A().assertPath("[org.netbeans, spi.stuff, StuffImplementation]", "org/netbeans/spi/stuff/StuffImplementation.java");
    new A().assertPath("[org.netbeans, spi.stuff, support]", "org/netbeans/spi/stuff/support");
    new A().assertPath("[org.netbeans, spi.stuff, support, AbstractStuffImplementation]", "org/netbeans/spi/stuff/support/AbstractStuffImplementation.java");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:PackageViewTest.java


示例2: createPopup

import org.openide.nodes.NodeOp; //导入依赖的package包/类
void createPopup(int xpos, int ypos) {
    // bugfix #23932, don't create if it's disabled
    if (isPopupAllowed()) {
        Node[] selNodes = manager.getSelectedNodes();

        if (selNodes.length > 0) {
            Action[] actions = NodeOp.findActions(selNodes);
            if (actions.length > 0) {
                createPopup(xpos, ypos, Utilities.actionsToPopup(actions, this));
            }                
        } else if (manager.getRootContext() != null) {
            JPopupMenu popup = manager.getRootContext().getContextMenu();
            if (popup != null) {
                createPopup(xpos, ypos, popup);
            }
        }                
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:TreeView.java


示例3: createExtendedPopup

import org.openide.nodes.NodeOp; //导入依赖的package包/类
void createExtendedPopup(int xpos, int ypos, JMenu newMenu) {
    Node[] ns = manager.getSelectedNodes();
    JPopupMenu popup = null;

    if (ns.length > 0) {
        // if any nodes are selected --> find theirs actions
        Action[] actions = NodeOp.findActions(ns);
        popup = Utilities.actionsToPopup(actions, this);
    } else {
        // if none node is selected --> get context actions from view's root
        if (manager.getRootContext() != null) {
            popup = manager.getRootContext().getContextMenu();
        }
    }

    int cnt = 0;

    if (popup == null) {
        popup = SystemAction.createPopupMenu(new SystemAction[] {  });
    }

    popup.add(newMenu);

    createPopup(xpos, ypos, popup);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:TreeView.java


示例4: createPopupMenu

import org.openide.nodes.NodeOp; //导入依赖的package包/类
/**
 * Creates a popup menu with entries from the selected nodes
 * related to the given component (usually a ETable subclass). The popup
 * is created for the table element in given column and row (column
 *  and row are in the view's coordinates (not the model's)).
 */
public JPopupMenu createPopupMenu(int row, int column, Node[] selectedNodes,
        Component component) {
    
    Action[] actions = NodeOp.findActions (selectedNodes);
    JPopupMenu res = Utilities.actionsToPopup(actions, component);
    if (showQuickFilter) {
        if ((component instanceof ETable) && (column >= 0)) {
            ETable et = (ETable)component;
            if (row >= 0) {
                Object val = et.getValueAt(row, column);
                val = et.transformValue(val);
                String s = NbBundle.getMessage(NodePopupFactory.class, "LBL_QuickFilter");
                res.add(et.getQuickFilterPopup(column, val, s));
            } else if (et.getQuickFilterColumn() == column) {
                addNoFilterItem(et, res);
            }
        }
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:NodePopupFactory.java


示例5: setSelectedNode

import org.openide.nodes.NodeOp; //导入依赖的package包/类
public void setSelectedNode (String path) {
    if (path == null) {
        return;
    }
    StringTokenizer tk = new StringTokenizer (path,"/");    //NOI18N
    final String[] names = new String[tk.countTokens()];
    for (int i=0;tk.hasMoreTokens();i++) {
        names[i] = tk.nextToken();
    }
    RP.post(new Runnable() {
        @Override public void run() {
            try {
                Node node = NodeOp.findPath(manager.getRootContext(), names);
                if (node != null) {
                    setSelectedNodes(new Node[] {node});
                }
            } catch (PropertyVetoException e) {
                //Skip it, not important
            } catch (NodeNotFoundException x) {
                // OK, never mind
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:TemplatesPanelGUI.java


示例6: stringPath2TreePath

import org.openide.nodes.NodeOp; //导入依赖的package包/类
/** Converts path of strings to TreePath if exists null otherwise
 */
private TreePath stringPath2TreePath (String[] sp) {
    ExplorerManager em = ExplorerManager.find (this);
    try {
        Node n = NodeOp.findPath (em.getRootContext (), sp); 
        
        // Create the tree path
        TreeNode tns[] = new TreeNode [sp.length + 1];
        
        for (int i = sp.length; i >= 0; i--) {
            tns[i] = Visualizer.findVisualizer (n);
            n = n.getParentNode ();
        }                
        return new TreePath (tns);
    } catch (NodeNotFoundException e) {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:OutlineTable.java


示例7: writeExternal

import org.openide.nodes.NodeOp; //导入依赖的package包/类
/** Serialize this property sheet */
@Override
public void writeExternal (ObjectOutput out)
throws IOException {
    super.writeExternal(out);

    if (global) {
        // write dummy array
        out.writeObject (null);
    } else {
        Node.Handle[] arr = NodeOp.toHandles (nodes);
        out.writeObject(arr);
    }

    out.writeBoolean(global);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:NbSheet.java


示例8: testPackageUnregistering

import org.openide.nodes.NodeOp; //导入依赖的package包/类
public void testPackageUnregistering() {
    MockLookup.setInstances(new NodesRegistrationSupport.PEPackageRegistration("test1.pkg"));
    NodeOp.registerPropertyEditors();
    MockLookup.setInstances(new NodesRegistrationSupport.PEPackageRegistration("test2.pkg"));
    
    String[] editorSearchPath = PropertyEditorManager.getEditorSearchPath();
    int count = 0;
    for (int i = 0; i < editorSearchPath.length; i++) {
        assertNotSame("test1.pkg", editorSearchPath[i]);
        if ("test2.pkg".equals(editorSearchPath[i])) {
            count++;
        }
    }
    assertEquals(1, count);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:PELookupTest.java


示例9: initializeWithRootContext

import org.openide.nodes.NodeOp; //导入依赖的package包/类
/** Initialize this top component properly with information
* obtained from specified root context node */
private void initializeWithRootContext (Node rc) {
    // update TC's attributes
    setToolTipText(rc.getDisplayName());
    setName(rc.getDisplayName());
    updateTitle();
    // attach listener
    if (weakRcL == null) {
        weakRcL = WeakListeners.propertyChange(
            rcListener(), rc
        );
    }
    rc.addPropertyChangeListener(weakRcL);

    if (weakNRcL == null) {
        weakNRcL = NodeOp.weakNodeListener (
            rcListener(), rc
        );
    }
    rc.addNodeListener(weakNRcL);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:Tab.java


示例10: getExpandedPaths

import org.openide.nodes.NodeOp; //导入依赖的package包/类
public List<String[]> getExpandedPaths() {
    List<String[]> result = new ArrayList<String[]>();
    if (getRootNode() != null) {
        TreeNode rtn = Visualizer.findVisualizer(getRootNode());
        TreePath tp = new TreePath(rtn); // Get the root
        Enumeration exPaths = tree.getExpandedDescendants(tp);
        while (exPaths != null && exPaths.hasMoreElements()) {
            TreePath ep = (TreePath) exPaths.nextElement();
            Node en = Visualizer.findNode(ep.getLastPathComponent());
            String[] path = NodeOp.createPath(en, getRootNode());
            result.add(path);
            if (logger.isTraceEnabled()) logger.trace("Expanded path: " + LoggingUtils.printArray(path));
        }
    }
    return result;

}
 
开发者ID:donatellosantoro,项目名称:Llunatic,代码行数:18,代码来源:StatefulView.java


示例11: getExpandedPaths

import org.openide.nodes.NodeOp; //导入依赖的package包/类
public List<String[]> getExpandedPaths() {

        List<String[]> result = new ArrayList<String[]>();

        TreeNode rtn = Visualizer.findVisualizer(getRootContext());
        TreePath tp = new TreePath(rtn); // Get the root

        Enumeration<TreePath> paths = tree.getExpandedDescendants(tp);
        if (null != paths) {
            while (paths.hasMoreElements()) {
                TreePath ep = paths.nextElement();
                Node en = Visualizer.findNode(ep.getLastPathComponent());
                String[] path = NodeOp.createPath(en, getRootContext());  
                result.add(path);
            }
        }

        return result;

    }
 
开发者ID:tusharvjoshi,项目名称:nbtaskfocus,代码行数:21,代码来源:CustomTreeView.java


示例12: stringPath2TreePath

import org.openide.nodes.NodeOp; //导入依赖的package包/类
/** Converts path of strings to TreePath if exists null otherwise
     */
private TreePath stringPath2TreePath(String[] sp) {

    try {
        Node n = NodeOp.findPath(getRootContext(), sp);

        // Create the tree path
        TreeNode tns[] = new TreeNode[sp.length + 1];

        for (int i = sp.length; i >= 0; i--) {
            tns[i] = Visualizer.findVisualizer(n);
            n = n.getParentNode();
        }
        return new TreePath(tns);
    } catch (NodeNotFoundException e) {
        return null;
    }
}
 
开发者ID:tusharvjoshi,项目名称:nbtaskfocus,代码行数:20,代码来源:CustomTreeView.java


示例13: findPathPlain

import org.openide.nodes.NodeOp; //导入依赖的package包/类
private Node findPathPlain(FileObject fo, FileObject groupRoot, Node rootNode) {
    FileObject folder = fo.isFolder() ? fo : fo.getParent();
    String relPath = FileUtil.getRelativePath(groupRoot, folder);
    List<String> path = new ArrayList<String>();
    StringTokenizer strtok = new StringTokenizer(relPath, "/"); // NOI18N
    while (strtok.hasMoreTokens()) {
        String token = strtok.nextToken();
       path.add(token);
    }
    try {
        Node folderNode =  folder.equals(groupRoot) ? rootNode : NodeOp.findPath(rootNode, Collections.enumeration(path));
        if (fo.isFolder()) {
            return folderNode;
        } else {
            Node[] childs = folderNode.getChildren().getNodes(true);
            for (int i = 0; i < childs.length; i++) {
               DataObject dobj = childs[i].getLookup().lookup(DataObject.class);
               if (dobj != null && dobj.getPrimaryFile().getNameExt().equals(fo.getNameExt())) {
                   return childs[i];
               }
            }
        }
    } catch (NodeNotFoundException e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:TreeRootNode.java


示例14: testReducedTreeDelete

import org.openide.nodes.NodeOp; //导入依赖的package包/类
@RandomlyFails // NB-Core-Build #8123
public void testReducedTreeDelete() throws Exception {
    SourceGroup g = sampleGroup();
    Node r = new TreeRootNode(g, true);
    assertTree("TestGroup{org.netbeans{api.stuff{Stuff.java}, modules.stuff{resources{stuff.png}, Bundle.properties, StuffUtils.java}, spi.stuff{support{AbstractStuffImplementation.java}, StuffImplementation.java}}}", r);
    Node n = NodeOp.findPath(r, new String[] {"org.netbeans", "modules.stuff"});
    n.destroy();
    assertTree("TestGroup{org.netbeans{api.stuff{Stuff.java}, spi.stuff{support{AbstractStuffImplementation.java}, StuffImplementation.java}}}", r);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:PackageViewTest.java


示例15: testReducedTreeCut

import org.openide.nodes.NodeOp; //导入依赖的package包/类
public void testReducedTreeCut() throws Exception { // #210314
    SourceGroup g = sampleGroup();
    Node r = new TreeRootNode(g, true);
    Node n = NodeOp.findPath(r, new String[] {"org.netbeans", "modules.stuff"});
    Transferable t = n.clipboardCut();
    DataObject moving = LoaderTransfer.getDataObject(t, LoaderTransfer.MOVE);
    assertEquals(g.getRootFolder().getFileObject("org/netbeans/modules"), moving.getPrimaryFile());
    n = NodeOp.findPath(r, new String[] {"org.netbeans", "spi.stuff", "support"});
    t = n.clipboardCut();
    moving = LoaderTransfer.getDataObject(t, LoaderTransfer.MOVE);
    assertEquals(g.getRootFolder().getFileObject("org/netbeans/spi/stuff/support"), moving.getPrimaryFile());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:PackageViewTest.java


示例16: showContextMenu

import org.openide.nodes.NodeOp; //导入依赖的package包/类
private void showContextMenu(Point popupPos) {
    formDesigner.componentActivated(); // just for sure...

    Node[] selectedNodes = formDesigner.getSelectedNodes();
    JPopupMenu popup = NodeOp.findContextMenu(selectedNodes);
    if (popup != null) {
        popup.show(HandleLayer.this, popupPos.x, popupPos.y);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:HandleLayer.java


示例17: showContextMenu

import org.openide.nodes.NodeOp; //导入依赖的package包/类
private void showContextMenu(Point popupPos) {
//        ComponentInspector inspector = ComponentInspector.getInstance();
//        Node[] selectedNodes = inspector.getSelectedNodes();
        Node[] selectedNodes = formDesigner.getSelectedNodes();
        JPopupMenu popup = NodeOp.findContextMenu(selectedNodes);
        if(!this.isVisible()) {
            this.setVisible(true);
        }
        if (popup != null) {
            popup.show(this, popupPos.x, popupPos.y);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:MenuEditLayer.java


示例18: getSelectedPaths

import org.openide.nodes.NodeOp; //导入依赖的package包/类
private List<String[]> getSelectedPaths() {
    List<String[]> result = new ArrayList<String[]>();
    Node root = manager.getRootContext();
    for (Node n : manager.getSelectedNodes()) {
        String[] path = NodeOp.createPath(n, root);
        LOG.log(Level.FINE, "path from {0} to {1}: {2}", new Object[] {root, n, Arrays.asList(path)});
        if (path != null) {
            result.add(path);
        }
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ProjectTab.java


示例19: isParent

import org.openide.nodes.NodeOp; //导入依赖的package包/类
private static boolean isParent(Node parent, Node child) {
    if (NodeOp.isSon(parent, child)) {
        return true;
    }

    Node p = child.getParentNode();

    if (p == null) {
        return false;
    }

    return isParent(parent, p);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:Nodes.java


示例20: doRegisterPropertyEditors

import org.openide.nodes.NodeOp; //导入依赖的package包/类
/** Register NB specific property editors.
     *  Allows property editor unit tests to work correctly without 
     *  initializing full NetBeans environment.
     *  @since 1.98 */
    private static final void doRegisterPropertyEditors() {
        //issue 31879
//        if (editorsRegistered) return;
//        String[] syspesp = PropertyEditorManager.getEditorSearchPath();
//        String[] nbpesp = new String[] {
//            "org.netbeans.beaninfo.editors", // NOI18N
//            "org.openide.explorer.propertysheet.editors", // NOI18N
//        };
//        String[] allpesp = new String[syspesp.length + nbpesp.length];
//        System.arraycopy(nbpesp, 0, allpesp, 0, nbpesp.length);
//        System.arraycopy(syspesp, 0, allpesp, nbpesp.length, syspesp.length);
//        PropertyEditorManager.setEditorSearchPath(allpesp);
//        PropertyEditorManager.registerEditor (java.lang.Character.TYPE, org.netbeans.beaninfo.editors.CharEditor.class);
//        PropertyEditorManager.registerEditor(String[].class, org.netbeans.beaninfo.editors.StringArrayEditor.class); 
//        // use replacement hintable/internationalizable primitive editors - issues 20376, 5278
//        PropertyEditorManager.registerEditor (Integer.TYPE, org.netbeans.beaninfo.editors.IntEditor.class);
//        PropertyEditorManager.registerEditor (Boolean.TYPE, org.netbeans.beaninfo.editors.BoolEditor.class);
        
        NodeOp.registerPropertyEditors();
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                NodeOp.registerPropertyEditors();
            }
        });

        ProxySelector selector = Lookup.getDefault().lookup(ProxySelector.class);
        if (selector != null) {
            // install java.net.ProxySelector
            ProxySelector.setDefault(selector);
        }

        editorsRegistered = true;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:CoreBridgeImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CSVEntryConverter类代码示例发布时间:2022-05-23
下一篇:
Java JRDesignSection类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap