/** 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 } }
private void refresh(FileEvent ev) { if (!(ev.getFile().getPath() + "/").startsWith(path)) { return; } List<FOItem> items = new ArrayList<FOItem>(); Lookup[] delegates = computeDelegates(path, items, lkp); this.content.setPairs(order(items)); this.setLookups(delegates); }
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); }
/** 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 } }