Skip to content

Allow usage of Java Single File Launcher in non-Java projects - #9666

Merged
jtulach merged 1 commit into
apache:masterfrom
jtulach:jtulach/UseJavaFileLauncherInNonJavaProjects
Oct 5, 2026
Merged

jtulach merged 1 commit into
apache:masterfrom
jtulach:jtulach/UseJavaFileLauncherInNonJavaProjects

Conversation

@jtulach

@jtulach jtulach commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

... Java single-file support checks for FileOwnerQuery.getOwner(file) == null (SingleSourceFileUtil.isSupportedFile, and MultiSourceRootProvider for the classpath). So loose .java files in an opened non-Java project....

  • When Java single-file support checks for FileOwnerQuery.getOwner(file) == null then it disables itself in (for example) C++ projects
    • checking that I am in no projects is not the right check and has to be changed
    • the right question is: Am I outside of a Java project?
    • per mutual agreement it: the right check is

Enable when not in a project with a Java SourceGroup

  • this PR changes the check, so the support is enabled in C++ light projects (for example)

It Works now!

Single file actions in C++ project

@jtulach jtulach self-assigned this Oct 5, 2026
@jtulach jtulach added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests labels Oct 5, 2026
@jtulach jtulach mentioned this pull request Oct 5, 2026
1 of 2 tasks
@jtulach
jtulach force-pushed the jtulach/UseJavaFileLauncherInNonJavaProjects branch from 88cdcd1 to 12edabe Compare October 5, 2026 06:22
Comment thread java/java.source/src/org/netbeans/modules/java/JavaNode.java Outdated
@jtulach
jtulach force-pushed the jtulach/UseJavaFileLauncherInNonJavaProjects branch from 12edabe to 6ce8ced Compare October 5, 2026 06:40
@neilcsmith-net

Copy link
Copy Markdown
Member

Glanced through but not tested as yet. Looks good for that, thanks. My original suggestion was whether a file was within a Java SourceGroup. However, that might trigger issues with other project queries (eg. classpath), so what you have makes sense, is safer, and doesn't preclude looking further later if we need to.

Have you tested with a Maven parent (POM) project? If it works fine in there, it probably addresses some of the usages that would be nice to support in Java projects anyway.

Is the test dependency on SVG really needed?

<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.openide.util.ui.svg</code-name-base>

@jtulach jtulach Oct 5, 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.

@neilcsmith-net wrote:

Is the test dependency on SVG really needed?

@jtulach
jtulach force-pushed the jtulach/UseJavaFileLauncherInNonJavaProjects branch from 6ce8ced to 7dcaf8e Compare October 5, 2026 11:18
@jtulach

jtulach commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Have you tested with a Maven parent (POM) project? If it works fine in there...

Yes, it seems to work.

Is the test dependency on SVG really needed?

No, it is not needed. Removed.

@lahodaj lahodaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks sensible to me. Minor style comment inline.

@jtulach
jtulach force-pushed the jtulach/UseJavaFileLauncherInNonJavaProjects branch from 7dcaf8e to ee5d54c Compare October 5, 2026 12:25
@jtulach
jtulach merged commit c25d20f into apache:master Oct 5, 2026
4 checks passed
jtulach added a commit to jtulach/netbeans that referenced this pull request Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants