From eba79ef2c3f0528137e1bccbbbbe737d4a9400c1 Mon Sep 17 00:00:00 2001 From: alirana01 Date: Thu, 23 Nov 2023 11:26:11 +0500 Subject: [PATCH 1/2] IEP-1037: Fix for the confserver handling of the hex values --- .../idf/sdk/config/ui/SDKConfigurationEditor.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java b/bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java index 318655e76..76769dda8 100644 --- a/bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java +++ b/bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java @@ -635,8 +635,10 @@ else if (isVisible && type.equals(IJsonServerConfig.HEX_TYPE)) textControl.setToolTipText(helpInfo); if (configValue != null) { - textControl.setText(newConfigValue != null ? Long.toString((long) newConfigValue) - : Long.toString((long) configValue)); + String hexText = newConfigValue != null ? Long.toHexString((long) newConfigValue) + : Long.toHexString((long) configValue); + textControl.setText("0x" + hexText.toUpperCase()); + } textControl.addModifyListener(addModifyListener(configKey, textControl)); addTooltipImage(kConfigMenuItem); @@ -851,9 +853,11 @@ protected ModifyListener addModifyListener(String configKey, Text textControl) @Override public void modifyText(ModifyEvent e) { + String text = textControl.getText().toLowerCase(); + boolean isHex = text.startsWith("0x"); isDirty = true; editorDirtyStateChanged(); - modifiedJsonMap.put(configKey, textControl.getText().trim()); + modifiedJsonMap.put(configKey, isHex ? Long.parseLong(text.substring(2), 16) : textControl.getText().trim()); } }; } From 4ea5121e444e8a9e8153aa39c566647f063d71de Mon Sep 17 00:00:00 2001 From: alirana01 Date: Thu, 23 Nov 2023 13:58:22 +0500 Subject: [PATCH 2/2] added hex tag to the label for hex values --- .../com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java b/bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java index 76769dda8..dc5f5510e 100644 --- a/bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java +++ b/bundles/com.espressif.idf.sdk.config.ui/src/com/espressif/idf/sdk/config/ui/SDKConfigurationEditor.java @@ -626,7 +626,7 @@ protected void renderMenuItems(KConfigMenuItem selectedElement) else if (isVisible && type.equals(IJsonServerConfig.HEX_TYPE)) { Label labelName = new Label(updateUIComposite, SWT.NONE); - labelName.setText(kConfigMenuItem.getTitle()); + labelName.setText(kConfigMenuItem.getTitle().concat(" (hex)")); Text textControl = new Text(updateUIComposite, SWT.SINGLE | SWT.BORDER); GridData gridData = new GridData();