summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp13
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 4932b6ddec..bf715e6e9b 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -690,6 +690,9 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action()
m_open_files_vector.append(relative_file_path);
update_window_title();
+
+ m_project->model().invalidate();
+ update_tree_view();
});
}
@@ -887,6 +890,7 @@ void HackStudioWidget::set_current_editor_wrapper(RefPtr<EditorWrapper> editor_w
{
m_current_editor_wrapper = editor_wrapper;
update_window_title();
+ update_tree_view();
}
void HackStudioWidget::configure_project_tree_view()
@@ -1257,6 +1261,15 @@ void HackStudioWidget::update_gml_preview()
m_gml_preview_widget->load_gml(gml_content);
}
+void HackStudioWidget::update_tree_view()
+{
+ auto index = m_project->model().index(m_current_editor_wrapper->filename(), GUI::FileSystemModel::Column::Name);
+ if (index.is_valid()) {
+ m_project_tree_view->expand_all_parents_of(index);
+ m_project_tree_view->set_cursor(index, GUI::AbstractView::SelectionUpdate::Set);
+ }
+}
+
void HackStudioWidget::update_window_title()
{
window()->set_title(String::formatted("{} - {} - Hack Studio", m_current_editor_wrapper->filename_label().text(), m_project->name()));
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.h b/Userland/DevTools/HackStudio/HackStudioWidget.h
index 8703eeb312..b690676e5e 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.h
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.h
@@ -125,6 +125,7 @@ private:
bool any_document_is_dirty() const;
void update_gml_preview();
+ void update_tree_view();
void update_window_title();
NonnullRefPtrVector<EditorWrapper> m_all_editor_wrappers;