本文整理汇总了Java中org.openide.util.lookup.Lookups.forPath方法的典型用法代码示例。如果您正苦于以下问题:Java Lookups.forPath方法的具体用法?Java Lookups.forPath怎么用?Java Lookups.forPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.util.lookup.Lookups
的用法示例。
在下文中一共展示了Lookups.forPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: check
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
private void check() {
//this call effectively calls project.getLookup(), when called in constructor will get back to the project's baselookup only.
// but when called from propertyChange() then will call on entire composite lookup, is it a problem? #230469
NbMavenProject watcher = watcherRef.get();
String newPackaging = packaging != null ? packaging : NbMavenProject.TYPE_JAR;
if (watcher != null) {
newPackaging = watcher.getPackagingType();
if (newPackaging == null) {
newPackaging = NbMavenProject.TYPE_JAR;
}
}
if (!newPackaging.equals(packaging)) {
packaging = newPackaging;
Lookup pack = Lookups.forPath("Projects/org-netbeans-modules-maven/" + packaging + "/Lookup");
setLookups(general, pack);
}
}
示例2: init
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
/**
* Initialize the registry
* @param folder the name of the xml layer folder to use
* @param dataLookup the lookup to use when creating providers
*/
private void init(String folder, final Lookup dataLookup) {
Lookup lookup = Lookups.forPath(PATH + folder + NODEPROVIDERS);
lookupResult = lookup.lookupResult(NodeProviderFactory.class);
initProviders(dataLookup);
// listen for changes and re-init the providers when the lookup changes
lookupResult.addLookupListener(WeakListeners.create(LookupListener.class,
lookupListener = new LookupListener() {
@Override
public void resultChanged(LookupEvent ev) {
initProviders(dataLookup);
changeSupport.fireChange();
}
},
lookupResult)
);
}
示例3: getTipAnnotations
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
private Annotation[] getTipAnnotations() {
Annotation[] annos;
synchronized (NbToolTip.class) {
annos = tipAnnotations;
}
if (annos == null) {
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Searching for tooltip annotations for mimeType = '" + mimeType + "'"); //NOI18N
}
Lookup l = Lookups.forPath("Editors/" + mimeType + "/ToolTips"); //NOI18N
Collection<? extends Annotation> res = l.lookupAll(Annotation.class);
if (res.contains(null)) {
throw new IllegalStateException("Lookup returning null instance: " + l); // NOI18N
}
annos = res.toArray(new Annotation[res.size()]);
synchronized (NbToolTip.class) {
tipAnnotations = annos;
}
}
return annos;
}
示例4: getSavedValue
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
String getSavedValue(String mimeType, String key) {
PreferencesCustomizer prefsCustomizer = getCustomizer(mimeType);
if (prefsCustomizer != null) {
Lookup l = Lookups.forPath(CODE_COMPLETION_CUSTOMIZERS_FOLDER + mimeType);
PreferencesCustomizer.CustomCustomizer customizer;
if (mimeType.isEmpty()) {
customizer = l.lookup(GeneralCompletionOptionsPanelController.CustomCustomizerImpl.class);
} else {
customizer = l.lookup(PreferencesCustomizer.CustomCustomizer.class);
}
if (customizer != null) {
return customizer.getSavedValue(prefsCustomizer, key);
}
}
return null;
}
示例5: setUp
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
log = Logger.getLogger("[Test - " + getName() + "]");
lookup = Lookups.forPath("OptionsDialog"); // NOI18N
Lookup.Result<RegisteredCategory> result = lookup.lookup(new Lookup.Template<RegisteredCategory>(RegisteredCategory.class));
all = result.allInstances();
assertTrue(all.size() > 0);
}
示例6: PackagingTypeDependentLookup
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
@SuppressWarnings("LeakingThisInConstructor")
PackagingTypeDependentLookup(NbMavenProject watcher) {
this.watcherRef = new WeakReference<NbMavenProject>(watcher);
//needs to be kept around to prevent recreating instances
general = Lookups.forPath("Projects/org-netbeans-modules-maven/Lookup"); //NOI18N
check();
watcher.addPropertyChangeListener(WeakListeners.propertyChange(this, watcher));
}
示例7: getUserCatalogsLookup
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
/**
* Provide Lookup containing registered module catalogs.
*/
private static Lookup getUserCatalogsLookup() {
if (userCatalogLookup == null) {
userCatalogLookup = Lookups.forPath(REGISTRATIONS);
}
return userCatalogLookup;
}
示例8: setLayersAndInstances
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
/**
* Sets the global default lookup with some fixed instances and
* content read from Services folder from system file system.
* Will also include (at a lower priority) a {@link ClassLoader},
* and services found from <code>META-INF/services/*</code> in the classpath.
*/
public static void setLayersAndInstances(Object... instances) {
ClassLoader l = MockLookup.class.getClassLoader();
if (l != Lookup.getDefault().lookup(ClassLoader.class)) {
setLookup(Lookups.fixed(instances), Lookups.metaInfServices(l), Lookups.singleton(l));
}
Lookup projects = Lookups.forPath("Services");
Collection<?> initialize = projects.lookupAll(Object.class);
//System.err.println("all: " + initialize);
setLookup(Lookups.fixed(instances), Lookups.metaInfServices(l), Lookups.singleton(l), projects);
}
示例9: onShowing
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
private synchronized Lookup.Result<Runnable> onShowing() {
if (resShow == null) {
Lookup lkp = lkpShowing != null ? lkpShowing : Lookups.forPath("Modules/UIReady"); // NOI18N
resShow = lkp.lookupResult(Runnable.class);
resShow.addLookupListener(this);
}
return resShow;
}
示例10: init
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
private void init(Lookup masterLookup) {
if (initialized) return;
initialized = true;
panel = new VcsAdvancedOptionsPanel();
Lookup lookup = Lookups.forPath("VersioningOptionsDialog"); // NOI18N
Iterator<? extends AdvancedOption> it = lookup.lookup(new Lookup.Template<AdvancedOption> (AdvancedOption.class)).
allInstances().iterator();
while (it.hasNext()) {
AdvancedOption option = it.next();
registerOption(option, masterLookup);
}
}
示例11: doTestAvoidStackTraces
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
private void doTestAvoidStackTraces() throws Exception {
CharSequence log = Log.enable(RecognizeInstanceFiles.class.getName(), Level.INFO);
Lookup lkp = Lookups.forPath("d");
assertEquals(null, lkp.lookup(Runnable.class));
Collection<? extends Lookup.Item<Object>> items = lkp.lookupResult(Object.class).allItems();
if (!items.isEmpty()) {
assertEquals(1, items.size());
Lookup.Item<Object> item = items.iterator().next();
assertEquals(Void.class, item.getType());
assertEquals(null, item.getInstance());
}
assertEquals("", log.toString());
// this ignores instanceOf (probably OK) and does print a CNFE stack (also probably OK):
assertEquals(null, FileUtil.getConfigObject("d/meaningless-name.instance", Object.class));
}
示例12: initLookup
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
private Lookup.Result<T> initLookup() {
Lookup lkp = Lookups.forPath( SCANNER_LIST_PATH );
Lookup.Template<T> template = new Lookup.Template<T>( clazz );
Lookup.Result<T> res = lkp.lookup( template );
return res;
}
示例13: InstallerRegistry
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
InstallerRegistry() {
this.lookup = Lookups.forPath(INSTALLER_REGISTRY_FOLDER);
this.platformInstalls = null;
}
示例14: testSupportsClassNameEncodedInAFileName
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public void testSupportsClassNameEncodedInAFileName() throws Exception {
FileObject inst = FileUtil.createData(root, "inst/class/" + Inst.class.getName().replace('.', '-') + ".instance");
Lookup l = Lookups.forPath("inst/class");
assertNotNull("Instance created", l.lookup(Inst.class));
}
示例15: PathLookup
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
PathLookup(String path) {
this.delegate = Lookups.forPath(path);
this.path = path;
}