Cache newCache = new Cache(uniqueEntries); lastModification = root.lastModified(); strongCache = newCache;
/** refreshes children recursively.*/ private void refreshExistingFileObjects() { Cache cache = getCache(); String[] empty = new String[0]; Enumeration<? extends FileObject> en = existingFileObjects(getRoot()); while (en.hasMoreElements()) { AbstractFolder fo = (AbstractFolder) en.nextElement(); assert fo != null; if (fo.isFolder() && !fo.isInitialized()) { continue; } String[] children = cache.getChildrenOf(fo.getPath()); if (children == null) { children = empty; } fo.refresh(null, null, true, true, children); } }
private void parse(Set<JarEntry> entries) { folders.put("", new Folder()); // root folder for (JarEntry entry : entries) { String name = entry.getName(); boolean isFolder = false; // work only with slashes name = name.replace('\\', '/'); if (name.startsWith("/")) { name = name.substring(1); // NOI18N } if (name.endsWith("/")) { name = name.substring(0, name.length() - 1); // NOI18N isFolder = true; } int lastSlash = name.lastIndexOf('/'); String dirName = ""; // root String realName = name; if (lastSlash > 0) { dirName = name.substring(0, lastSlash); // or folder realName = name.substring(lastSlash + 1); } if (isFolder) { getFolder(name); // will create the folder item } else { Folder fl = getFolder(dirName); fl.addChild(realName); } } }
Cache newCache = new Cache(en); lastModification = root.lastModified(); strongCache = newCache;
Cache newCache = new Cache(en); lastModification = root.lastModified(); strongCache = newCache;
private Folder getFolder(String name) { Folder fl = (Folder)folders.get(name); if (fl == null) { // add all the superfolders on the way to the root int lastSlash = name.lastIndexOf('/'); String dirName = ""; // root String realName = name; if (lastSlash > 0) { dirName = name.substring(0, lastSlash); // or folder realName = name.substring(lastSlash+1); } getFolder(dirName).addChild(realName); fl = new Folder(); folders.put(name, fl); } return fl; }
private Folder getFolder(String name) { Folder fl = (Folder)folders.get(name); if (fl == null) { // add all the superfolders on the way to the root int lastSlash = name.lastIndexOf('/'); String dirName = ""; // root String realName = name; if (lastSlash > 0) { dirName = name.substring(0, lastSlash); // or folder realName = name.substring(lastSlash+1); } getFolder(dirName).addChild(realName); fl = new Folder(); folders.put(name, fl); } return fl; }
/** refreshes children recursively.*/ private void refreshExistingFileObjects () { Cache cache = getCache(); String[] empty = new String[0]; Enumeration en = existingFileObjects (getRoot ()); while (en.hasMoreElements()) { AbstractFolder fo = (AbstractFolder)en.nextElement(); assert fo != null; if (fo.isFolder() && !fo.isInitialized()) continue; String[] children = cache.getChildrenOf(fo.getPath()); if (children == null) children = empty; fo.refresh(null,null,true,true,children); } }
/** refreshes children recursively.*/ private void refreshExistingFileObjects () { Cache cache = getCache(); String[] empty = new String[0]; Enumeration en = existingFileObjects (getRoot ()); while (en.hasMoreElements()) { AbstractFolder fo = (AbstractFolder)en.nextElement(); assert fo != null; if (fo.isFolder() && !fo.isInitialized()) continue; String[] children = cache.getChildrenOf(fo.getPath()); if (children == null) children = empty; fo.refresh(null,null,true,true,children); } }
protected String[] children (String name) { Cache cache = getCache(); return cache.getChildrenOf(name); }
protected String[] children (String name) { Cache cache = getCache(); return cache.getChildrenOf(name); }
protected boolean folder (String name) { if ("".equals (name)) return true; // NOI18N Cache cache = getCache(); return cache.isFolder(name); }
protected boolean folder (String name) { if ("".equals (name)) return true; // NOI18N Cache cache = getCache(); return cache.isFolder(name); }
private Folder getFolder(String name) { Folder fl = folders.get(name); if (fl == null) { // add all the superfolders on the way to the root int lastSlash = name.lastIndexOf('/'); String dirName = ""; // root String realName = name; if (lastSlash > 0) { dirName = name.substring(0, lastSlash); // or folder realName = name.substring(lastSlash + 1); } getFolder(dirName).addChild(realName); fl = new Folder(); folders.put(name, fl); } return fl; }
protected String[] children(String name) { Cache cache = getCache(); return cache.getChildrenOf(name); }