1 19 20 package org.netbeans.api.registry.fs; 21 22 import org.netbeans.core.registry.ContextImpl; 23 import org.netbeans.core.registry.ResettableContextImpl; 24 import org.netbeans.spi.registry.BasicContext; 25 import org.openide.ErrorManager; 26 import org.openide.filesystems.FileObject; 27 import org.openide.filesystems.FileStateInvalidException; 28 import org.openide.filesystems.Repository; 29 30 36 public final class FileSystemContextFactory { 37 38 private FileSystemContextFactory() { 39 } 40 41 50 public static BasicContext createContext(FileObject root) { 51 BasicContext rc; 52 boolean isSFS = false; 53 try { 54 isSFS = root.getFileSystem().equals(Repository.getDefault().getDefaultFileSystem()); 55 } catch (FileStateInvalidException ex) { 56 ErrorManager.getDefault().log(ErrorManager.WARNING, ex.toString()); 57 isSFS = false; 58 } 59 if (isSFS) { 60 rc = new ResettableContextImpl(root); 61 } else { 62 rc = new ContextImpl (root); 63 } 64 return rc; 65 } 66 67 } 68 | Popular Tags |