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


##########
ide/projectui/src/org/netbeans/modules/project/ui/groups/OpenFolderAsGroupAction.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.project.ui.groups;
+
+import java.awt.HeadlessException;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import javax.swing.JFileChooser;
+import org.netbeans.spi.project.ui.support.ProjectChooser;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionRegistration;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle.Messages;
+
+@ActionID(
+        category = "Project",
+        id = "org.netbeans.modules.project.ui.groups.OpenFolderAsGroupAction"
+)
+@ActionRegistration(
+        displayName = "#CTL_OpenFolderAsGroupAction",
+        lazy = true, asynchronous = true
+)
+@ActionReference(path = "Menu/File", position = 1200, separatorAfter = 1250)

Review Comment:
   
   
   @lahodaj [provided a 
feedback](https://github.com/apache/netbeans/pull/9650#issuecomment-5936102979) 
that touches fundamantal questions of UX and I believe it's better to be 
discussed in this PoC PR. Replying here...
    
   > I assume the end goal here is to achieve the "Open Folder"/"Add to 
Workspace" actions, as mentioned in the recent e-mail. I do wholeheartedly 
agree with adding (some) support for "workspaces" (i.e. ability to work without 
projects, or without specifying projects one-by-one).
   
   Great, that's indeed the goal of this PR.
   
   ### Add to Workspace Action
    
   > I think I would first try to implement the actions, and from that it would 
lead what API changes are needed (I suspect some will be needed). #9631 
implemented the Open Folder as Workspace action, but not the Add to Workspace 
action; and also the resulting UI is I think not ideal: when I do "Open Folder 
as Workspace", 
   
   OK, it is let's try to implement _"Add to Workspace"_ action. That's a 
natural continuation of the work done in this PR so far.
   
   
   ### Opening Nested Projects
   
   > would I really expect to see all the nested projects in the Projects tab? 
(I realize this is a consequence of reusing the Project Groups directly, but a 
novice user is likely to be confused by this, I think.) OTOH, I do agree it 
would be good to open the projects under the workspace folder.
   
   - Yes, opening **all the projects** under the workspace folder is a concern
     - Pointed out by https://github.com/apache/netbeans-vscode/pull/36 where 
an explicitly stated goal mentions:
       - modify the system to **not open all the NetBeans projects at once**
     - Also raised by  @matthiasblaesing few times (for example 
[here](https://github.com/apache/netbeans/pull/9592#issuecomment-5536301353)) 
and also in his 
[email](https://lists.apache.org/thread.html/rvhxgctxptmm963mw169szpco0lrfqjn)
   - on the other hand, **opening some projects** is the current behavior and 
as @svenreimers [points 
out](https://lists.apache.org/thread.html/6lc0mc7kjpg5odoq3pwyzky3y9skns63): 
_"Would be good to be helpful in most cases without killing the others.."_
   - I have to say I don't know how a good UI bringing such a _"helpful without 
killing"_ experience shall look like?
    
   >  some part of the system would, when a project matching the workspace 
folder directory opens, scan the given folder and open all nested projects
   
   - right now there are _too many parts_ in the system scanning a folder
      - There is `org.netbeans.modules.versioning.util.projects.ProjectOpener` 
which [scans for just clonned 
projects](https://cwiki.apache.org/confluence/download/attachments/446071397/image-2026-9-9_11-26-31.png?version=1&modificationDate=1788945991000&api=v2)
      - There is the directory group scan: 
https://cwiki.apache.org/confluence/download/attachments/446071397/image-2026-9-9_11-26-31.png?version=1&modificationDate=1788945991000&api=v2
      - there is the LSP scan: 
https://github.com/apache/netbeans/blob/2c328a171d962cda000bba75568e83b685806885/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/Server.java#L755
      - ... which also does quite an _inefficient priming_ of the projects
   - most of them are doing it sub-optimally as they _cannot use internals_ as 
https://github.com/apache/netbeans/blob/2c328a171d962cda000bba75568e83b685806885/ide/projectui/src/org/netbeans/modules/project/ui/LazyProject.java#L51
 can
   - my goal is to unify that: have a single implementation to **open a project 
folder and scan it** that would be as effective as [opening projects after 
NetBeans IDE 
startup](https://github.com/apache/netbeans/blob/2c328a171d962cda000bba75568e83b685806885/ide/projectui/src/org/netbeans/modules/project/ui/LazyProject.java#L51)
   
   ### Helpful without Killing
   
   > there could be a UI tweak to not show these projects, unless explicitly 
open by the user; this is probably the trickiest part to implement, and would 
probably need an API
   
   Yes, this is the crucial part! How could such a UI tweak look like? Also: 
the problem isn't to show the projects, but to initialize them! But without 
initializing, the IDE cannot provide essential cross project functionality 
(find usages, go to...). It is certainly the trickiest part.
   
   As this is the PoC UX PR: how do you want such a "UI tweak" to behave, 
@lahodaj?
   
   
   
   



-- 
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