| 152 | } |
| 153 | |
| 154 | void JsonEditor::updateValueEditor() { |
| 155 | FormattedJson value; |
| 156 | try { |
| 157 | value = m_path->get(m_currentJson); |
| 158 | } catch (JsonPath::TraversalException const&) { |
| 159 | // Path does not already exist in the Json document. We're adding it. |
| 160 | value = m_editFormat->getDefault(); |
| 161 | } |
| 162 | |
| 163 | String valueText; |
| 164 | try { |
| 165 | valueText = m_editFormat->fromJson(value); |
| 166 | } catch (JsonException const& e) { |
| 167 | // The value already present in the was no thte type we expected, e.g. |
| 168 | // it was an int, when we wanted a string array for CSV. |
| 169 | // Clear the value already present. |
| 170 | m_errorDialog->showMessage(e.what()); |
| 171 | valueText = m_editFormat->fromJson(m_editFormat->getDefault()); |
| 172 | } |
| 173 | m_valueEditor->setText(valueText.utf8Ptr()); |
| 174 | m_valueEditor->setEnabled(true); |
| 175 | } |
| 176 | |
| 177 | void JsonEditor::updateImagePreview() { |
| 178 | String file = m_files.get(m_fileIndex); |
nothing calls this directly
no test coverage detected