Repository: godotengine/godot
File: editor/plugins/script_editor_plugin.cpp (C++)

Code before:
	script_create_dialog->set_title(TTR("Create Script"));
	add_child(script_create_dialog);
	script_create_dialog->connect("script_created", callable_mp(this, &ScriptEditor::_script_created));

	file_dialog_option = -1;
	file_dialog = memnew(EditorFileDialog);
	add_child(file_dialog);
	file_dialog->connect("file_selected", callable_mp(this, &ScriptEditor::_file_dialog_action));

	error_dialog = memnew(AcceptDialog);
	add_child(error_dialog);

	disk_changed = memnew(ConfirmationDialog);
	{
		disk_changed->set_title(TTR("Files have been modified outside Godot"));

		VBoxContainer *vbc = memnew(VBoxContainer);
		disk_changed->add_child(vbc);

		Label *files_are_newer_label = memnew(Label);
		files_are_newer_label->set_text(TTR("The following files are newer on disk:"));
		vbc->add_child(files_are_newer_label);

		disk_changed_list = memnew(Tree);
		disk_changed_list->set_hide_root(true);
		disk_changed_list->set_accessibility_name(TTR("The following files are newer on disk"));
		disk_changed_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
		disk_changed_list->set_v_size_flags(SIZE_EXPAND_FILL);
		vbc->add_child(disk_changed_list);

		Label *what_action_label = memnew(Label);
		what_action_label->set_text(TTR("What action should be taken?"));
		vbc->add_child(what_action_label);

		disk_changed->connect(SceneStringName(confirmed), callable_mp(this, &ScriptEditor::reload_scripts).bind(false));
		disk_changed->set_ok_button_text(TTR("Reload from disk"));

		disk_changed->add_button(TTR("Ignore external changes"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
		disk_changed->connect("custom_action", callable_mp(this, &ScriptEditor::_resave_scripts));
	}

	add_child(disk_changed);

	script_editor = this;

	autosave_timer = memnew(Timer);
	autosave_timer->set_one_shot(false);
	autosave_timer->connect(SceneStringName(tree_entered), callable_mp(this, &ScriptEditor::_update_autosave_timer));
	autosave_timer->connect("timeout", callable_mp(this, &ScriptEditor::_autosave_scripts));
	add_child(autosave_timer);


Review comment (suggestion):
`NOTIFICATION_TRANSLATION_CHANGED` is automatically received when entering tree, so no need to set it here.

Code after:
	script_create_dialog->set_title(TTR("Create Script"));
	add_child(script_create_dialog);
	script_create_dialog->connect("script_created", callable_mp(this, &ScriptEditor::_script_created));

	file_dialog_option = -1;
	file_dialog = memnew(EditorFileDialog);
	add_child(file_dialog);
	file_dialog->connect("file_selected", callable_mp(this, &ScriptEditor::_file_dialog_action));

	error_dialog = memnew(AcceptDialog);
	add_child(error_dialog);

	disk_changed = memnew(ConfirmationDialog);
	{
		disk_changed->set_title(TTR("Files have been modified outside Godot"));

		VBoxContainer *vbc = memnew(VBoxContainer);
		disk_changed->add_child(vbc);

		Label *files_are_newer_label = memnew(Label);
		files_are_newer_label->set_text(TTR("The following files are newer on disk:"));
		vbc->add_child(files_are_newer_label);

		disk_changed_list = memnew(Tree);
		disk_changed_list->set_hide_root(true);
		disk_changed_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
		disk_changed_list->set_v_size_flags(SIZE_EXPAND_FILL);
		vbc->add_child(disk_changed_list);

		Label *what_action_label = memnew(Label);
		what_action_label->set_text(TTR("What action should be taken?"));
		vbc->add_child(what_action_label);

		disk_changed->connect(SceneStringName(confirmed), callable_mp(this, &ScriptEditor::reload_scripts).bind(false));
		disk_changed->set_ok_button_text(TTR("Reload from disk"));

		disk_changed->add_button(TTR("Ignore external changes"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
		disk_changed->connect("custom_action", callable_mp(this, &ScriptEditor::_resave_scripts));
	}

	add_child(disk_changed);

	script_editor = this;

	autosave_timer = memnew(Timer);
	autosave_timer->set_one_shot(false);
	autosave_timer->connect(SceneStringName(tree_entered), callable_mp(this, &ScriptEditor::_update_autosave_timer));
	autosave_timer->connect("timeout", callable_mp(this, &ScriptEditor::_autosave_scripts));
	add_child(autosave_timer);

	grab_focus_block = false;