Skip to content

More prominent Open Folder (as a group) action - #9631

Open
jtulach wants to merge 3 commits into
apache:masterfrom
jtulach:jtulach/OpenFolderAsGroup
Open

jtulach wants to merge 3 commits into
apache:masterfrom
jtulach:jtulach/OpenFolderAsGroup

Conversation

@jtulach

@jtulach jtulach commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Motivation

  • let me repeat the motivation for this and similar PRs that I am proposing this autumn

Being for Experts

NetBeans has a unique concept of handling projects. It is a completely different workflow than other IDEs are built around. I like it because it is flexible. However it also complicates things - because it is flexible. Projects are stored in Git repositories these days. When opening such a project, it (almost all the time) makes sense to open all the projects in the Git repository. That's not a NetBeans philosophy. NetBeans allows one to cherry pick and open only some of the projects.

Being Different

Such a flexibility makes NetBeans an IDE for experts. However it also comes with a cost. Not only implementation wise (IDE has to be ready for set of projects being "half open"), but also from a UX perspective.

Maybe projects just open on-demand as needed?

Every "expert" has different set of subprojects open and then the behavior of the IDE is different. Such a "magical flexibility" makes the UX poor.

Other IDEs have a concept of workspace. When opening Apache Maven sources in a "workplace", then the IDEs just open all the nested projects in the Apache Maven Git repository.

Simplify UI. Keep Flexibility.

I believe the time has come to straighten the NetBeans IDE position by adjusting to common UX while keeping the flexibility under neath. NetBeans already has a support for groups of projects. Just the UX feels old fashioned and like a second class citizen. I'd like to improve the UX by using the same infrastructure to mimic the concept of a "workspace". Ideally I'd like to rework the File menu to offer Open/Close Folder, Add to Workspace, Save Workspace as just like VSCode File menu provides.

TL;DR

Experts "in the know" can still Open Project... one by one and work only with a properly curated and selected subset. However for clueless users working on an unfamiliar code base, I believe we have to lead the UX towards open all the projects at once.

That is the outline of my plan.

@jtulach jtulach self-assigned this Sep 21, 2026
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setMultiSelectionEnabled(false);
File start = ProjectChooser.getProjectsFolder();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This DirectoryGroupEditPanel already provides support for the Open Folder (as Workspace) functionality. It is just this complex:

Project Groups...

Selecting File / Project Groups... menu item opens a dialog

New group...

The New group... button opens another dialog. One needs to choose Folder of Projects and Browse for it (that opens another dialog):

Browse for a folder

Only then one can click "Create Group" button. Which scans for all the projects in the given folder and opens them in Projects view (after closing all previous ones).

public final class OpenFolderAsGroupAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent ev) {
File dir = showWorkspaceFolderChooser(null, null);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new Open Folder as Workspace... action provides the same function as is currently hidden in the Projects Group... dialog, but it is way more straightforward:

Open Folder (as Workspace)...

Just choose the new action, then select a folder in the file chooser and voilá! No change in NetBeans abilities, ... but now they are exposed to the world the way the (current development) world wants to see them

@neilcsmith-net

neilcsmith-net commented Sep 21, 2026

Copy link
Copy Markdown
Member

Maybe projects just open on-demand as needed?

Every "expert" has different set of subprojects open and then the behavior of the IDE is different. Such a "magical flexibility" makes the UX poor.

This is the second time you've selectively quoted that out of context while misunderstanding what was meant! It was when you wanted to show all sub-projects, whether open or not, in the same tree group. It is not that different to ergonomics, which is great, if/when it works. The UX is only poor when it doesn't work completely transparently. If you think it meant "expert" or that the behaviour of the IDE is different, then we're talking about two opposite things.

Other IDEs have a concept of workspace. When opening Apache Maven sources in a "workplace", then the IDEs just open all the nested projects in the Apache Maven Git repository.

One of the simpler things we could do is also to default the Open Required Project toggle to true on Open Project? Having subprojects not open is more of an "expert" requirement.

The Open Project dialog could also have some group management options, such as open (all) in new group.

We could change the use of the words Project Group to Project Workspace in branding. I don't think mixing the two terms is a good idea for discoverability. Still, I'm also sceptical of doing things just because "other IDEs" do it.

@jtulach

jtulach commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Bunch of good ideas, Neil!

We could change the use of the words Project Group to Project Workspace in branding.
I don't think mixing the two terms is a good idea

  • rebranding is certainly simple - started in d4354beeaf
  • I believe the word Workspace is more genuinely understood ...
  • and better suited to describe the intention than "project group"

One of the simpler things we could do is also to default the Open Required Project toggle to true on Open Project? Having subprojects not open is more of an "expert" requirement.

  • yes, that's exactly the "definition of expert" I had in mind
    • standard and better working behavior should be the default
    • experts can opt-out
  • I'll prepare a PR for the toggle later

The following seems still an open topic:

Maybe projects just open on-demand as needed?
... It was when you wanted to show all sub-projects, whether open or not, in the same tree group. It is not that different to ergonomics, which is great, if/when it works.

  • I managed to convince myself the concept ergonomics can work and it got close to working (most of the time)
    • I am aware of just a few places where it could be made better
  • However there are problems of "open projects on-demand" that I don't understand how to fix:
    • Find usages requires all projects to be open
    • Go to Xyz dialog requires all projects to be open
    • I am all for being lazy/on demand, but I am afraid to break Find Usages and/or Go to dialogs
  • However, thinking about it I realized that there is concept of LazyProject used already on startup
    • however it is only used during startup
    • not when (for example) switching workspaces (project groups)
    • using LazyProject more is probably another thing we shall improve (in a separate PR)

@jtulach

jtulach commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

I've just had a lunch with @lahodaj and he asked me: What will happen if there is no NetBeans project underneath the "Open Folder" directory?

  • fair question! Right now it opens nothing and leaves the Project view empty.
  • that's what Jan would like to change, if I understand him correctly
  • he would like a dummy project to be opened instead

Let's try to provide such a functionality. TBC...

@neilcsmith-net

Copy link
Copy Markdown
Member

Yes, I share some of @lahodaj concern there, which is partly why I think revamping Open Project is an easier first step than the Open Folder action. Although the ability to open any folder as a project is useful, and something that has come up in discussion before.

Reversing the question slightly, how many of your expected use cases have a project at the folder root and subprojects within?

I still think adding an option to open in a new workspace (group) on the Open Project dialog is a better approach while we work out the other use cases. Bearing in mind that dialog allows multi-select already too (could be Open Projects).

Do we have an LRU ordered list for groups? Rather than an additional menu item that is likely to lead to more, what about a replacement for the current groups action - a Workspaces item that has a sub-menu with eg. New from folder.., as well as Manage and a quick list to switch between existing ones?

Whatever happens here might need a rethink of the dashboard display too. I still haven't got around to next steps on that - a widget for Workspaces could be good there too.

@Chris2011

Chris2011 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

If you have a mono repo, which is just a git repo full of subprojects, it would be really nice, to open this folder as a "workspace but of course, this is just a folder with the stuff inside, I don't want to see all subprojects or folders at top level. If I checkout a mono repo to "MyMonorepo" then I can open MyMonorepo as Projectfolder with all the stuff inside. MyMonorepo is the worksapce then w/o being a specific netbeans project but just a wrapper around it, to open it as a project.

}
if (fo != null && fo.isFolder()) {
try {
Project p = ProjectManager.getDefault().findProject(fo);

@jtulach jtulach Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This change makes sure the "top most folder" of each DirectoryGroup is visible
    • e.g. the folder selected in Open Folder as Workspace is always visible
    • thanks to Show nested projects co-located and indented #9602 the "top most folder" is the first project in the list
    • ... as it has the shortest path and all other projects are nested
  • if the root folder is recognized as a regular NetBeans project...
    • ...then the behavior is the same as it was by now
  • if the root folder isn't real project, a GenericPrj is created for it
  • if there is no project beneath the root folder, then one gets just a simple "files view" of the root project:
Files View of a Folder

@jtulach jtulach Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open root of NetBeans folder
  • btw. the list of projects is pretty long as it includes all the testing projects found in the NetBeans codebase
  • but that's how it always have been ...
  • ... no change in that
    • just nobody really tried to use "Open Folder as Group" yet ...

@mbien mbien added the ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) label Sep 23, 2026
@mbien

mbien commented Sep 23, 2026

Copy link
Copy Markdown
Member

I get that this is in early stages but I would probably not rebrand project group to workspaces. I think "Add Folder to Group" would be a small/self contained feature to explore / merge independently which could be built on top later if needed. PGs are a core concept of NB and part of API, online docs/blogs (LLMs*) and even CLI flags. I do also like the name, since it is self describing - a group of projects, no matter if related or not or if they share the same parent folder or not. This is not the same as the classic eclipse workspace for example. Also: naming is hard

I also think that automatically opening an unspecified amount of projects isn't a good idea. The first thing I did is to open ~/NetBeansProjects as "workspace" and it crashed NB right away. The other reasons are on the nb private mailing list. Once the Folder is added, it is easy to open the projects within it.

*got curious so I asked 4 models to compare PGs with eclipse workspaces and the results were fairly useable

e.g excerpt of the summary, I think that one was Mistral:

Details

Key difference in philosophy

Eclipse workspaces are structural containers — they fundamentally partition your development environment. Switching workspaces means a fresh Eclipse instance with different settings and projects.

NetBeans project groups are organizational shortcuts — they're a convenience feature for opening related projects together within a single NetBeans session. Your settings, plugins, and instance remain the same.

@Chris2011

Chris2011 commented Sep 23, 2026 via email

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Project UI View

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants