Search in sources :

Example 1 with ProxyLookup

use of org.openide.util.lookup.ProxyLookup in project ACS by ACS-Community.

the class TopComponent method getLookup.

/** Gets lookup which represents context of this component. By default
     * the lookup delegates to result of <code>getActivatedNodes</code>
     * method and result of this component <code>ActionMap</code> delegate.
     *
     * @return a lookup with designates context of this component
     * @see org.openide.util.ContextAwareAction
     * @see org.openide.util.Utilities#actionsToPopup(Action[], Lookup)
     * @since 3.29
     */
public Lookup getLookup() {
    synchronized (defaultLookupLock) {
        Object l = defaultLookupRef.get();
        if (l instanceof Lookup) {
            return (Lookup) l;
        }
        Lookup lookup = new ProxyLookup(new Lookup[] { // Lookup of activated nodes.
        new DefaultTopComponentLookup(this), // Action map lookup.
        Lookups.singleton(new DelegateActionMap(this)) });
        defaultLookupRef = new java.lang.ref.WeakReference(lookup);
        return lookup;
    }
}
Also used : ProxyLookup(org.openide.util.lookup.ProxyLookup) Lookup(org.openide.util.Lookup) WeakReference(java.lang.ref.WeakReference) ProxyLookup(org.openide.util.lookup.ProxyLookup)

Aggregations

WeakReference (java.lang.ref.WeakReference)1 Lookup (org.openide.util.Lookup)1 ProxyLookup (org.openide.util.lookup.ProxyLookup)1