Remove RemoveWorktreeFromProject internal action

This commit is contained in:
Antonio Scandurra
2023-04-28 12:11:59 +02:00
parent 71a4bc7905
commit 6857426b78
2 changed files with 5 additions and 22 deletions
+4 -4
View File
@@ -301,10 +301,10 @@ impl ProjectPanel {
workspace::AddFolderToProject,
));
if is_root {
menu_entries.push(ContextMenuItem::action(
"Remove from Project",
workspace::RemoveWorktreeFromProject(worktree_id),
));
let project = self.project.clone();
menu_entries.push(ContextMenuItem::handler("Remove from Project", move |cx| {
project.update(cx, |project, cx| project.remove_worktree(worktree_id, cx));
}));
}
}
menu_entries.push(ContextMenuItem::action("New File", NewFile));
+1 -18
View File
@@ -201,14 +201,7 @@ impl Clone for Toast {
pub type WorkspaceId = i64;
impl_internal_actions!(
workspace,
[
RemoveWorktreeFromProject,
SplitWithItem,
SplitWithProjectEntry,
]
);
impl_internal_actions!(workspace, [SplitWithItem, SplitWithProjectEntry,]);
impl_actions!(workspace, [ActivatePane]);
pub fn init(app_state: Arc<AppState>, cx: &mut AppContext) {
@@ -285,7 +278,6 @@ pub fn init(app_state: Arc<AppState>, cx: &mut AppContext) {
cx.add_global_action(Workspace::close_global);
cx.add_async_action(Workspace::save_all);
cx.add_action(Workspace::add_folder_to_project);
cx.add_action(Workspace::remove_folder_from_project);
cx.add_action(
|workspace: &mut Workspace, _: &Unfollow, cx: &mut ViewContext<Workspace>| {
let pane = workspace.active_pane().clone();
@@ -1234,15 +1226,6 @@ impl Workspace {
.detach_and_log_err(cx);
}
fn remove_folder_from_project(
&mut self,
RemoveWorktreeFromProject(worktree_id): &RemoveWorktreeFromProject,
cx: &mut ViewContext<Self>,
) {
self.project
.update(cx, |project, cx| project.remove_worktree(*worktree_id, cx));
}
fn project_path_for_path(
project: ModelHandle<Project>,
abs_path: &Path,