MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / updateValueEditor

Method updateValueEditor

source/json_tool/editor_gui.cpp:154–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154void 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
177void JsonEditor::updateImagePreview() {
178 String file = m_files.get(m_fileIndex);

Callers

nothing calls this directly

Calls 7

getMethod · 0.45
getDefaultMethod · 0.45
fromJsonMethod · 0.45
whatMethod · 0.45
setTextMethod · 0.45
utf8PtrMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected