本文整理了Java中org.openide.util.Lookup.lookupAll()
方法的一些代码示例,展示了Lookup.lookupAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lookup.lookupAll()
方法的具体详情如下:
包路径:org.openide.util.Lookup
类名称:Lookup
方法名:lookupAll
[英]Find all instances corresponding to a given class. Equivalent to calling #lookupResult and asking for Lookup.Result#allInstances but slightly more convenient. Subclasses may override this method to produce the same semantics more efficiently.
Example usage:
for (MyService svc : Lookup.getDefault().lookupAll(MyService.class)) {
svc.useMe();
}
[中]查找与给定类对应的所有实例。相当于调用#lookupResult并请求查找。结果#所有仪器,但稍微方便一点。子类可以重写此方法以更有效地生成相同的语义。
用法示例:
for (MyService svc : Lookup.getDefault().lookupAll(MyService.class)) {
svc.useMe();
}
代码示例来源:origin: org.netbeans.api/org-openide-util
/**
* Displays the help page in a supported viewer, if any.
* @return true if this help was displayed successfully
* @since 8.21
* @see org.openide.util.HelpCtx.Displayer#display
*/
public boolean display() {
for (Displayer d : Lookup.getDefault().lookupAll(Displayer.class)) {
if (d.display(this)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
layerUrls.add(generatedLayer);
for (LayerProvider p : Lookup.getDefault().lookupAll(LayerProvider.class)) {
List<URL> newURLs = new ArrayList<URL>();
p.registerLayers(newURLs);
代码示例来源:origin: org.netbeans.api/org-openide-modules
public @Override ModuleInfo ownerOf(Class<?> clazz) {
for (ModuleInfo module : Lookup.getDefault().lookupAll(ModuleInfo.class)) {
if (module.owns(clazz)) {
return module;
}
}
return null;
}
代码示例来源:origin: org.netbeans.api/org-openide-util-ui
/**
* Displays the help page in a supported viewer, if any.
* @return true if this help was displayed successfully
* @since 8.21
* @see org.openide.util.HelpCtx.Displayer#display
*/
public boolean display() {
for (Displayer d : Lookup.getDefault().lookupAll(Displayer.class)) {
if (d.display(this)) {
return true;
}
}
return false;
}
代码示例来源:origin: eu.agrosense.api/linking
protected Collection<? extends LinkProcessor> getProcessors() {
//FIXME: server LinkProcessor needs session context to get to storage service, and possibly an action/handler to return models
//(clients can use Connection.get() instance)
//can't use ctor or setter because of Lookup (reused/caching)
//add Provider/Factory abstraction layer to lookup instead, and for each:
// LinkProcessor lp = lpFactory.newProcessor(context);
return Lookup.getDefault().lookupAll(LinkProcessor.class);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject
private synchronized Collection<? extends UserOptionsProvider> getUserOptionsProviders() {
if (uoProviders == null) {
uoProviders = Lookup.getDefault().lookupAll(UserOptionsProvider.class);
}
return uoProviders;
}
代码示例来源:origin: org.netbeans.api/org-openide-text
/** Returns enumeration of all registered indentation engines.
* @return enumeration of IndentEngine
*/
public static Enumeration<? extends IndentEngine> indentEngines() {
return Collections.enumeration(Lookup.getDefault().lookupAll(IndentEngine.class));
}
代码示例来源:origin: nl.cloudfarming.client/cloudfarming-client-geoviewer-api
/**
* retrieves all globally registered edit layer actions
*
* @return
*/
@Override
public EditLayerAction[] getActions() {
return Lookup.getDefault().lookupAll(EditLayerAction.class).toArray(new EditLayerAction[]{});
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-management
private DataStorageManager() {
dataStorageFactories = Lookup.getDefault().lookupAll(DataStorageFactory.class);
log.log(Level.FINE, "{0} data storage(s) found!", dataStorageFactories.size()); // NOI18N
perstistentDataStorageFactories = Lookup.getDefault().lookupAll(PersistentDataStorageFactory.class);
log.log(Level.FINE, "{0} persistent data storage(s) found!", dataStorageFactories.size()); // NOI18N
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-team-commons
public static TeamAccessor[] getTeamAccessors() {
if (teamAccessors == null) {
Collection<? extends TeamAccessor> coll = Lookup.getDefault().lookupAll(TeamAccessor.class);
teamAccessors = coll.toArray(new TeamAccessor[coll.size()]);
}
return teamAccessors;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-highlight
private SemanticEntitiesProvider() {
Collection<? extends SemanticEntity> lookupAll = Lookup.getDefault().lookupAll(SemanticEntity.class);
if (HighlighterBase.MINIMAL) { // for QEs who want to save performance on UI tests
list = new ArrayList<SemanticEntity>();
list.add(lookupAll.iterator().next());
} else {
list = new ArrayList<SemanticEntity>(Lookup.getDefault().lookupAll(SemanticEntity.class));
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject
public static ConfigurationAuxObjectProvider[] getAuxObjectProviders() {
HashSet<ConfigurationAuxObjectProvider> auxObjectProviders = new HashSet<>();
Collection<? extends ConfigurationAuxObjectProvider> collection =
Lookup.getDefault().lookupAll(ConfigurationAuxObjectProvider.class);
// System.err.println("-------------------------------collection " + collection);
Iterator<? extends ConfigurationAuxObjectProvider> iterator = collection.iterator();
while (iterator.hasNext()) {
auxObjectProviders.add(iterator.next());
}
// System.err.println("-------------------------------auxObjectProviders " + auxObjectProviders);
return auxObjectProviders.toArray(new ConfigurationAuxObjectProvider[auxObjectProviders.size()]);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject
/*package*/NativeFileSearch getNativeFileSearch() {
NativeFileSearch search = null;
for (FileProviderFactory fpf : Lookup.getDefault().lookupAll(FileProviderFactory.class)) {
FileProvider provider = fpf.createFileProvider();
if (provider instanceof NativeFileSearch) {
search = (NativeFileSearch) provider;
}
}
return search;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject
@Override
public NativeFileSearch getNativeFileSearch(NativeProject project) {
NativeFileSearch search = null;
for (FileProviderFactory fpf : Lookup.getDefault().lookupAll(FileProviderFactory.class)) {
FileProvider provider = fpf.createFileProvider();
if (provider instanceof NativeFileSearch) {
search = (NativeFileSearch) provider;
}
}
return search;
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject
private void notifyProjectStopActivity() {
for (MakeProjectLife service : Lookup.getDefault().lookupAll(MakeProjectLife.class)) {
service.stop(this);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-management
public Collection<DataProviderFactory> getDataProviderFactories(final DataModelScheme visDataModelScheme) {
Collection<? extends DataProviderFactory> factories = Lookup.getDefault().lookupAll(DataProviderFactory.class);
List<DataProviderFactory> result = new ArrayList<DataProviderFactory>();
for (DataProviderFactory factory : factories) {
if (factory.getProvidedDataModelScheme().contains(visDataModelScheme)) {
result.add(factory);
}
}
return Collections.unmodifiableCollection(result);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils
DefaultProvider() {
Collection<? extends CndFileSystemProvider> instances =
Lookup.getDefault().lookupAll(CndFileSystemProvider.class);
cache = instances.toArray(new CndFileSystemProvider[instances.size()]);
CndUtils.assertTrueInConsole(cache.length > 0, "CndFileSystemProvider NOT FOUND"); // NOI18N
}
代码示例来源:origin: org.gephi/appearance-api
private List<Transformer> initEdgeTransformers() {
List<Transformer> res = new ArrayList<>();
for (Transformer transformer : Lookup.getDefault().lookupAll(Transformer.class)) {
if (transformer.isEdge()) {
res.add(transformer);
}
}
return res;
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-java-testrunner-ui
private static String getTestingFrameworkSuffix(String selectedFramework) {
if (selectedFramework == null) {
return "";
}
String testngFramework = "";
Collection<? extends GuiUtilsProvider> providers = Lookup.getDefault().lookupAll(GuiUtilsProvider.class);
for (GuiUtilsProvider provider : providers) {
testngFramework = provider.getTestngFramework();
break;
}
return selectedFramework.equals(testngFramework) ? "NG" : ""; //NOI18N
}
代码示例来源:origin: eu.agrosense.server/observations
@Override
protected Collection<? extends LinkProcessor> getProcessors() {
List<LinkProcessor> list = new ArrayList<>();
for (Factory factory : Lookup.getDefault().lookupAll(Factory.class)) {
list.add(factory.createProcessor(context));
}
return list;
}
内容来源于网络,如有侵权,请联系作者删除!