/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.openide.filesystems; /** * Represent subtree. * * There is possible: * */ public final class FileTree { final private FileObject treeRoot; final private Refresh refresh; final private Refresh intrusiveRefresh; /** * @param root means root of subtree and there must be true * that is folder else is returned null * @return instance of FileTree or null */ public static FileTree getInstance (FileObject root) { return (root.isFolder())? new FileTree (root) : null; } private FileTree (FileObject treeRoot) { this.treeRoot = treeRoot; refresh = treeRoot.getTreeRefresh (false); intrusiveRefresh = treeRoot.getTreeRefresh (true); } /** * @return root of subtree */ public FileObject getRoot () { return treeRoot; } /** Add new listener to this subtree * @param fcl the listener */ public void addFileChangeListener (FileChangeListener fcl) { /*missing implementation*/ } /** Remove listener from this subtree * @param fcl the listener */ public void removeFileChangeListener (FileChangeListener fcl) { /*missing implementation*/ } /** * Provide instance of Refresh. * * There is no problem with calling this method from performance point of view but * be aware that usage of Refresh may negatively affect performance * especially if there was requested intrusive refresh method. * * @param intrusive refresh method. If true then refresh method will be implemented * more agresively which means that the whole subtree will be refreshed * even if some FileObjects in subtree doesn't exits or were already garbage collected. * @return instance of Refresh or null which means that * requested refresh method isn't supported. */ public Refresh getRefresh (boolean intrusive) { return (intrusive) ? intrusiveRefresh : refresh; } /** * Refresh of subtree */ public interface Refresh extends Runnable, FileSystem.AtomicAction{} }