This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 124975 - Allow a temporary project to be replaced by real one
Summary: Allow a temporary project to be replaced by real one
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: apireviews
URL:
Keywords: API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2008-01-09 16:13 UTC by Jaroslav Tulach
Modified: 2008-01-09 20:02 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed functional behaviour change (8.55 KB, patch)
2008-01-09 16:32 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2008-01-09 16:13:13 UTC
I need to write a factory that produces projects, so that:

p = projectManager.findProject(dir);
// this is mine project

// now something happens, so discard the project
p2 = projectManager.findProject(dir);

assert p != p2;

I tried to use projectManager.clearNonProjectCache(), however that does not seem to really work.
Comment 1 Jaroslav Tulach 2008-01-09 16:32:10 UTC
Created attachment 54879 [details]
Proposed functional behaviour change
Comment 2 Jaroslav Tulach 2008-01-09 16:33:20 UTC
Unless somebody objects, I'd like to integrate a change like this next week.
Comment 3 Jan Lahoda 2008-01-09 17:12:37 UTC
A few comments:
-I do not think this is a semantically compatible change (IIRC the PM.clearNonProjectCache method is called on quite a
few occasions, and any currently existing project that have simple name containing NonProject would be discarded).
-the PM contains a cache of folders that are known not to contain a project - the clearNonProjectCache method (as name
suggests) clears this cache. Using this method to clear the temporary projects seems to overload the meaning of this method.
Comment 4 Jan Lahoda 2008-01-09 17:17:16 UTC
BTW: why is ProjectState.notifyDeleted unusable in this case?
Comment 5 Jaroslav Tulach 2008-01-09 20:02:33 UTC
And some people say that reviews are not useful! notifyDeleted() it the call I've been looking for:

Index: autoupdate/featureondemand/src/org/netbeans/modules/featureondemand/FeatureProjectFactory.java
--- autoupdate/featureondemand/src/org/netbeans/modules/featureondemand/FeatureProjectFactory.java Base (1.1.2.6)
+++ autoupdate/featureondemand/src/org/netbeans/modules/featureondemand/FeatureProjectFactory.java Locally Modified 
(Based On 1.1.2.6)
@@ -98,7 +98,7 @@
                             break;
                         }
                     }
-                    return new FeatureNonProject(projectDirectory, pt2m);
+                    return new FeatureNonProject(projectDirectory, pt2m, state);
                 }
             }
         }
@@ -112,12 +112,14 @@
         private final FileObject dir;
         private final FeatureInfo info;
         private final Lookup lookup;
+        private final ProjectState state;
         private boolean success = false;
 
-        public FeatureNonProject(FileObject dir, FeatureInfo info) {
+        public FeatureNonProject(FileObject dir, FeatureInfo info, ProjectState state) {
             this.dir = dir;
             this.info = info;
             this.lookup = Lookups.singleton(this);
+            this.state = state;
         }
         
         public FileObject getProjectDirectory() {
@@ -134,7 +136,7 @@
             OpenProjects.getDefault().close(new Project[] { this });
             if (success) {
                 try {
-                    ProjectManager.getDefault().clearNonProjectCache();
+                    state.notifyDeleted();
                     Project p = ProjectManager.getDefault().findProject(getProjectDirectory());
                     if (p == this) {
                         throw new IllegalStateException("New project shall be found! " + p);