Skip to content

Commit

Permalink
Add ability to export JSON OPTs to UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolandscat committed Jan 20, 2025
1 parent d658572 commit 52208fb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
10 changes: 9 additions & 1 deletion apps/adl_workbench/src/gui/export/export_dialog.e
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ feature {NONE} -- Initialization
evx_input_frame.extend (evx_type_marking_cb.ev_data_control, True)
gui_controls.extend (evx_type_marking_cb)

-- output templates as OPTs (not just flat templates): check box
create evx_tpls_as_opts_cb.make_linked (get_text ({ADL_MESSAGES_IDS}.ec_tpls_as_opts_cb_text), get_text ({ADL_MESSAGES_IDS}.ec_tpls_as_opts_cb_tooltip),
agent :BOOLEAN do Result := export_tpls_as_opts end, agent set_export_tpls_as_opts)
evx_input_frame.extend (evx_tpls_as_opts_cb.ev_data_control, True)
gui_controls.extend (evx_tpls_as_opts_cb)

-- compile all first: check box
evx_input_frame.add_row (False)
Expand Down Expand Up @@ -360,7 +365,10 @@ feature {NONE} -- Implementation
else
execution_state := es_ready_to_generate
end

-- output all archetypes and flattened source templates
archetype_exporter.setup_build ([output_directory, evx_format_cob.data_control_text, export_flat, evx_flatten_with_rm_cb.is_selected, False])
archetype_exporter.setup_build ([output_directory, evx_format_cob.data_control_text, export_flat, evx_flatten_with_rm_cb.is_selected, export_tpls_as_opts])

-- start compilation
elseif execution_state = es_ready_to_compile then
Expand Down Expand Up @@ -442,7 +450,7 @@ feature {NONE} -- Implementation

gui_controls: ARRAYED_LIST [EVX_DATA_CONTROL]

evx_compile_first_cb, evx_flatten_with_rm_cb, evx_type_marking_cb: EVX_CHECK_BOX_CONTROL
evx_compile_first_cb, evx_flatten_with_rm_cb, evx_type_marking_cb, evx_tpls_as_opts_cb: EVX_CHECK_BOX_CONTROL

evx_dir_setter: EVX_DIRECTORY_SETTER

Expand Down
4 changes: 3 additions & 1 deletion apps/resources/messages/compiled/adl_messages_db.e
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ feature -- Initialisation

make
do
create message_table.make (985)
create message_table.make (987)
message_table.put ("Terminology initialisation failed; reason: $1", ec_terminology_init_failed)
message_table.put ("Using ADL version $1 for output serialisation", ec_adl_version_warning)
message_table.put ("Validation level STRICT", ec_validation_strict)
Expand Down Expand Up @@ -975,6 +975,8 @@ feature -- Initialisation
message_table.put ("Include RM in flattening process, causing RM existence and cardinality to be included and occurrences to be generated", ec_flatten_with_rm_cb_tooltip)
message_table.put ("Type marking", ec_type_marking_cb_text)
message_table.put ("Add type marking to object formats, i.e. JSON, YAML, ODIN", ec_type_marking_cb_tooltip)
message_table.put ("Export OPTs only", ec_tpls_as_opts_cb_text)
message_table.put ("Export only OPTs", ec_tpls_as_opts_cb_tooltip)
message_table.put ("Save instance to file", ec_save_instance_dialog_title)
message_table.put ("Save $1 file", ec_save_instance_to_file_title)
message_table.put ("Original text", ec_translation_original_label_text)
Expand Down
2 changes: 2 additions & 0 deletions apps/resources/messages/compiled/adl_messages_ids.e
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,8 @@ feature -- Definitions
ec_flatten_with_rm_cb_tooltip: STRING = "flatten_with_rm_cb_tooltip"
ec_type_marking_cb_text: STRING = "type_marking_cb_text"
ec_type_marking_cb_tooltip: STRING = "type_marking_cb_tooltip"
ec_tpls_as_opts_cb_text: STRING = "tpls_as_opts_cb_text"
ec_tpls_as_opts_cb_tooltip: STRING = "tpls_as_opts_cb_tooltip"
ec_save_instance_dialog_title: STRING = "save_instance_dialog_title"
ec_save_instance_to_file_title: STRING = "save_instance_to_file_title"
ec_translation_original_label_text: STRING = "translation_original_label_text"
Expand Down
3 changes: 3 additions & 0 deletions apps/resources/messages/source/app_awb_ui_messages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,9 @@ templates = <
["type_marking_cb_text"] = <"Type marking">
["type_marking_cb_tooltip"] = <"Add type marking to object formats, i.e. JSON, YAML, ODIN">

["tpls_as_opts_cb_text"] = <"Export OPTs only">
["tpls_as_opts_cb_tooltip"] = <"Export only OPTs">

-- GUI_INSTANCE_CONTROL
["save_instance_dialog_title"] = <"Save instance to file">
["save_instance_to_file_title"] = <"Save $1 file">
Expand Down
17 changes: 17 additions & 0 deletions components/app_shell/shared_adl_app_resources.e
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ feature -- Definitions
create Result.make_from_string ("/compiler/type_marking")
end

Compiler_export_tpls_as_opts_resource_path: IMMUTABLE_STRING_8
once
create Result.make_from_string ("/compiler/export_tpls_as_opts")
end

File_system_aom_profile_user_directory_resource_path: IMMUTABLE_STRING_8
once
create Result.make_from_string ("/file_system/aom_profile_user_directory")
Expand Down Expand Up @@ -452,6 +457,18 @@ feature -- Application Switches
app_cfg.put_boolean_value (Compiler_type_marking_resource_path, flag)
end

export_tpls_as_opts: BOOLEAN
-- output templates as OPTs?
do
Result := app_cfg.boolean_value (Compiler_export_tpls_as_opts_resource_path)
end

set_export_tpls_as_opts (flag: BOOLEAN)
-- Set flag to output templates as OPTs rather than flattened source templates
do
app_cfg.put_boolean_value (Compiler_export_tpls_as_opts_resource_path, flag)
end

aom_profile_directory: STRING
-- Path of directory where AOM profiles are found - note: this should be writable.
do
Expand Down

0 comments on commit 52208fb

Please sign in to comment.