本文整理汇总了Java中org.openide.util.lookup.Lookups.proxy方法的典型用法代码示例。如果您正苦于以下问题:Java Lookups.proxy方法的具体用法?Java Lookups.proxy怎么用?Java Lookups.proxy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.util.lookup.Lookups
的用法示例。
在下文中一共展示了Lookups.proxy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTestModelSource
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public ModelSource createTestModelSource(FileObject fo, boolean editable) throws CatalogModelException{
final DataObject dobj;
final CatalogModel catalogModel = createCatalogModel(fo);
try {
dobj = DataObject.find(fo);
} catch (DataObjectNotFoundException ex) {
throw new CatalogModelException(ex);
}
Lookup lookup = Lookups.proxy(new Lookup.Provider() {
public Lookup getLookup() {
return Lookups.fixed(new Object[] {
dobj.getPrimaryFile(),
getDocument(dobj.getPrimaryFile()),
dobj,
catalogModel
});
}
} );
return new ModelSource(lookup, editable);
}
示例2: createTestModelSource
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public ModelSource createTestModelSource(FileObject fo, boolean editable) throws CatalogModelException{
final DataObject dobj;
final CatalogModel catalogModel = createCatalogModel(fo);
try {
dobj = DataObject.find(fo);
} catch (DataObjectNotFoundException ex) {
throw new CatalogModelException(ex);
}
Lookup lookup = Lookups.proxy(new Lookup.Provider() {
public Lookup getLookup() {
return Lookups.fixed(new Object[] {
dobj.getPrimaryFile(),
getDocument(dobj.getPrimaryFile()),
dobj,
catalogModel
});
}
} );
return new ModelSource(lookup, editable);
}
示例3: getImpls
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
@NonNull
private static Collection<? extends CacheFolderProvider> getImpls() {
Lookup.Result<CacheFolderProvider> res = impls.get();
if (res == null) {
final Lookup lkp = new ProxyLookup(
// FIXME: the default Lookup instance changes between users; quick fix is to delegate
// to a dynamic proxy lookup which always delegates to the current default Lookup instance.
// Proper fix is to probably cache a weak(defaultLookup) -> Lookup.Result map - performance
// of the lookup.
Lookups.proxy(new Lookup.Provider() {
@Override
public Lookup getLookup() {
return Lookup.getDefault();
}
}),
Lookups.singleton(DefaultCacheFolderProvider.getInstance()));
res = lkp.lookupResult(CacheFolderProvider.class);
if (!impls.compareAndSet(null, res)) {
res = impls.get();
}
}
return res.allInstances();
}
示例4: setUp
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
lookup = Lookup.EMPTY;
lookupProxy = Lookups.proxy(this);
a1 = context(new SimpleCookieAction(), null, ContextSelection.EXACTLY_ONE, lookupProxy, Openable.class);
a2 = context(new SimpleCookieAction(), this, ContextSelection.ANY, lookupProxy, Openable.class);
any = context(new SimpleCookieAction(), null, ContextSelection.ANY, lookupProxy, Openable.class);
each = context(new SimpleCookieAction(), null, ContextSelection.EACH, lookupProxy, Openable.class);
all = context(new SimpleCookieAction(), null, ContextSelection.ALL, lookupProxy, Openable.class);
n1 = new LookupWithOpenable();
n2 = new LookupWithOpenable();
n3 = new LookupWithOpenable(false);
n4 = new LookupWithOpenable(n1.lookup(Openable.class)); // share the same cookie instance with n1
SimpleCookieAction.runOn.clear();
}
示例5: NavigatorController
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
/** Creates a new instance of NavigatorController */
public NavigatorController(NavigatorDisplayer navigatorTC) {
this.navigatorTC = navigatorTC;
clientsLookup = new ClientsLookup();
panelLookup = Lookups.proxy(new PanelLookupWrapper());
panelLookupWithNodes = new PanelLookupWithNodes();
panelLookupListener = new PanelLookupListener();
navigatorTC.addPropertyChangeListener(this);
//Add listener on custom topComponent - NavDisplayer navigatorTC doesnt have to be an instance of TopComponent
if (navigatorTC != navigatorTC.getTopComponent()) {
navigatorTC.getTopComponent().addPropertyChangeListener(this);
}
TopComponent.getRegistry().addPropertyChangeListener(this);
installActions();
}
示例6: TopComponentLookup
import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public TopComponentLookup(Class<?> clazz) {
this.clazz = clazz;
lookup = Lookups.proxy(lookupProvider);
update();
}