/** Factory method to create new, general purpose cookie set. * The <q>general purpose</q> means that it is possible to store * any object, into the cookie set and then obtain it using {@link #getLookup} * and queries on the returned {@link Lookup}. The before object can * be passed in if one wants to do a lazy initialization of the {@link CookieSet} * content. * * @param before the interface to support lazy initialization * @return new cookie set that can contain not only {@link Node.Cookie} but also * any plain old java object * @see #assign * @since 7.0 */ public static CookieSet createGeneric(Before before) { CookieSetLkp al = new CookieSetLkp(before); return new CookieSet(al, al); }
/** Get the cookie set. * * @return the cookie set created by {@link #setCookieSet}, or an empty set (never <code>null</code>) * @exception IllegalStateException If you pass a Lookup instance into the constructor, this * method cannot be called. */ protected final CookieSet getCookieSet() { if (internalLookup(false) != null) { throw new IllegalStateException("CookieSet cannot be used when lookup is associated with the node"); // NOI18N } CookieSet s = (CookieSet) lookup; if (s != null) { return s; } synchronized (this) { if (lookup != null) { return (CookieSet) lookup; } // sets empty sheet and adds a listener to it setCookieSet(new CookieSet()); return (CookieSet) lookup; } }
private static final org.openide.nodes.CookieSet getCookieSet (MultiDataObject obj) { try { if (getCookieSetMethod == null) { getCookieSetMethod = MultiDataObject.class.getDeclaredMethod ("getCookieSet", new Class[] { }); // NOI18N getCookieSetMethod.setAccessible (true); } return (org.openide.nodes.CookieSet) getCookieSetMethod.invoke (obj, new Object[] { }); } catch (Exception e) { ErrorManager.getDefault().notify(e); return new org.openide.nodes.CookieSet (); } }
/** Get the set of cookies. * If the set had been * previously set by {@link #setCookieSet}, that set * is returned. Otherwise an empty set is * returned. * * @return the cookie set (never <code>null</code>) */ protected final CookieSet getCookieSet () { CookieSet s = cookieSet; if (s != null) return s; synchronized (cookieSetLock) { if (cookieSet != null) return cookieSet; // sets empty sheet and adds a listener to it setCookieSet (new CookieSet (), false); return cookieSet; } }
/** Get the cookie set. * * @return the cookie set created by {@link #setCookieSet}, or an empty set (never <code>null</code>) * @exception IllegalStateException If you pass a Lookup instance into the constructor, this * method cannot be called. */ protected final CookieSet getCookieSet () { if (internalLookup (false) != null) { throw new IllegalStateException ("CookieSet cannot be used when lookup is associated with the node"); // NOI18N } CookieSet s = (CookieSet)lookup; if (s != null) return s; synchronized (this) { if (lookup != null) return (CookieSet)lookup; // sets empty sheet and adds a listener to it setCookieSet (new CookieSet ()); return (CookieSet)lookup; } }
/** Get the cookie set. * * @return the cookie set created by {@link #setCookieSet}, or an empty set (never <code>null</code>) * @exception IllegalStateException If you pass a Lookup instance into the constructor, this * method cannot be called. */ protected final CookieSet getCookieSet () { if (internalLookup (false) != null) { throw new IllegalStateException ("CookieSet cannot be used when lookup is associated with the node"); // NOI18N } CookieSet s = (CookieSet)lookup; if (s != null) return s; synchronized (this) { if (lookup != null) return (CookieSet)lookup; // sets empty sheet and adds a listener to it setCookieSet (new CookieSet ()); return (CookieSet)lookup; } }