private OverFiles(String path, List<FOItem> items, AbstractLookup lkp, AbstractLookup.Content cnt) { super(computeDelegates(path, items, lkp)); this.path = path; this.lkp = lkp; this.content = cnt; this.content.setPairs(order(items)); FileSystem fs = null; try { fs = FileUtil.getConfigRoot().getFileSystem(); } catch (FileStateInvalidException ex) { Exceptions.printStackTrace(ex); } this.weakL = FileUtil.weakFileChangeListener(this, fs); fs.addFileChangeListener(weakL); }
public OverFiles(String path) { this(path, new ArrayList<FOItem>(), new AbstractLookup.Content()); }
/** 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); } }
AbstractLookup.Content c = new AbstractLookup.Content(); AbstractLookup l = new AbstractLookup(c); c.addPair (new NoNodesPair ()); setLookups (new Lookup[] { l, actionMap }); return;
AbstractLookup.Content c = new AbstractLookup.Content(); AbstractLookup l = new AbstractLookup(c); c.addPair (new NoNodesPair ()); setLookups (new Lookup[] { l, actionMap }); return;
/** 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; if (earlyPairs != null) { // we must just add no override! Pair[] p = (Pair[]) earlyPairs.toArray(new Pair[earlyPairs.size()]); for (int i = 0; i<p.length; i++) { addPair(p[i]); } } earlyPairs = null; } 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 } }
/** Updates internal data. * @param items Items to assign to all pairs * @param lookups delegates to delegate to (first item is null) */ public void update(Collection items, List lookups) { readFromStream = false; // remember the instance lookup Lookup pairs = getLookups ()[0]; // changes the its content content.setPairs (items); if (fl.err().isLoggable(ErrorManager.INFORMATIONAL)) fl.err ().log ("Changed pairs: " + items); // NOI18N lookups.set(0, pairs); Lookup[] arr = (Lookup[])lookups.toArray (new Lookup[lookups.size ()]); setLookups (arr); if (fl.err().isLoggable(ErrorManager.INFORMATIONAL)) fl.err ().log ("Changed lookups: " + lookups); // 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); } }
/** A lookup attaches to this object. */ final synchronized void attach (AbstractLookup al) { if (this.al == null) { this.al = al; if (earlyPairs != null) { // we must just add no override! Pair[] p = (Pair[]) earlyPairs.toArray(new Pair[earlyPairs.size()]); for (int i = 0; i<p.length; i++) { addPair(p[i]); } } earlyPairs = null; } else { throw new IllegalStateException ("Trying to use content for " + al + " but it is already used for " + this.al); // NOI18N } }
/** 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); } }
/** Constructs lookup which holds all items+lookups from underlying world. * @param folder <code>FolderLookup</code> to associate to */ public ProxyLkp(FolderLookup folder) { this(folder, new AbstractLookup.Content()); }
/** Constructor to create this lookup and associate it with given * Content. The content than allows the creator to invoke protected * methods which are not accessible for any other user of the lookup. * * @param content the content to assciate with * * @since 1.25 */ public AbstractLookup(Content content) { content.attach(this); }
/** 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); } }
/** Constructor to create this lookup and associate it with given * Content. The content than allows the creator to invoke protected * methods which are not accessible for any other user of the lookup. * * @param content the content to assciate with * * @since 1.25 */ public AbstractLookup(Content content) { content.attach(this); }
/** Constructor to create this lookup and associate it with given * Content. The content than allows the creator to invoke protected * methods which are not accessible for any other user of the lookup. * * @param content the content to assciate with * * @since 1.25 */ public AbstractLookup (Content content) { content.attach (this); }