From 3deab631f556c5d7a61656bbcdc8ff7467e16e88 Mon Sep 17 00:00:00 2001 From: Emanuela Epure <67077116+emanuelaepure10@users.noreply.github.com> Date: Wed, 17 Jan 2024 11:02:37 +0100 Subject: [PATCH] fix: hale: Removal of project variable is not persisted on save Removing of a variable via settings dialog is persisted in the project file upon save. ING-4169 --- .../ProjectVariablesPreferencePage.java | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/ui/plugins/eu.esdihumboldt.hale.ui/src/eu/esdihumboldt/hale/ui/service/project/internal/ProjectVariablesPreferencePage.java b/ui/plugins/eu.esdihumboldt.hale.ui/src/eu/esdihumboldt/hale/ui/service/project/internal/ProjectVariablesPreferencePage.java index c6b408547c..cd2278d0f2 100644 --- a/ui/plugins/eu.esdihumboldt.hale.ui/src/eu/esdihumboldt/hale/ui/service/project/internal/ProjectVariablesPreferencePage.java +++ b/ui/plugins/eu.esdihumboldt.hale.ui/src/eu/esdihumboldt/hale/ui/service/project/internal/ProjectVariablesPreferencePage.java @@ -138,18 +138,18 @@ public void widgetSelected(SelectionEvent e) { InputDialog dialog = new InputDialog(display.getActiveShell(), "Add new variable", "Please enter the name of the variable to add", "", new IInputValidator() { - @Override - public String isValid(String newText) { - if (newText == null || newText.isEmpty()) { - return "Variable name must not be empty"; - } - else if (variables.containsKey(newText)) { - return "Variable already exists"; - } - - return null; - } - }); + @Override + public String isValid(String newText) { + if (newText == null || newText.isEmpty()) { + return "Variable name must not be empty"; + } + else if (variables.containsKey(newText)) { + return "Variable already exists"; + } + + return null; + } + }); if (dialog.open() == InputDialog.OK) { String varName = dialog.getValue(); if (varName != null) { @@ -205,6 +205,11 @@ public void widgetSelected(SelectionEvent e) { c.dispose(); } variables.remove(varName); + + ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class); + ps.getConfigurationService().setProperty( + ProjectVariables.PROJECT_PROPERTY_VARIABLES, Value.complex(variables)); + updateLayout(); changed = true; }