diff options
Diffstat (limited to 'Userland/DevTools/HackStudio/HackStudioWidget.cpp')
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index c1dfe48626..d63ba895e8 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -471,6 +471,7 @@ NonnullRefPtr<GUI::Menu> HackStudioWidget::create_project_tree_view_context_menu m_new_plain_file_action = create_new_file_action("Plain &File", "/res/icons/16x16/new.png", ""); m_open_selected_action = create_open_selected_action(); + m_open_selected_in_new_tab_action = create_open_selected_in_new_tab_action(); m_show_in_file_manager_action = create_show_in_file_manager_action(); m_new_directory_action = create_new_directory_action(); @@ -490,6 +491,7 @@ NonnullRefPtr<GUI::Menu> HackStudioWidget::create_project_tree_view_context_menu new_file_submenu.add_action(*m_new_directory_action); project_tree_view_context_menu->add_action(*m_open_selected_action); + project_tree_view_context_menu->add_action(*m_open_selected_in_new_tab_action); project_tree_view_context_menu->add_action(*m_show_in_file_manager_action); // TODO: Cut, copy, duplicate with new name... project_tree_view_context_menu->add_separator(); @@ -582,6 +584,20 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_open_selected_action() return open_selected_action; } +NonnullRefPtr<GUI::Action> HackStudioWidget::create_open_selected_in_new_tab_action() +{ + auto open_selected_in_new_tab_action = GUI::Action::create("Open in New &Tab", [this](const GUI::Action&) { + auto files = selected_file_paths(); + for (auto& file : files) { + add_new_editor(*m_current_editor_tab_widget); + open_file(file); + } + }); + open_selected_in_new_tab_action->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors()); + open_selected_in_new_tab_action->set_enabled(true); + return open_selected_in_new_tab_action; +} + NonnullRefPtr<GUI::Action> HackStudioWidget::create_show_in_file_manager_action() { auto show_in_file_manager_action = GUI::Action::create("Show in File &Manager", [this](const GUI::Action&) { |