version_control_editor_plugin.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. #include "version_control_editor_plugin.h"
  2. #include "core/script_language.h"
  3. #include "editor/editor_file_system.h"
  4. #include "editor/editor_node.h"
  5. VersionControlEditorPlugin *VersionControlEditorPlugin::singleton = NULL;
  6. void VersionControlEditorPlugin::_bind_methods() {
  7. ClassDB::bind_method(D_METHOD("_selected_a_vcs"), &VersionControlEditorPlugin::_selected_a_vcs);
  8. ClassDB::bind_method(D_METHOD("_initialize_vcs"), &VersionControlEditorPlugin::_initialize_vcs);
  9. ClassDB::bind_method(D_METHOD("_send_commit_msg"), &VersionControlEditorPlugin::_send_commit_msg);
  10. ClassDB::bind_method(D_METHOD("_refresh_stage_area"), &VersionControlEditorPlugin::_refresh_stage_area);
  11. ClassDB::bind_method(D_METHOD("_stage_all"), &VersionControlEditorPlugin::_stage_all);
  12. ClassDB::bind_method(D_METHOD("_stage_selected"), &VersionControlEditorPlugin::_stage_selected);
  13. ClassDB::bind_method(D_METHOD("_view_file_diff"), &VersionControlEditorPlugin::_view_file_diff);
  14. ClassDB::bind_method(D_METHOD("_refresh_file_diff"), &VersionControlEditorPlugin::_refresh_file_diff);
  15. ClassDB::bind_method(D_METHOD("popup_vcs_set_up_dialog"), &VersionControlEditorPlugin::popup_vcs_set_up_dialog);
  16. // Used to track the status of files in the staging area
  17. BIND_ENUM_CONSTANT(CHANGE_TYPE_NEW);
  18. BIND_ENUM_CONSTANT(CHANGE_TYPE_MODIFIED);
  19. BIND_ENUM_CONSTANT(CHANGE_TYPE_RENAMED);
  20. BIND_ENUM_CONSTANT(CHANGE_TYPE_DELETED);
  21. BIND_ENUM_CONSTANT(CHANGE_TYPE_TYPECHANGE);
  22. }
  23. void VersionControlEditorPlugin::_selected_a_vcs(int p_id) {
  24. List<StringName> available_addons = get_available_vcs_names();
  25. const StringName selected_vcs = set_up_choice->get_item_text(p_id);
  26. if (available_addons.find(selected_vcs) != NULL) {
  27. set_up_init_button->set_disabled(false);
  28. } else {
  29. set_up_init_button->set_disabled(true);
  30. }
  31. }
  32. void VersionControlEditorPlugin::_populate_available_vcs_names() {
  33. static bool called = false;
  34. if (!called) {
  35. set_up_choice->add_item("Select an available VCS");
  36. fetch_available_vcs_addon_names();
  37. List<StringName> available_addons = get_available_vcs_names();
  38. for (int i = 0; i < available_addons.size(); i++) {
  39. set_up_choice->add_item(available_addons[i]);
  40. }
  41. called = true;
  42. }
  43. }
  44. VersionControlEditorPlugin *VersionControlEditorPlugin::get_singleton() {
  45. return singleton ? singleton : memnew(VersionControlEditorPlugin);
  46. }
  47. void VersionControlEditorPlugin::popup_vcs_set_up_dialog(const Control *p_gui_base) {
  48. Size2 popup_size = Size2(400, 100);
  49. Size2 window_size = p_gui_base->get_viewport_rect().size;
  50. popup_size.x = MIN(window_size.x * 0.5, popup_size.x);
  51. popup_size.y = MIN(window_size.y * 0.5, popup_size.y);
  52. if (get_is_vcs_intialized()) {
  53. set_up_init_button->set_disabled(true);
  54. }
  55. _populate_available_vcs_names();
  56. set_up_dialog->popup_centered_clamped(popup_size * EDSCALE);
  57. }
  58. void VersionControlEditorPlugin::_initialize_vcs() {
  59. register_editor();
  60. if (EditorVCSInterface::get_singleton()) {
  61. ERR_EXPLAIN(EditorVCSInterface::get_singleton()->get_vcs_name() + " is already active");
  62. return;
  63. }
  64. int id = set_up_choice->get_selected_id();
  65. String selected_addon = set_up_choice->get_item_text(id);
  66. String path = ScriptServer::get_global_class_path(selected_addon);
  67. Ref<Script> script = ResourceLoader::load(path);
  68. if (!script.is_valid()) {
  69. ERR_EXPLAIN("VCS Addon path is invalid");
  70. }
  71. EditorVCSInterface *vcs_interface = memnew(EditorVCSInterface);
  72. ScriptInstance *addon_script_instance = script->instance_create(vcs_interface);
  73. if (!addon_script_instance) {
  74. ERR_FAIL_NULL(addon_script_instance);
  75. return;
  76. }
  77. // The addon is attached as a script to the VCS interface as a proxy end-point
  78. vcs_interface->set_script_and_instance(script.get_ref_ptr(), addon_script_instance);
  79. EditorVCSInterface::set_singleton(vcs_interface);
  80. EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_refresh_stage_area");
  81. String res_dir = OS::get_singleton()->get_resource_dir();
  82. if (!EditorVCSInterface::get_singleton()->initialize(res_dir)) {
  83. ERR_EXPLAIN("VCS was not initialized");
  84. }
  85. _refresh_stage_area();
  86. }
  87. void VersionControlEditorPlugin::_send_commit_msg() {
  88. String msg = commit_message->get_text();
  89. if (msg == "") {
  90. commit_status->set_text(TTR("No commit message was provided"));
  91. return;
  92. }
  93. if (EditorVCSInterface::get_singleton()) {
  94. if (staged_files_count == 0) {
  95. commit_status->set_text(TTR("No files added to stage"));
  96. return;
  97. }
  98. EditorVCSInterface::get_singleton()->commit(msg);
  99. commit_message->set_text("");
  100. version_control_dock_button->set_pressed(false);
  101. } else {
  102. WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu");
  103. }
  104. _update_commit_status();
  105. _refresh_stage_area();
  106. _clear_file_diff();
  107. }
  108. void VersionControlEditorPlugin::_refresh_stage_area() {
  109. if (EditorVCSInterface::get_singleton()) {
  110. staged_files_count = 0;
  111. clear_stage_area();
  112. Dictionary modified_file_paths = EditorVCSInterface::get_singleton()->get_modified_files_data();
  113. String file_path;
  114. for (int i = 0; i < modified_file_paths.size(); i++) {
  115. file_path = modified_file_paths.get_key_at_index(i);
  116. TreeItem *found = stage_files->search_item_text(file_path, 0, true);
  117. if (!found) {
  118. ChangeType change_index = (ChangeType)(int)modified_file_paths.get_value_at_index(i);
  119. String change_text = file_path + " (" + change_type_to_strings[change_index] + ")";
  120. Color &change_color = change_type_to_color[change_index];
  121. TreeItem *new_item = stage_files->create_item(stage_files->get_root());
  122. new_item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
  123. new_item->set_text(0, change_text);
  124. new_item->set_metadata(0, file_path);
  125. new_item->set_custom_color(0, change_color);
  126. new_item->set_checked(0, true);
  127. new_item->set_editable(0, true);
  128. } else {
  129. if (found->get_metadata(0) == diff_file_name->get_text()) {
  130. _refresh_file_diff();
  131. }
  132. }
  133. commit_status->set_text("New changes detected");
  134. }
  135. } else {
  136. WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu.")
  137. }
  138. }
  139. void VersionControlEditorPlugin::_stage_selected() {
  140. if (!EditorVCSInterface::get_singleton()) {
  141. WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu");
  142. return;
  143. }
  144. staged_files_count = 0;
  145. TreeItem *root = stage_files->get_root();
  146. if (root) {
  147. TreeItem *file_entry = root->get_children();
  148. while (file_entry) {
  149. if (file_entry->is_checked(0)) {
  150. EditorVCSInterface::get_singleton()->stage_file(file_entry->get_metadata(0));
  151. file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor"));
  152. staged_files_count++;
  153. } else {
  154. EditorVCSInterface::get_singleton()->unstage_file(file_entry->get_metadata(0));
  155. file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
  156. }
  157. file_entry = file_entry->get_next();
  158. }
  159. }
  160. _update_stage_status();
  161. }
  162. void VersionControlEditorPlugin::_stage_all() {
  163. if (!EditorVCSInterface::get_singleton()) {
  164. WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu");
  165. return;
  166. }
  167. staged_files_count = 0;
  168. TreeItem *root = stage_files->get_root();
  169. if (root) {
  170. TreeItem *file_entry = root->get_children();
  171. while (file_entry) {
  172. EditorVCSInterface::get_singleton()->stage_file(file_entry->get_metadata(0));
  173. file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor"));
  174. file_entry->set_checked(0, true);
  175. staged_files_count++;
  176. file_entry = file_entry->get_next();
  177. }
  178. }
  179. _update_stage_status();
  180. }
  181. void VersionControlEditorPlugin::_view_file_diff() {
  182. version_control_dock_button->set_pressed(true);
  183. String file_path = stage_files->get_selected()->get_metadata(0);
  184. _display_file_diff(file_path);
  185. }
  186. void VersionControlEditorPlugin::_display_file_diff(String p_file_path) {
  187. Array diff_content = EditorVCSInterface::get_singleton()->get_file_diff(p_file_path);
  188. diff_file_name->set_text(p_file_path);
  189. diff->clear();
  190. diff->push_font(EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"));
  191. for (int i = 0; i < diff_content.size(); i++) {
  192. Dictionary line_result = diff_content[i];
  193. if (line_result["status"] == "+") {
  194. diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor"));
  195. } else if (line_result["status"] == "-") {
  196. diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
  197. } else {
  198. diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_color("font_color", "Label"));
  199. }
  200. diff->add_text((String)line_result["content"]);
  201. diff->pop();
  202. }
  203. diff->pop();
  204. }
  205. void VersionControlEditorPlugin::_refresh_file_diff() {
  206. String open_file = diff_file_name->get_text();
  207. if (open_file != "") {
  208. _display_file_diff(diff_file_name->get_text());
  209. }
  210. }
  211. void VersionControlEditorPlugin::_clear_file_diff() {
  212. diff->clear();
  213. diff_file_name->set_text("");
  214. version_control_dock_button->set_pressed(false);
  215. }
  216. void VersionControlEditorPlugin::_update_stage_status() {
  217. String status;
  218. if (staged_files_count == 1) {
  219. status = "Stage contains 1 file";
  220. } else {
  221. status = "Stage contains " + String::num_int64(staged_files_count) + " files";
  222. }
  223. commit_status->set_text(status);
  224. }
  225. void VersionControlEditorPlugin::_update_commit_status() {
  226. String status;
  227. if (staged_files_count == 1) {
  228. status = "Committed 1 file";
  229. } else {
  230. status = "Committed " + String::num_int64(staged_files_count) + " files ";
  231. }
  232. commit_status->set_text(status);
  233. staged_files_count = 0;
  234. }
  235. void VersionControlEditorPlugin::register_editor() {
  236. if (!EditorVCSInterface::get_singleton()) {
  237. EditorNode::get_singleton()->add_control_to_dock(EditorNode::DOCK_SLOT_RIGHT_UL, version_commit_dock);
  238. TabContainer *dock_vbc = (TabContainer *)version_commit_dock->get_parent_control();
  239. dock_vbc->set_tab_title(version_commit_dock->get_index(), TTR("Commit"));
  240. ToolButton *vc = EditorNode::get_singleton()->add_bottom_panel_item(TTR("Version Control"), version_control_dock);
  241. set_version_control_tool_button(vc);
  242. }
  243. }
  244. void VersionControlEditorPlugin::fetch_available_vcs_addon_names() {
  245. ScriptServer::get_global_class_list(&available_addons);
  246. }
  247. void VersionControlEditorPlugin::clear_stage_area() {
  248. stage_files->get_root()->clear_children();
  249. }
  250. void VersionControlEditorPlugin::shut_down() {
  251. if (EditorVCSInterface::get_singleton()) {
  252. EditorFileSystem::get_singleton()->disconnect("filesystem_changed", this, "_refresh_stage_area");
  253. EditorVCSInterface::get_singleton()->shut_down();
  254. memdelete(EditorVCSInterface::get_singleton());
  255. EditorVCSInterface::set_singleton(NULL);
  256. EditorNode::get_singleton()->remove_control_from_dock(version_commit_dock);
  257. EditorNode::get_singleton()->remove_bottom_panel_item(version_control_dock);
  258. }
  259. }
  260. bool VersionControlEditorPlugin::get_is_vcs_intialized() const {
  261. return EditorVCSInterface::get_singleton() ? EditorVCSInterface::get_singleton()->get_is_vcs_intialized() : false;
  262. }
  263. const String VersionControlEditorPlugin::get_vcs_name() const {
  264. return EditorVCSInterface::get_singleton() ? EditorVCSInterface::get_singleton()->get_vcs_name() : "";
  265. }
  266. VersionControlEditorPlugin::VersionControlEditorPlugin() {
  267. singleton = this;
  268. staged_files_count = 0;
  269. version_control_actions = memnew(PopupMenu);
  270. version_control_actions->set_v_size_flags(BoxContainer::SIZE_SHRINK_CENTER);
  271. set_up_dialog = memnew(AcceptDialog);
  272. set_up_dialog->set_title(TTR("Set Up Version Control"));
  273. set_up_dialog->set_custom_minimum_size(Size2(400, 100));
  274. version_control_actions->add_child(set_up_dialog);
  275. set_up_ok_button = set_up_dialog->get_ok();
  276. set_up_ok_button->set_disabled(false);
  277. set_up_ok_button->set_text(TTR("Close"));
  278. set_up_vbc = memnew(VBoxContainer);
  279. set_up_vbc->set_alignment(VBoxContainer::ALIGN_CENTER);
  280. set_up_dialog->add_child(set_up_vbc);
  281. set_up_hbc = memnew(HBoxContainer);
  282. set_up_hbc->set_h_size_flags(HBoxContainer::SIZE_EXPAND_FILL);
  283. set_up_vbc->add_child(set_up_hbc);
  284. set_up_vcs_status = memnew(RichTextLabel);
  285. set_up_vcs_status->set_text(TTR("VCS Addon is not initialized"));
  286. set_up_vbc->add_child(set_up_vcs_status);
  287. set_up_vcs_label = memnew(Label);
  288. set_up_vcs_label->set_text(TTR("Version Control System"));
  289. set_up_hbc->add_child(set_up_vcs_label);
  290. set_up_choice = memnew(OptionButton);
  291. set_up_choice->set_h_size_flags(HBoxContainer::SIZE_EXPAND_FILL);
  292. set_up_choice->connect("item_selected", this, "_selected_a_vcs");
  293. set_up_hbc->add_child(set_up_choice);
  294. set_up_init_settings = NULL;
  295. set_up_init_button = memnew(Button);
  296. set_up_init_button->set_disabled(true);
  297. set_up_init_button->set_text(TTR("Initialize"));
  298. set_up_init_button->connect("pressed", this, "_initialize_vcs");
  299. set_up_vbc->add_child(set_up_init_button);
  300. version_control_actions->set_v_size_flags(PopupMenu::SIZE_EXPAND_FILL);
  301. version_control_actions->set_h_size_flags(PopupMenu::SIZE_EXPAND_FILL);
  302. version_commit_dock = memnew(VBoxContainer);
  303. version_commit_dock->set_visible(false);
  304. commit_box_vbc = memnew(VBoxContainer);
  305. commit_box_vbc->set_alignment(VBoxContainer::ALIGN_BEGIN);
  306. commit_box_vbc->set_h_size_flags(VBoxContainer::SIZE_EXPAND_FILL);
  307. commit_box_vbc->set_v_size_flags(VBoxContainer::SIZE_EXPAND_FILL);
  308. version_commit_dock->add_child(commit_box_vbc);
  309. stage_tools = memnew(HSplitContainer);
  310. stage_tools->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN_COLLAPSED);
  311. commit_box_vbc->add_child(stage_tools);
  312. staging_area_label = memnew(Label);
  313. staging_area_label->set_h_size_flags(Label::SIZE_EXPAND_FILL);
  314. staging_area_label->set_text(TTR("Staging area"));
  315. stage_tools->add_child(staging_area_label);
  316. refresh_button = memnew(Button);
  317. refresh_button->set_tooltip(TTR("Detect new changes"));
  318. refresh_button->set_text(TTR("Refresh"));
  319. refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Reload", "EditorIcons"));
  320. refresh_button->connect("pressed", this, "_refresh_stage_area");
  321. stage_tools->add_child(refresh_button);
  322. stage_files = memnew(Tree);
  323. stage_files->set_h_size_flags(Tree::SIZE_EXPAND_FILL);
  324. stage_files->set_v_size_flags(Tree::SIZE_EXPAND_FILL);
  325. stage_files->set_columns(1);
  326. stage_files->set_column_title(0, TTR("Changes"));
  327. stage_files->set_column_titles_visible(true);
  328. stage_files->set_allow_reselect(true);
  329. stage_files->set_allow_rmb_select(true);
  330. stage_files->set_select_mode(Tree::SelectMode::SELECT_MULTI);
  331. stage_files->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);
  332. stage_files->connect("cell_selected", this, "_view_file_diff");
  333. stage_files->create_item();
  334. stage_files->set_hide_root(true);
  335. commit_box_vbc->add_child(stage_files);
  336. change_type_to_strings[CHANGE_TYPE_NEW] = TTR("New");
  337. change_type_to_strings[CHANGE_TYPE_MODIFIED] = TTR("Modified");
  338. change_type_to_strings[CHANGE_TYPE_RENAMED] = TTR("Renamed");
  339. change_type_to_strings[CHANGE_TYPE_DELETED] = TTR("Deleted");
  340. change_type_to_strings[CHANGE_TYPE_TYPECHANGE] = TTR("Typechange");
  341. change_type_to_color[CHANGE_TYPE_NEW] = EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor");
  342. change_type_to_color[CHANGE_TYPE_MODIFIED] = EditorNode::get_singleton()->get_gui_base()->get_color("warning_color", "Editor");
  343. change_type_to_color[CHANGE_TYPE_RENAMED] = EditorNode::get_singleton()->get_gui_base()->get_color("disabled_font_color", "Editor");
  344. change_type_to_color[CHANGE_TYPE_DELETED] = EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor");
  345. change_type_to_color[CHANGE_TYPE_TYPECHANGE] = EditorNode::get_singleton()->get_gui_base()->get_color("font_color", "Editor");
  346. stage_buttons = memnew(HSplitContainer);
  347. stage_buttons->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN_COLLAPSED);
  348. commit_box_vbc->add_child(stage_buttons);
  349. stage_selected_button = memnew(Button);
  350. stage_selected_button->set_h_size_flags(Button::SIZE_EXPAND_FILL);
  351. stage_selected_button->set_text(TTR("Stage Selected"));
  352. stage_selected_button->connect("pressed", this, "_stage_selected");
  353. stage_buttons->add_child(stage_selected_button);
  354. stage_all_button = memnew(Button);
  355. stage_all_button->set_text(TTR("Stage All"));
  356. stage_all_button->connect("pressed", this, "_stage_all");
  357. stage_buttons->add_child(stage_all_button);
  358. commit_box_vbc->add_child(memnew(HSeparator));
  359. commit_message = memnew(TextEdit);
  360. commit_message->set_h_size_flags(Control::SIZE_EXPAND_FILL);
  361. commit_message->set_h_grow_direction(Control::GrowDirection::GROW_DIRECTION_BEGIN);
  362. commit_message->set_v_grow_direction(Control::GrowDirection::GROW_DIRECTION_END);
  363. commit_message->set_custom_minimum_size(Size2(200, 100));
  364. commit_message->set_wrap_enabled(true);
  365. commit_message->set_text(TTR("Add a commit message"));
  366. commit_box_vbc->add_child(commit_message);
  367. commit_button = memnew(Button);
  368. commit_button->set_text(TTR("Commit Changes"));
  369. commit_button->connect("pressed", this, "_send_commit_msg");
  370. commit_box_vbc->add_child(commit_button);
  371. commit_status = memnew(Label);
  372. commit_status->set_align(Label::ALIGN_CENTER);
  373. commit_box_vbc->add_child(commit_status);
  374. version_control_dock = memnew(PanelContainer);
  375. version_control_dock->set_v_size_flags(Control::SIZE_EXPAND_FILL);
  376. version_control_dock->hide();
  377. diff_vbc = memnew(VBoxContainer);
  378. diff_vbc->set_h_size_flags(HBoxContainer::SIZE_FILL);
  379. diff_vbc->set_v_size_flags(HBoxContainer::SIZE_FILL);
  380. version_control_dock->add_child(diff_vbc);
  381. diff_hbc = memnew(HBoxContainer);
  382. diff_hbc->set_h_size_flags(HBoxContainer::SIZE_FILL);
  383. diff_vbc->add_child(diff_hbc);
  384. diff_heading = memnew(Label);
  385. diff_heading->set_text(TTR("Status"));
  386. diff_heading->set_tooltip(TTR("View file diffs before commiting them to the latest version"));
  387. diff_hbc->add_child(diff_heading);
  388. diff_file_name = memnew(Label);
  389. diff_file_name->set_text(TTR("No file diff is active"));
  390. diff_file_name->set_h_size_flags(Label::SIZE_EXPAND_FILL);
  391. diff_file_name->set_align(Label::ALIGN_RIGHT);
  392. diff_hbc->add_child(diff_file_name);
  393. diff_refresh_button = memnew(Button);
  394. diff_refresh_button->set_tooltip(TTR("Detect changes in file diff"));
  395. diff_refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Reload", "EditorIcons"));
  396. diff_refresh_button->connect("pressed", this, "_refresh_file_diff");
  397. diff_hbc->add_child(diff_refresh_button);
  398. diff = memnew(RichTextLabel);
  399. diff->set_h_size_flags(TextEdit::SIZE_EXPAND_FILL);
  400. diff->set_v_size_flags(TextEdit::SIZE_EXPAND_FILL);
  401. diff->set_selection_enabled(true);
  402. diff_vbc->add_child(diff);
  403. }
  404. VersionControlEditorPlugin::~VersionControlEditorPlugin() {
  405. shut_down();
  406. memdelete(version_control_dock);
  407. memdelete(version_commit_dock);
  408. memdelete(version_control_actions);
  409. }