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


Java Node.getLookup方法代碼示例

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


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

示例1: getCurrentSelection

import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override
public FileObject[] getCurrentSelection() {
    Node[] nodes = TopComponent.getRegistry().getActivatedNodes();
    if(nodes == null) {
        return null;
    }        
    List<FileObject> ret = new ArrayList<FileObject>();
    for(Node node : nodes) {
        Lookup nodeLookup = node.getLookup();
        Collection<? extends Project> projects = nodeLookup.lookupAll(Project.class);
        if(projects != null && !projects.isEmpty()) {
            for (Project project : projects) {
                ret.add(project.getProjectDirectory());
            }
        } else {
            DataObject dataObj = nodeLookup.lookup(DataObject.class);
            if (dataObj != null) {
                FileObject fileObj = dataObj.getPrimaryFile();
                if (fileObj != null) {
                    ret.add(fileObj);
                }
            }
        }
    }
    return ret.toArray(new FileObject[ret.size()]);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:ProjectServicesImpl.java

示例2: node

import org.openide.nodes.Node; //導入方法依賴的package包/類
public Node node(final SourceGroup key) {
    try {
        Node nodeDelegate = DataObject.find(key.getRootFolder()).getNodeDelegate();
        return new FilterNode(nodeDelegate,
                null, new ProxyLookup(nodeDelegate.getLookup(), Lookups.singleton(new PathFinder(key)))) {
            @Override
            public String getName() {
                return key.getName();
            }
            @Override
            public String getDisplayName() {
                return key.getDisplayName();
            }
        };
    } catch (DataObjectNotFoundException ex) {
        throw new AssertionError(ex);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:TestDataDirsNodeFactory.java

示例3: TreeRootNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
private TreeRootNode (Node originalNode, DataFolder folder, SourceGroup g, boolean reduced) {
    super(originalNode, reduced ? Children.create(new ReducedChildren(folder, new GroupDataFilter(g), g), true) : new PackageFilterChildren(originalNode),
        new ProxyLookup(
            originalNode.getLookup(),
            Lookups.singleton(new PathFinder(g, reduced))
            // no need for explicit search info
        ));
    this.g = g;
    g.addPropertyChangeListener(WeakListeners.propertyChange(this, g));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:TreeRootNode.java

示例4: LibraryDependencyNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
LibraryDependencyNode(final TestModuleDependency dep,
        String testType,
        final NbModuleProject project, final Node original) {
    super(original, null, new ProxyLookup(new Lookup[] {
        original.getLookup(),
        Lookups.fixed(new Object[] { dep, project, testType })
    }));
    this.dep = dep;
    this.testType = testType;
    this.project = project;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:UnitTestLibrariesNode.java

示例5: LibraryDependencyNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
LibraryDependencyNode(final ModuleDependency dep,
        final NbModuleProject project, final Node original) {
    super(original, null, new ProxyLookup(original.getLookup(), Lookups.fixed(dep, project)));
    this.dep = dep;
    this.project = project;
    setShortDescription(LibrariesNode.createHtmlDescription(dep));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:LibrariesNode.java

示例6: CategoryNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
private CategoryNode( Node originalNode, InstanceContent content, Lookup lkp ) {
    super( originalNode, 
           new Children( originalNode, lkp ),
           new ProxyLookup( new Lookup[] { lkp, new AbstractLookup(content), originalNode.getLookup() } ) );
    
    DataFolder folder = (DataFolder)originalNode.getCookie( DataFolder.class );
    if( null != folder ) {
        content.add( new DataFolder.Index( folder, this ) );
        FileObject fob = folder.getPrimaryFile();
        Object catName = fob.getAttribute( CAT_NAME );
        if (catName instanceof String)
            setDisplayName((String)catName);
    }
    content.add( this );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:CategoryNode.java

示例7: createLookup

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static Lookup createLookup(final Node original, Object... toAdd) {
    final Lookup lookup = original.getLookup();
    final org.netbeans.spi.project.ui.PathFinder pathFinder =
            lookup.lookup(org.netbeans.spi.project.ui.PathFinder.class);
    final Lookup lkp = new ProxyLookup(
            Lookups.exclude(lookup, org.netbeans.spi.project.ui.PathFinder.class),
            Lookups.fixed (toAdd),
            Lookups.singleton(new PathFinder(pathFinder)));
    return lkp;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:ActionFilterNode.java

示例8: ApkFilterNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
public ApkFilterNode(Node original) {
    super(original, org.openide.nodes.Children.LEAF, new ProxyLookup(original.getLookup(), Lookups.fixed(new SignInfoHolder())));
    holder = getLookup().lookup(SignInfoHolder.class);
    project = FileOwnerQuery.getOwner(pf);
    pf.addFileChangeListener(WeakListeners.create(FileChangeListener.class, this, pf));
    refreshIcons();
}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:8,代碼來源:ApkDataObject.java

示例9: ActionFilterNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
private ActionFilterNode(Node original, int mode, FileObject cpRoot, FileObject resource) {
    this(original, mode, cpRoot,
            new ProxyLookup(original.getLookup(),Lookups.singleton(new JavadocProvider(cpRoot,resource))));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:ActionFilterNode.java

示例10: badgingLookup

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static Lookup badgingLookup(Node n) {
    return new BadgingLookup(n.getLookup());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:ProjectsRootNode.java

示例11: ActionFilterNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
private ActionFilterNode (Node original, Mode mode, FileObject cpRoot, FileObject resource) {
    this (original, mode, cpRoot,
        new ProxyLookup(new Lookup[] {original.getLookup(),Lookups.singleton(new JavadocProvider(cpRoot,resource))}));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:ActionFilterNode.java

示例12: testBug32470FilterNodeAndANodeImplementingACookie

import org.openide.nodes.Node; //導入方法依賴的package包/類
public void testBug32470FilterNodeAndANodeImplementingACookie() {
    class NY extends AbstractNode implements SaveCookie {
        public NY() {
            super(Children.LEAF);
            getCookieSet().add(this);
        }
        
        public void save() {
        }
    }
    
    Node ny = new NY();
    Node node = new FilterNode(new FilterNode(ny, null, ny.getLookup()));
    top.setActivatedNodes(new Node[] { node });
    
    Lookup.Template<Node> nodeTemplate = new Lookup.Template<Node>(Node.class);
    Lookup.Template<SaveCookie> saveTemplate = new Lookup.Template<SaveCookie>(SaveCookie.class);
    Collection<? extends Node> res;
    
    res = lookup.lookup(nodeTemplate).allInstances();
    
    assertEquals("just one returned", res.size(), 1);
    assertEquals("node is node", node, res.iterator().next());
    //MK - the above 2 tests should test the same..
    //        assertEquals ("FilterNode is the only node there",
    //            Collections.singletonList(node), res
    //        );
    
    Collection<? extends SaveCookie> res2 = lookup.lookup(saveTemplate).allInstances();
    
    assertEquals("just one returned", res2.size(), 1);
    assertEquals("node is node", ny, res2.iterator().next());
    //MK - the above 2 tests should test the same..
    //        assertEquals ("SaveCookie is there only once",
    //            Collections.singletonList(ny), res
    //        );
    
    res = lookup.lookup(nodeTemplate).allInstances();
    
    assertEquals("just one returned", res.size(), 1);
    assertEquals("node is node", node, res.iterator().next());
    //MK - the above 2 tests should test the same..
    //        assertEquals ("FilterNode is still the only node there",
    //            Collections.singletonList(node), res
    //        );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:47,代碼來源:TopComponentGetLookupTest.java

示例13: isVersionedProject

import org.openide.nodes.Node; //導入方法依賴的package包/類
/**
 * @return <code>true</code> if
 * <ul>
 *  <li> the node contains a project in its lookup and
 *  <li> the project contains at least one SVN versioned source group
 * </ul>
 * otherwise <code>false</code>.
 * @param project
 * @param checkStatus if set to true, cache.getStatus is called and can take significant amount of time
 */
public static boolean isVersionedProject(Node node, boolean checkStatus) {
    Lookup lookup = node.getLookup();
    Project project = (Project) lookup.lookup(Project.class);
    return isVersionedProject(project, checkStatus);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:SvnUtils.java


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