当前位置: 首页>>代码示例>>Java>>正文


Java Lookups.proxy方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TestCatalogModel.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TestCatalogModel.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:CacheFolderProvider.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ContextActionTest.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:NavigatorController.java

示例6: TopComponentLookup

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public TopComponentLookup(Class<?> clazz) {
    this.clazz = clazz;
    lookup = Lookups.proxy(lookupProvider);
    update();
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:6,代码来源:LookupUtils.java


注:本文中的org.openide.util.lookup.Lookups.proxy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。