1 19 20 package org.netbeans.core.filesystems; 21 22 import java.io.*; 23 import java.util.*; 24 25 import org.xml.sax.*; 26 import org.xml.sax.helpers.*; 27 28 import org.openide.cookies.InstanceCookie; 29 import org.openide.loaders.*; 30 import org.openide.filesystems.*; 31 import org.openide.util.*; 32 import org.openide.util.lookup.*; 33 import org.openide.xml.*; 34 import org.openide.*; 35 36 51 class XMLEnvironmentProvider extends SharedClassObject { 52 53 private static final long serialVersionUID = 18947L; 54 55 private static transient Map<FileObject, Lookup> envs = new HashMap<FileObject, Lookup>(11); 57 59 62 public final Lookup getEnvironment(DataObject obj){ 63 64 66 68 FileObject file = obj.getPrimaryFile(); 69 Lookup lookup = envs.get(file); 70 if (lookup == null) { 71 lookup = createLookup(obj); 72 envs.put(file, lookup); 73 } 74 return lookup; 75 76 } 77 78 83 protected InstanceContent createInstanceContent(DataObject obj) { 84 return new InstanceContent(); 85 } 86 87 92 protected Lookup createLookup(DataObject obj) { 93 InstanceContent ic = createInstanceContent(obj); 94 Lookup lookup = new AbstractLookup(ic); 95 if (lookup.lookup(InstanceCookie.class) == null) { 96 Exceptions.printStackTrace(new IllegalStateException ()); } 98 return lookup; 99 } 100 101 } 102 | Popular Tags |