本文整理匯總了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()]);
}
示例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);
}
}
示例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));
}
示例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;
}
示例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));
}
示例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 );
}
示例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;
}
示例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();
}
示例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))));
}
示例10: badgingLookup
import org.openide.nodes.Node; //導入方法依賴的package包/類
private static Lookup badgingLookup(Node n) {
return new BadgingLookup(n.getLookup());
}
示例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))}));
}
示例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
// );
}
示例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);
}