/** Folder is recognized as underlying <code>FolderLookup</code> which passes * its items to parent <code>FolderLookup</code>. * @param df the folder found * @return new FolderLookup */ protected InstanceCookie acceptFolder (DataFolder df) { return new FolderLookup(df, objectName(rootName, df), false); }
/** Mostly for testing purposes, to allow the tests to wait * for the scan to finished after deserialization. */ public void waitFinished () { fl.waitFinished (); }
final Lookup findServicesLookup() { StartLog.logProgress("Got Services folder"); // NOI18N DataFolder servicesF; try { // mark as registered, they will be added in taskFinished listenersRegistered = true; servicesF = findServicesFolder(); org.openide.loaders.FolderLookup f = new org.openide.loaders.FolderLookup(servicesF, "SL["); f.addTaskListener(this); return f.getLookup(); } catch (Exception e) { Exceptions.printStackTrace(e); return Lookup.EMPTY; } finally { StartLog.logProgress("created FolderLookup"); // NOI18N } }
public static void loadLayerActions(String path, ArrayList lst) { try { FileObject fo = Repository.getDefault().getDefaultFileSystem().findResource(path); // NOI18N if (fo != null) { DataObject dobj = DataObject.find(fo); FolderLookup actionRegistry = new FolderLookup((DataFolder)dobj); Lookup.Template query = new Lookup.Template(Object.class); Lookup lookup = actionRegistry.getLookup(); Iterator it2 = lookup.lookup(query).allInstances().iterator(); if (it2.hasNext()) { lst.add(null); } while (it2.hasNext()) { Object next = it2.next(); if (next instanceof Action) { lst.add(next); } else if (next instanceof JSeparator) { lst.add(null); } } } } catch (DataObjectNotFoundException ex) { // data folder for existing fileobject expected ErrorManager.getDefault().notify(ex); } }
/** Container is recognized as underlying <code>FolderLookup</code> which passes * its items to parent <code>FolderLookup</code>. * @param df the container found * @return new FolderLookup */ protected InstanceCookie acceptContainer (DataObject.Container df) { return new FolderLookup( df, rootName == null ? "<container>" : rootName + "<container>", // NOI18N false ); }
/** Waits before the processing of changes is finished. */ protected void beforeLookup (Template template) { if (readFromStream) { // ok return; } // do not wait in folder recognizer, but in all other cases if (!FolderList.isFolderRecognizerThread () && ICItem.DANGEROUS.get () == null) { fl.instanceFinished (); } }
/** * Getter for the lookup that should be used. * <p>Serializable since 3.27. * @return a lookup */ public final Lookup getLookup () { boolean inited = false; synchronized(LOCK) { if(lookup == null) { lookup = new ProxyLkp(this); inited = true; } } if(inited) { checkRecreate(); } return lookup; }
/** 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 }
private static void exception(Exception e, FileObject fo) { ErrorManager.getDefault().annotate(e, ErrorManager.UNKNOWN, "Bad file: " + fo, null, null, null); // NOI18N exception(e); }
private void readObject (ObjectInputStream ois) throws IOException, ClassNotFoundException { List ls = new ArrayList(); // List<Lookup> Lookup l; while ((l = (Lookup)ois.readObject()) != null) { ls.add(l); } Lookup[] arr = (Lookup[])ls.toArray(new Lookup[ls.size()]); DataFolder df = (DataFolder)ois.readObject (); String root = (String)ois.readObject (); fl = new FolderLookup (df, root, true); fl.lookup = this; content = (AbstractLookup.Content)ois.readObject (); setLookups (arr); readFromStream = true; org.openide.util.RequestProcessor.getDefault ().post (fl, 0, Thread.MIN_PRIORITY); }