Skip to content
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 @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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());
}
};
}
Expand Down