Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the netbeans support a bit more robust #16144

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@ public class IdeProcessor {
IDE_PROCESSES.put((processInfo -> processInfo.containInCommand("code")), Ide.VSCODE);
IDE_PROCESSES.put((processInfo -> processInfo.containInCommand("eclipse")), Ide.ECLIPSE);
IDE_PROCESSES.put(
(processInfo -> processInfo.containInCommandWithArgument("java", "netbeans")),
(processInfo -> processInfo.containInArguments("netbeans")),
Ide.NETBEANS);

IDE_ARGUMENTS_EXEC_INDICATOR.put(Ide.NETBEANS, (ProcessInfo processInfo) -> {
String platform = processInfo.getArgumentValue("-Dnetbeans.home");
String platform = processInfo.getArgumentThatContains("nbexec");
if (platform != null && !platform.isEmpty()) {
platform = platform.substring(0, platform.indexOf("platform")).concat("bin").concat(File.separator);
if (IdeUtil.isWindows()) {
platform = platform.replace("platform", "bin/netbeans.exe");
platform = platform.concat("netbeans.exe");
} else {
platform = platform.replace("platform", "bin/netbeans");
platform = platform.concat("netbeans");
}
return platform;
}
Expand Down Expand Up @@ -237,15 +238,11 @@ public String[] getArguments() {
return arguments;
}

public boolean containInCommandWithArgument(String command, String argument) {
return containInCommand(command) && containInArguments(argument);
}

public boolean containInCommand(String value) {
private boolean containInCommand(String value) {
return this.command.contains(value);
}

public boolean containInArguments(String value) {
private boolean containInArguments(String value) {
if (arguments != null) {
for (String argument : arguments) {
if (argument.contains(value)) {
Expand All @@ -256,11 +253,11 @@ public boolean containInArguments(String value) {
return false;
}

public String getArgumentValue(String argumentKey) {
private String getArgumentThatContains(String contain) {
if (arguments != null) {
for (String argument : arguments) {
if (argument.startsWith(argumentKey) && argument.contains("=")) {
return argument.substring(argument.indexOf("=") + 1);
if (argument.contains(contain)) {
return argument;
}
}
}
Expand Down