diff -r a64e5904bbb7 projectapi/src/org/netbeans/modules/projectapi/SimpleFileOwnerQueryImplementation.java --- a/projectapi/src/org/netbeans/modules/projectapi/SimpleFileOwnerQueryImplementation.java Mon Jun 16 19:32:53 2008 +0200 +++ b/projectapi/src/org/netbeans/modules/projectapi/SimpleFileOwnerQueryImplementation.java Fri Jun 20 16:09:14 2008 +0200 @@ -54,6 +54,9 @@ import java.util.Map; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.prefs.Preferences; import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectManager; import org.netbeans.spi.project.FileOwnerQueryImplementation; @@ -61,6 +64,7 @@ import org.openide.filesystems.FileObjec import org.openide.filesystems.FileObject; import org.openide.filesystems.FileStateInvalidException; import org.openide.filesystems.URLMapper; +import org.openide.util.NbPreferences; import org.openide.util.Utilities; import org.openide.util.WeakSet; @@ -172,8 +176,26 @@ public class SimpleFileOwnerQueryImpleme private static final Map> project2External = Collections.synchronizedMap(new WeakHashMap>()); + static { + try { + Preferences p = NbPreferences.forModule(SimpleFileOwnerQueryImplementation.class).node("externalOwners"); + for (String name : p.keys()) { + URL u = new URL(p.get(name, null)); + URI i = new URI(name); + externalOwners.put(i, new WeakReference(URLMapper.findFileObject(u))); + } + } catch (Exception ex) { + Logger.getLogger(SimpleFileOwnerQueryImplementation.class.getName()).log(Level.WARNING, null, ex); + } + } + /** @see FileOwnerQuery#reset */ public static void reset() { + try { + NbPreferences.forModule(SimpleFileOwnerQueryImplementation.class).node("externalOwners").removeNode(); + } catch (Exception ex) { + Logger.getLogger(SimpleFileOwnerQueryImplementation.class.getName()).log(Level.WARNING, null, ex); + } externalOwners.clear(); } @@ -194,7 +216,13 @@ public class SimpleFileOwnerQueryImpleme public static void markExternalOwnerTransient(URI root, Project owner) { externalRootsIncludeNonFolders |= !root.getPath().endsWith("/"); if (owner != null) { - externalOwners.put(root, new WeakReference(owner.getProjectDirectory())); + FileObject fo = owner.getProjectDirectory(); + externalOwners.put(root, new WeakReference(fo)); + try { + NbPreferences.forModule(SimpleFileOwnerQueryImplementation.class).node("externalOwners").put(root.toString(), fo.getURL().toExternalForm()); + } catch (Exception ex) { + Logger.getLogger(SimpleFileOwnerQueryImplementation.class.getName()).log(Level.WARNING, null, ex); + } synchronized (project2External) { FileObject prjDir = owner.getProjectDirectory(); Collection roots = project2External.get (prjDir);