Skip to content

LogicalViewProvider.WithNestedProjects allows one to logically nest projects - #9592

Open
jtulach wants to merge 2 commits into
apache:masterfrom
jtulach:jtulach/NestedProjects
Open

LogicalViewProvider.WithNestedProjects allows one to logically nest projects#9592
jtulach wants to merge 2 commits into
apache:masterfrom
jtulach:jtulach/NestedProjects

Conversation

@jtulach

@jtulach jtulach commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The goal of this PR is to design an API that would allow projects to nest children projects. Such nesting shall help us solve a long time pending issue that Mark @struberg pointed out a decade ago. E.g. that for example rich Maven projects aren't represented hierarchically.

The change is only visual. The projects are still open - e.g. goto type, symbol or file will continue to work as expected.

Sample Maven Project Reorganization

The change to Maven project isn't part of this PR, but I'll test the API on Maven to see if it can deliver and really simplify organization of huge projects.

@jtulach jtulach self-assigned this Sep 2, 2026
@jtulach jtulach added API Change [ci] enable extra API related tests Maven [ci] enable "build tools" tests Project UI View labels Sep 2, 2026
@mbien

mbien commented Sep 3, 2026

Copy link
Copy Markdown
Member

I like it as UI option and indeed many asked for something like that before. However, I believe that the tree will become deep quickly (esp in larger projects) which will make me want to have the flat structure again (+ project groups for context switching).

The sub-project tree must also retain a way to distinguish between closed and opened project. (which might be tricky to visualize, since "Maven 4 API" is a project and "Maven 4 API :: Meta annotations" is a project too - see screenshot where both are closed)

The top level project looks like this right now for comparison:

image

Unless the user hits open required projects -> open all projects - which can be overwhelming - it remains usually fairly easy to navigate.

@mbien

mbien commented Sep 3, 2026

Copy link
Copy Markdown
Member

although we could probably mitigate many horizontal-scroll issues of deep trees by tweaking the node indentation.

@neilcsmith-net

Copy link
Copy Markdown
Member

I like it as UI option and indeed many asked for something like that before. However, I believe that the tree will become deep quickly (esp in larger projects) which will make me want to have the flat structure again (+ project groups for context switching).
...
Unless the user hits open required projects -> open all projects - which can be overwhelming - it remains usually fairly easy to navigate.

Agreed! This looks like a great option, as long as it's optional and off by default (for now at least). It reminds me a little of the package view tree options - sometimes useful, often unwieldy - flatter is often easier to use in practice.

The sub-project tree must also retain a way to distinguish between closed and opened project.

My first thought was whether leaf or not. However that might conflict with representing nested project hierarchies. The second thought was, why? With the UI like this, what does closed vs opened mean? Maybe projects just open on-demand as needed? Which is not that different to double-clicking on them now.

The varargs changes in Children might be a problem.

@mbien

mbien commented Sep 3, 2026

Copy link
Copy Markdown
Member

I don't want to derail this but something we could try is to add more sorting options to the project list. Topological sort would have the parent above the child. So you would have the root project on top displaying the sub module tree (see screenshot), and all other projects you open would show up below. Even manual re-ordering mode would help I think.

@JaroslavTulach

Copy link
Copy Markdown

... sorting options to the project list. Topological sort would have the parent above the child....

Better sorting is a great idea! It doesn't require any API changes. It is not really achieving all, I'd like to, but it is a good non-disturbing start. I'll try it.

@JaroslavTulach

JaroslavTulach commented Sep 4, 2026

Copy link
Copy Markdown

Unless the user hits open required projects -> open all projects

When dealing with unknown source (like Apache Maven or OpenJDK is to me), the whole point is that one must open all projects. Otherwise goto type, file, find usages & co. work poorly.

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.

This is just an outline of my plan. It is out of scope of this PR.

@matthiasblaesing

Copy link
Copy Markdown
Contributor

When dealing with unknown source (like Apache Maven or OpenJDK is to me), the whole point is that one must open all projects. Otherwise goto type, file & co. work poorly.

Be careful! If you say that opening a project opens alls submodules I veto this unless you can explain how you intent to handle this: https://github.com/openhab/openhab-addons/tree/main/bundles. These are > 500 submodules. The IDE currently struggles in the project open dialog, I don't want to know how it will feel when all 500 submodules are opened.

@JaroslavTulach

JaroslavTulach commented Sep 4, 2026

Copy link
Copy Markdown

Be careful! If you say that opening a project opens alls submodules ... These are > 500 submodules. The IDE currently struggles in the project open dialog, I don't want to know how it will feel when all 500 submodules are opened.

NetBeans own codebase is another example where opening all projects takes the IDE to its limits. As such, I have no intention to change the workflow for expert users. Rather I'd offer an alternative actions that would mimic what Apache NetBeans VSCode Extension already does.

I am a huge believer in synergy. The Apache NetBeans VSCode Extension is a base for Java Platform Extension with a 6M of downloads. That makes it an important asset for its publisher. It should be in the interest of the publisher as well as Apache NetBeans project to make sure both the extensions work well even on projects like openhub-addons.

Hence, by aligning the UX, we shall mutually straighten our forces to (possibly) improve the IDE's capabilities of handling those 500+ modules without current scalability issues. Of course, this is just a speculation - it may not happen - however without the common UX ground it certainly won't happen. We have to set the environment up for synergy first, and then believe the synergy inevitably emerges. That's why I plan to offer those workspace UX actions.

@mbien

mbien commented Sep 4, 2026

Copy link
Copy Markdown
Member

Rather I'd offer an alternative actions that would mimic what Apache NetBeans VSCode Extension already does.

Open Folder? I am a bit confused since NB can do that as long I remember. It got also recently added as a right click menu action so that you don't have to drag things around.

image

Being able to link those folders with project groups would be interesting though - since they are not persisted atm.

Document groups would also need some love, they don't mix very well with project groups atm. There is probably a interesting UX to get when document groups + git stash/unstash + branch switch are combined in a smart way to make context switching easier.

for Java Platform Extension with a 6M of downloads. That makes it an important asset for its publisher... It should be in the interest of the publisher as well as Apache NetBeans project to make sure both the extensions work well ...

thats cool. I am sure we would be open to assign some maintenance tasks to publishers if there is interest. A lot needs to be done to bring the codebase in better shape - although we made some progress recently.

In any case, PRs are not the right place to discuss larger changes.

@neilcsmith-net

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.

You could make the same arguments for ergonomics. For both that comes down to better implementation. The UX is only poor if the behaviour of the IDE is different and UX transparency is lost. That to me is the point where this could move from an option to try to a sane (but still switchable) "non-expert" default.

Incidentally, linking up a relevant recent issue - #9572

And another issue that relates to transparency of behaviour, not just whether a project is open, but whether it has ever been opened - #4274

thats cool. I am sure we would be open to assign some maintenance tasks to publishers if there is interest. A lot needs to be done to bring the codebase in better shape - although we made some progress recently.

In any case, PRs are not the right place to discuss larger changes.

Again, agreed! And I'd much prefer a push to help on the rather more important things, like Maven 4 integration, if we're discussing ways to encourage such projects to stop expecting a free lunch. 😉 The NetBeans VSCode plugin basically stopped development a year ago, but we seem to be ignoring that. Whether 6m people downloaded the Oracle plugin is irrelevant. We have hundreds of thousands of people using every release of NetBeans, and I think it's a mistake to assume synergy of approach is what keeps them doing so.

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

Labels

API Change [ci] enable extra API related tests Maven [ci] enable "build tools" tests Project UI View

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants