/** 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 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); } }
/** A lookup attaches to this object. */ final synchronized void attach(AbstractLookup al) { if (this.al == null) { this.al = al; ArrayList<Pair> ep = getEarlyPairs(); if (ep != null) { notifyIn = null; setPairs(ep); } } else { throw new IllegalStateException( "Trying to use content for " + al + " but it is already used for " + this.al ); // NOI18N } }
/** 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); } }
/** A lookup attaches to this object. */ final synchronized void attach(AbstractLookup al) { if (this.al == null) { this.al = al; ArrayList<Pair> ep = getEarlyPairs(); if (ep != null) { notifyIn = null; setPairs(ep); } } else { throw new IllegalStateException( "Trying to use content for " + al + " but it is already used for " + this.al ); // NOI18N } }
/** A lookup attaches to this object. */ final synchronized void attach(AbstractLookup al) { if (this.al == null) { this.al = al; ArrayList<Pair> ep = getEarlyPairs(); if (ep != null) { notifyIn = null; setPairs(ep); } } else { throw new IllegalStateException( "Trying to use content for " + al + " but it is already used for " + this.al ); // NOI18N } }
/** 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); } }
/** 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); } }