Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE

Release with new features and bugfixes:

* https://github.com/devonfw/IDEasy/issues/2045[#2045]: Add tool selection and version or edition configuration to GUI
* https://github.com/devonfw/IDEasy/issues/821[#821]: Made the `ide` prefix in `ide shell` part of the editable input so it can be removed for non-IDEasy commands
* https://github.com/devonfw/IDEasy/issues/2286[#2286]: Fix SystemPath.findBinary to search extraPathEntries
* https://github.com/devonfw/IDEasy/issues/1165[#1165]: Fix automatic project import for Eclipse
Expand Down
45 changes: 45 additions & 0 deletions gui/src/main/java/com/devonfw/ide/gui/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@
import javafx.concurrent.Task;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.Tooltip;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -29,6 +34,7 @@
import com.devonfw.ide.gui.nls.NlsService;
import com.devonfw.ide.gui.progress.ProgressBarTask;
import com.devonfw.ide.gui.progress.taskwindow.TaskOverviewWindow;
import com.devonfw.ide.gui.settings.ToolSettingsController;

/**
* Controller of the main screen of the dashboard GUI.
Expand Down Expand Up @@ -71,6 +77,15 @@ public class MainController {
private ProgressBar statusProgressBar;
private final double PROGRESSBAR_VISIBLE_WIDTH = 150.0;

@FXML
private TabPane tabPane;

@FXML
private Tab mainTab;

@FXML
private Tab toolConfigTab;

private final String ideRootPath;
private Path projectValue;
private Path workspaceValue;
Expand Down Expand Up @@ -132,7 +147,15 @@ private void initialize() {

setProjectsComboBox();
initLanguageComboBox();
toolConfigTab.setDisable(true);
toolConfigTab.setTooltip(new Tooltip(nlsService.get("toolConfigDisabled")));
tabPane.getSelectionModel().selectedItemProperty().addListener((obs, oldTab, newTab) -> {
if (newTab == toolConfigTab) {
loadToolConfigContent();
}
});
selectedWorkspace.setOnAction(this::onWorkspaceSelected);

}

private void onWorkspaceSelected(ActionEvent actionEvent) {
Expand All @@ -143,6 +166,10 @@ private void onWorkspaceSelected(ActionEvent actionEvent) {
}
updateContext(selectedProject.getValue(), workspaceName);
setIdeButtonsDisabled(false);
toolConfigTab.setDisable(false);
if (toolConfigTab.isSelected()) {
loadToolConfigContent();
}
}

private void initLanguageComboBox() {
Expand Down Expand Up @@ -232,6 +259,7 @@ private void setProjectsComboBox() {
setWorkspaceComboBox();

selectedWorkspace.setDisable(false);

});
}

Expand All @@ -249,6 +277,7 @@ private void setWorkspaceComboBox() {
selectedWorkspace.getItems().addAll(workspaces);

setIdeButtonsDisabled(true);
toolConfigTab.setDisable(true);
}

private void openIDE(String inIde) {
Expand Down Expand Up @@ -284,6 +313,22 @@ protected Void call() {
}
}

private void loadToolConfigContent() {

try {
ToolSettingsController controller = new ToolSettingsController(nlsService, guiStateManager.getCurrentContext());
FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/devonfw/ide/gui/tools-config.fxml"));
loader.setController(controller);
loader.setResources(nlsService.getResourceBundle());
Parent content = loader.load();
controller.setOnClose(() -> tabPane.getSelectionModel().select(mainTab));
toolConfigTab.setContent(content);
} catch (Exception e) {
LOG.error("Failed to load tool config view", e);
new IdeDialog(IdeDialog.AlertType.ERROR, e.getMessage()).showAndWait();
}
}

private void updateContext(String selectedProjectName, String selectedWorkspaceName) {

try {
Expand Down
116 changes: 116 additions & 0 deletions gui/src/main/java/com/devonfw/ide/gui/settings/ToolConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
package com.devonfw.ide.gui.settings;

import java.util.List;
import java.util.Objects;

/**
* Model representing the configurable settings for a single tool.
*/
public final class ToolConfiguration {

private final String toolName;

/** Group/type of the tool used for grouping in the UI. */
private ToolGroup group;

private boolean enabled;

private String configuredVersion;

private String configuredEdition;

private boolean supportsEdition;

private List<String> availableEditions;

private List<String> availableVersions;

//<------------ Constructor & Getters/Setters ------------>

public ToolConfiguration(String toolName) {
this.toolName = Objects.requireNonNull(toolName);
}

/**
* Tool groups used to group/sort tools in the UI. Order of declaration determines the default ordering.
*/
public enum ToolGroup {
IDE("toolGroupIde"),
LOCAL("toolGroupLocal"),
GLOBAL("toolGroupGlobal"),
PIP("toolGroupPip"),
NPM("toolGroupNpm"),
OTHER("toolGroupOther");

private final String label;

ToolGroup(String label) {
this.label = label;
}

public String getLabel() {
return this.label;
}
}

public String getToolName() {
return this.toolName;
}

public ToolGroup getGroup() {
return this.group;
}

public void setGroup(ToolGroup group) {
this.group = group;
}

public boolean isEnabled() {
return this.enabled;
}

public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

public String getConfiguredVersion() {
return this.configuredVersion;
}

public void setConfiguredVersion(String configuredVersion) {
this.configuredVersion = configuredVersion;
}

public String getConfiguredEdition() {
return this.configuredEdition;
}

public void setConfiguredEdition(String configuredEdition) {
this.configuredEdition = configuredEdition;
}

public boolean isSupportsEdition() {
return this.supportsEdition;
}

public void setSupportsEdition(boolean supportsEdition) {
this.supportsEdition = supportsEdition;
}

public List<String> getAvailableEditions() {
return this.availableEditions;
}

public void setAvailableEditions(List<String> availableEditions) {
this.availableEditions = availableEditions;
}

public List<String> getAvailableVersions() {
return this.availableVersions;
}

public void setAvailableVersions(List<String> availableVersions) {
this.availableVersions = availableVersions;
}

}
Loading