Skip to content

Commit d9c295d

Browse files
donaghylennonawesomekling
authored andcommitted
HackStudio: Moved code closing project from open_project to own method
Take the code which closes the current project out of open_project method and move it into its own method.
1 parent 3ce9613 commit d9c295d

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

Userland/DevTools/HackStudio/HackStudioWidget.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,7 @@ void HackStudioWidget::open_project(const String& root_path)
194194
exit(1);
195195
}
196196
if (m_project) {
197-
m_editors_splitter->remove_all_children();
198-
m_all_editor_wrappers.clear();
199-
m_open_files.clear();
200-
m_open_files_vector.clear();
201-
add_new_editor(*m_editors_splitter);
202-
m_find_in_files_widget->reset();
203-
m_todo_entries_widget->clear();
204-
m_terminal_wrapper->clear_including_history();
205-
stop_debugger_if_running();
206-
update_gml_preview();
197+
close_current_project();
207198
}
208199
m_project = Project::open_with_root_path(root_path);
209200
VERIFY(m_project);
@@ -1169,6 +1160,20 @@ void HackStudioWidget::stop_debugger_if_running()
11691160
}
11701161
}
11711162

1163+
void HackStudioWidget::close_current_project()
1164+
{
1165+
m_editors_splitter->remove_all_children();
1166+
m_all_editor_wrappers.clear();
1167+
m_open_files.clear();
1168+
m_open_files_vector.clear();
1169+
add_new_editor(*m_editors_splitter);
1170+
m_find_in_files_widget->reset();
1171+
m_todo_entries_widget->clear();
1172+
m_terminal_wrapper->clear_including_history();
1173+
stop_debugger_if_running();
1174+
update_gml_preview();
1175+
}
1176+
11721177
HackStudioWidget::~HackStudioWidget()
11731178
{
11741179
stop_debugger_if_running();

Userland/DevTools/HackStudio/HackStudioWidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class HackStudioWidget : public GUI::Widget {
104104

105105
void handle_external_file_deletion(const String& filepath);
106106
void stop_debugger_if_running();
107+
void close_current_project();
107108

108109
void create_open_files_view(GUI::Widget& parent);
109110
void create_toolbar(GUI::Widget& parent);

0 commit comments

Comments
 (0)