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


Java LookupListener.resultChanged方法代码示例

本文整理汇总了Java中org.openide.util.LookupListener.resultChanged方法的典型用法代码示例。如果您正苦于以下问题:Java LookupListener.resultChanged方法的具体用法?Java LookupListener.resultChanged怎么用?Java LookupListener.resultChanged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.util.LookupListener的用法示例。


在下文中一共展示了LookupListener.resultChanged方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ComponentBreakpointActionProvider

import org.openide.util.LookupListener; //导入方法依赖的package包/类
public ComponentBreakpointActionProvider() {
    final Result<Node> nodeLookupResult = Utilities.actionsGlobalContext().lookupResult(Node.class);
    LookupListener ll = new LookupListener() {
        @Override
        public void resultChanged(LookupEvent ev) {
            Collection<? extends Node> nodeInstances = nodeLookupResult.allInstances();
            for (Node n : nodeInstances) {
                JavaComponentInfo ci = n.getLookup().lookup(JavaComponentInfo.class);
                if (ci != null) {
                    setEnabled(ActionsManager.ACTION_TOGGLE_BREAKPOINT, true);
                    return ;
                }
            }
            setEnabled(ActionsManager.ACTION_TOGGLE_BREAKPOINT, false);
        }
    };
    nodeLookupResult.addLookupListener(ll);
    ll.resultChanged(null); // To initialize
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ComponentBreakpointActionProvider.java

示例2: resultChanged

import org.openide.util.LookupListener; //导入方法依赖的package包/类
@Override
public void resultChanged(LookupEvent ev) {
    synchronized (PathLookupResult.this) {
        items = null;
    }
    List<LookupListener> lls;
    synchronized (listeners) {
        if (listeners.isEmpty()) {
            return;
        } else {
            lls = new ArrayList<LookupListener>(listeners);
        }
    }
    LookupEvent lev = new LookupEvent(PathLookupResult.this);
    for (LookupListener ll : lls) {
        ll.resultChanged(lev);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:PathLookup.java

示例3: createURLStreamHandler

import org.openide.util.LookupListener; //导入方法依赖的package包/类
public @Override synchronized URLStreamHandler createURLStreamHandler(final String protocol) {
    if (STANDARD_PROTOCOLS.contains(protocol)) {
        // Well-known handlers in JRE. Do not try to initialize lookup.
        return null;
    }
    if (!results.containsKey(protocol)) {
        final Lookup.Result<URLStreamHandler> result = Lookups.forPath("URLStreamHandler/" + protocol).lookupResult(URLStreamHandler.class);
        LookupListener listener = new LookupListener() {
            public @Override void resultChanged(LookupEvent ev) {
                synchronized (ProxyURLStreamHandlerFactory.this) {
                    Collection<? extends URLStreamHandler> instances = result.allInstances();
                    handlers.put(protocol, instances.isEmpty() ? null : instances.iterator().next());
                }
            }
        };
        result.addLookupListener(listener);
        listener.resultChanged(null);
        results.put(protocol, result);
    }
    return handlers.get(protocol);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:ProxyURLStreamHandlerFactory.java

示例4: run

import org.openide.util.LookupListener; //导入方法依赖的package包/类
public void run() {
    Iterator it = evAndListeners.iterator();
    while (it.hasNext()) {
        LookupEvent ev = (LookupEvent)it.next();
        LookupListener l = (LookupListener)it.next();
        try {
            l.resultChanged(ev);
        } catch (RuntimeException x) {
            LOG.log(Level.WARNING, null, x);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:AbstractLookup.java

示例5: resultChanged

import org.openide.util.LookupListener; //导入方法依赖的package包/类
@Override
public void resultChanged(LookupEvent ev) {
    if (ev.getSource() == nodes) {
        Collection<? extends Item<Provider>> arr = nodes.allItems();
        if (arr.size() == 1 && arr.iterator().next().getInstance() == null) {
            return;
        }
        initValues();
        return;
    }
    final LookupEvent mev = new LookupEvent(this);
    for (LookupListener ll : listeners) {
        ll.resultChanged(mev);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ContextManager.java

示例6: checkLookup

import org.openide.util.LookupListener; //导入方法依赖的package包/类
/** Checks whether we still delegate to the same lookup */
private Lookup checkLookup() {
    Lookup l = provider.getLookup();

    // iterator over Reference (ProxyResult)
    Iterator<Reference<ProxyResult<?>>> toCheck = null;

    synchronized (this) {
        if (l != delegate) {
            this.delegate = l;

            if (results != null) {
                toCheck = new ArrayList<Reference<ProxyResult<?>>>(results.values()).iterator();
            }
        }
    }

    if (toCheck != null) {
        // update
        ArrayList<Object> evAndListeners = new ArrayList<Object>();
        for (Iterator<Reference<ProxyResult<?>>> it = toCheck; it.hasNext(); ) {
            java.lang.ref.Reference<ProxyResult<?>> ref = it.next();
            if (ref == null) {
                continue;
            }

            ProxyResult<?> p = ref.get();

            if (p != null && p.updateLookup(null, null)) {
                p.collectFires(evAndListeners);
            }
        }

        for (Iterator it = evAndListeners.iterator(); it.hasNext(); ) {
            LookupEvent ev = (LookupEvent)it.next();
            LookupListener ll = (LookupListener)it.next();
            ll.resultChanged(ev);
        }
    }
    return l;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:SimpleProxyLookup.java


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