org.openide.util.Lookup.lookupItem()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中org.openide.util.Lookup.lookupItem()方法的一些代码示例,展示了Lookup.lookupItem()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lookup.lookupItem()方法的具体详情如下:
包路径:org.openide.util.Lookup
类名称:Lookup
方法名:lookupItem

Lookup.lookupItem介绍

[英]Look up the first item matching a given template. Includes not only the instance but other associated information.
[中]查找与给定模板匹配的第一项。不仅包括实例,还包括其他关联信息。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util-lookup

public <T> Item<T> lookupItem(Template<T> template) {
  return checkLookup().lookupItem(template);
}

代码示例来源:origin: org.netbeans.api/org-openide-util-lookup

@Override
public final <T> Item<T> lookupItem(Template<T> template) {
  beforeLookup(template);
  Lookup[] tmpLkps; 
  synchronized (ProxyLookup.this) {
    tmpLkps = getData().getLookups(false);
  }
  for (int i = 0; i < tmpLkps.length; i++) {
    Item<T> o = tmpLkps[i].lookupItem(template);
    if (o != null) {
      return o;
    }
  }
  return null;
}

代码示例来源:origin: org.netbeans.api/org-openide-util-lookup

@Override
public <T> Lookup.Item<T> lookupItem(Lookup.Template<T> template) {
  if (areSubclassesOfThisClassAlwaysExcluded(template.getType())) {
    return null;
  }
  Lookup.Item<T> retValue = delegate.lookupItem(template);
  if (isObjectAccessible(template.getType(), retValue, 2)) {
    return retValue;
  } else {
    return null;
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

/**
* Implementation of the above method.
*
* @param activatedNodes gives array of actually activated nodes.
* @return number of supported classes
*/
private int resolveSupported(Node[] activatedNodes) {
  int ret = 0;
  Class<?>[] cookies = getCookies();
  for (Node n : activatedNodes) {
    for (Class<?> cookie : cookies) {
      // test for supported cookies
      @SuppressWarnings("unchecked")
      Lookup.Template<?> templ = new Lookup.Template(cookie);
      if (n.getLookup().lookupItem(templ) != null) {
        ret++;
        break;
      }
    }
  }
  return ret;
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

if (prov.getLookup().lookupItem(template) == null) {
  return false;
if (prov.getLookup().lookupItem(template) == null) {
  return false;

代码示例来源:origin: org.netbeans.api/org-openide-nodes

@Override
public <T> Item<T> lookupItem(Template<T> template) {
  boolean nodeQ = isNodeQuery(template.getType());
  Item<T> i = checkNode().lookupItem(template);
  if (
    nodeQ && 
    i == null && 
    template.getType().isInstance(node) &&
    (template.getInstance() == null || template.getInstance() == node)
  ) {
    i = checkNode().lookupItem(wackohacko(template.getId(), template.getInstance()));
  }
  return nodeQ && i != null ? new FilterItem<T>(i, template.getType()) : i;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public final Item lookupItem(Template template) {
  beforeLookup (template);
  
  Lookup[] lookups = this.lookups;
  for (int i = 0; i < lookups.length; i++) {
    Item o = lookups[i].lookupItem (template);
    if (o != null) {
      return o;
    }
  }
  
  return null;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public final Item lookupItem(Template template) {
  beforeLookup (template);
  
  Lookup[] lookups = this.lookups;
  for (int i = 0; i < lookups.length; i++) {
    Item o = lookups[i].lookupItem (template);
    if (o != null) {
      return o;
    }
  }
  
  return null;
}

代码示例来源:origin: in.jlibs/org-openide-util

public <T> Item<T> lookupItem(Template<T> template) {
  return checkLookup().lookupItem(template);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public Item lookupItem(Template template) {
  return checkLookup ().lookupItem (template);
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util-lookup

public <T> Item<T> lookupItem(Template<T> template) {
  return checkLookup().lookupItem(template);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public Item lookupItem(Template template) {
  return checkLookup ().lookupItem (template);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-core

public String getAsText () {
  try {
    org.openide.awt.HtmlBrowser.Factory f = (org.openide.awt.HtmlBrowser.Factory)getValue ();
    
    Lookup.Item<org.openide.awt.HtmlBrowser.Factory> i = Lookup.getDefault().lookupItem(
      new Lookup.Template<org.openide.awt.HtmlBrowser.Factory> (org.openide.awt.HtmlBrowser.Factory.class, null, f)
    );
    if (i != null)
      return i.getDisplayName();
  }
  catch (Exception ex) {
    Exceptions.printStackTrace(ex);
  }
  return NbBundle.getMessage (FactoryEditor.class, "CTL_UnspecifiedBrowser"); //NOI18N
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util-lookup

@Override
public final <T> Item<T> lookupItem(Template<T> template) {
  beforeLookup(template);
  Lookup[] tmpLkps; 
  synchronized (ProxyLookup.this) {
    tmpLkps = getData().getLookups(false);
  }
  for (int i = 0; i < tmpLkps.length; i++) {
    Item<T> o = tmpLkps[i].lookupItem(template);
    if (o != null) {
      return o;
    }
  }
  return null;
}

代码示例来源:origin: in.jlibs/org-openide-util

@Override
public final <T> Item<T> lookupItem(Template<T> template) {
  beforeLookup(template);
  Lookup[] tmpLkps; 
  synchronized (ProxyLookup.this) {
    tmpLkps = getData().getLookups(false);
  }
  for (int i = 0; i < tmpLkps.length; i++) {
    Item<T> o = tmpLkps[i].lookupItem(template);
    if (o != null) {
      return o;
    }
  }
  return null;
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util-lookup

@Override
public <T> Lookup.Item<T> lookupItem(Lookup.Template<T> template) {
  if (areSubclassesOfThisClassAlwaysExcluded(template.getType())) {
    return null;
  }
  Lookup.Item<T> retValue = delegate.lookupItem(template);
  if (isObjectAccessible(template.getType(), retValue, 2)) {
    return retValue;
  } else {
    return null;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

private static Node findProjectNode(Node root, Project p) {
  Node[] n = root.getChildren().getNodes(true);
  Template<Project> t = new Template<>(null, null, p);
  for (int cntr = 0; cntr < n.length; cntr++) {
    if (n[cntr].getLookup().lookupItem(t) != null) {
      return n[cntr];
    }
  }
  return null;
}

代码示例来源:origin: in.jlibs/org-openide-util

@Override
public <T> Lookup.Item<T> lookupItem(Lookup.Template<T> template) {
  if (areSubclassesOfThisClassAlwaysExcluded(template.getType())) {
    return null;
  }
  Lookup.Item<T> retValue = delegate.lookupItem(template);
  if (isObjectAccessible(template.getType(), retValue, 2)) {
    return retValue;
  } else {
    return null;
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public Item lookupItem(Template template) {
  Item i = checkNode ().lookupItem (template);
  return isNodeQuery (template.getType ()) ? new FilterItem (i, template.getType()) : i;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public Item lookupItem(Template template) {
  Item i = checkNode ().lookupItem (template);
  return isNodeQuery (template.getType ()) ? new FilterItem (i, template.getType()) : i;
}

相关文章