/** The method to add a pair to the associated {@link AbstractLookup}. * Preferably call this method when lookup is already associated with * this <em>content</em> (association is done by passing this object to some * {@link AbstractLookup#AbstractLookup(org.openide.util.lookup.AbstractLookup.Content) AbstractLookup's constructor} * once). * * @param pair class/instance pair * @throws NullPointerException may throw NullPointerException if called * before association with {@link AbstractLookup} */ public final void addPair(Pair<?> pair) { AbstractLookup a = al; Executor e = getExecutor(); if (a != null || e != null) { if (a == null) { throw new NullPointerException( "Adding a pair to Content not connected to Lookup is not supported!" // NOI18N ); } a.addPair(pair, e); } else { if (notifyIn == null) { notifyIn = new ArrayList<Pair>(3); } getEarlyPairs().add(pair); } }
/** Remove instance. * @param pair class/instance pair */ public final void removePair(Pair<?> pair) { AbstractLookup a = al; Executor e = getExecutor(); if (a != null || e != null) { a.removePair(pair, e); } else { if (notifyIn == null) { notifyIn = new ArrayList<Pair>(3); } getEarlyPairs().remove(pair); } }
/** Changes all pairs in the lookup to new values. * @param c the collection of (Pair) objects */ public final void setPairs(Collection<? extends Pair> c) { AbstractLookup a = al; Executor e = getExecutor(); if (a != null || e != null) { a.setPairs(c, e); } else { notifyIn = new ArrayList<Pair>(c); } }
/** The method to add a pair to the associated {@link AbstractLookup}. * Preferably call this method when lookup is already associated with * this <em>content</em> (association is done by passing this object to some * {@link AbstractLookup#AbstractLookup(org.openide.util.lookup.AbstractLookup.Content) AbstractLookup's constructor} * once). * * @param pair class/instance pair * @throws NullPointerException may throw NullPointerException if called * before association with {@link AbstractLookup} */ public final void addPair(Pair<?> pair) { AbstractLookup a = al; Executor e = getExecutor(); if (a != null || e != null) { if (a == null) { throw new NullPointerException( "Adding a pair to Content not connected to Lookup is not supported!" // NOI18N ); } a.addPair(pair, e); } else { if (notifyIn == null) { notifyIn = new ArrayList<Pair>(3); } getEarlyPairs().add(pair); } }
/** Remove instance. * @param pair class/instance pair */ public final void removePair(Pair<?> pair) { AbstractLookup a = al; Executor e = getExecutor(); if (a != null || e != null) { a.removePair(pair, e); } else { if (notifyIn == null) { notifyIn = new ArrayList<Pair>(3); } getEarlyPairs().remove(pair); } }
/** Remove instance. * @param pair class/instance pair */ public final void removePair(Pair<?> pair) { AbstractLookup a = al; Executor e = getExecutor(); if (a != null || e != null) { a.removePair(pair, e); } else { if (notifyIn == null) { notifyIn = new ArrayList<Pair>(3); } getEarlyPairs().remove(pair); } }
/** The method to add instance to the lookup with. * @param pair class/instance pair */ public final void addPair(Pair<?> pair) { AbstractLookup a = al; Executor e = getExecutor(); if (a != null || e != null) { a.addPair(pair, e); } else { if (notifyIn == null) { notifyIn = new ArrayList<Pair>(3); } getEarlyPairs().add(pair); } }
/** Changes all pairs in the lookup to new values. * @param c the collection of (Pair) objects */ public final void setPairs(Collection<? extends Pair> c) { AbstractLookup a = al; Executor e = getExecutor(); if (a != null || e != null) { a.setPairs(c, e); } else { notifyIn = new ArrayList<Pair>(c); } }
/** Changes all pairs in the lookup to new values. * @param c the collection of (Pair) objects */ public final void setPairs(Collection<? extends Pair> c) { AbstractLookup a = al; Executor e = getExecutor(); if (a != null || e != null) { a.setPairs(c, e); } else { notifyIn = new ArrayList<Pair>(c); } }