jtulach commented on code in PR #9650:
URL: https://github.com/apache/netbeans/pull/9650#discussion_r4163806867


##########
ide/projectapi.nb/src/org/netbeans/modules/projectapi/nb/NbProjectManager.java:
##########
@@ -489,11 +518,29 @@ public void clearNonProjectCache() {
                 LoadStatus.NO_SUCH_PROJECT.wrap(),
                 LoadStatus.SOME_SUCH_PROJECT.wrap(),
             }));
-            // XXX remove everything too? but then e.g. 
AntProjectFactorySingleton
-            // will stay while its delegates are changed, which does no good
-            // XXX should there be any way to signal that a particular
-            // folder should be "reloaded" by a new factory?
         }
+        MUTEX.postWriteRequest(() -> {
+            synchronized (dir2Proj) {
+                // check if FallbackProject is still needed
+
+                Iterator<Map.Entry<FileObject, Union2<Reference<Project>, 
LoadStatus>>> it = dir2Proj.entrySet().iterator();

Review Comment:
   @lahodaj has 
[suggested](https://github.com/apache/netbeans/pull/9650#issuecomment-5936102979):
   
   > the "workspace folder project" could be created by an ordinary project 
factory, if needed; 
   
   - you are right Jan, it is possible to register a `FallbackProjectFactory` 
with a low priority and basically achieve the same goal this PR is trying to 
achieve
   
   > (the action would mark the directory as "needs workspace project, if 
there's no better" in the userdir, or something alike)
   
   - that's a slight duplication: without access to the internals of this class 
a copy of own `Map` to hold list of "marked fallback projects" is needed
      - but this is a valid API design suggestion, I have to say
      - we could have `ide/project.fallback` module doing that for example
   - however I feel the concept to _"treat every folder as a project"_ is so 
essential (and in fact quite small) that I incline towards keeping it in the 
core `ProjectManager` API
   
   > if there were explicit actions to open a folder as a workspace/add folder 
to a workspace, we wouldn't probably need the fallback API - 
   
   - the "explicit action" proposed by this PR is to call 
`ProjectManager.findProjectOrFallback`
   - e.g. the new _API method is the "explicit action"_
   - such an approach has the benefit of **not prescribing the UI** how it 
should look like
   
   ## TL;DR
   
   I believe the concept to  _"treat every folder as a project"_ is so 
essential, that it deserves its ProjectManager.findProjectOrFallback` method 
even without knowing how its UI usage will look like. That's why I spawned this 
PR out of #9631
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to