Struct workspace2::Workspace
source · pub struct Workspace { /* private fields */ }
Implementations§
source§impl Workspace
impl Workspace
pub fn has_shown_notification_once<V: Notification>( &self, id: usize, cx: &ViewContext<'_, Self> ) -> bool
pub fn show_notification_once<V: Notification>( &mut self, id: usize, cx: &mut ViewContext<'_, Self>, build_notification: impl FnOnce(&mut ViewContext<'_, Self>) -> View<V> )
pub fn show_notification<V: Notification>( &mut self, id: usize, cx: &mut ViewContext<'_, Self>, build_notification: impl FnOnce(&mut ViewContext<'_, Self>) -> View<V> )
pub fn dismiss_notification<V: Notification>( &mut self, id: usize, cx: &mut ViewContext<'_, Self> )
pub fn show_toast(&mut self, toast: Toast, cx: &mut ViewContext<'_, Self>)
pub fn dismiss_toast(&mut self, id: usize, cx: &mut ViewContext<'_, Self>)
source§impl Workspace
impl Workspace
pub fn new( workspace_id: WorkspaceId, project: Model<Project>, app_state: Arc<AppState>, cx: &mut ViewContext<'_, Self> ) -> Self
pub fn weak_handle(&self) -> WeakView<Self>
pub fn left_dock(&self) -> &View<Dock>
pub fn bottom_dock(&self) -> &View<Dock>
pub fn right_dock(&self) -> &View<Dock>
pub fn add_panel<T: Panel>( &mut self, panel: View<T>, cx: &mut ViewContext<'_, Self> )
pub fn status_bar(&self) -> &View<StatusBar>
pub fn app_state(&self) -> &Arc<AppState>
pub fn user_store(&self) -> &Model<UserStore>
pub fn project(&self) -> &Model<Project>
pub fn go_back( &mut self, pane: WeakView<Pane>, cx: &mut ViewContext<'_, Workspace> ) -> Task<Result<()>>
pub fn go_forward( &mut self, pane: WeakView<Pane>, cx: &mut ViewContext<'_, Workspace> ) -> Task<Result<()>>
pub fn reopen_closed_item( &mut self, cx: &mut ViewContext<'_, Workspace> ) -> Task<Result<()>>
pub fn client(&self) -> &Client
pub fn set_titlebar_item( &mut self, item: AnyView, cx: &mut ViewContext<'_, Self> )
pub fn titlebar_item(&self) -> Option<AnyView>
sourcepub fn with_local_workspace<T, F>(
&mut self,
cx: &mut ViewContext<'_, Self>,
callback: F
) -> Task<Result<T>>where
T: 'static,
F: 'static + FnOnce(&mut Workspace, &mut ViewContext<'_, Workspace>) -> T,
pub fn with_local_workspace<T, F>( &mut self, cx: &mut ViewContext<'_, Self>, callback: F ) -> Task<Result<T>>where T: 'static, F: 'static + FnOnce(&mut Workspace, &mut ViewContext<'_, Workspace>) -> T,
Call the given callback with a workspace whose project is local.
If the given workspace has a local project, then it will be passed to the callback. Otherwise, a new empty window will be created.
pub fn worktrees<'a>( &self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = Model<Worktree>>
pub fn visible_worktrees<'a>( &self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = Model<Worktree>>
pub fn worktree_scans_complete( &self, cx: &AppContext ) -> impl Future<Output = ()> + 'static
pub fn close_global(_: &CloseWindow, cx: &mut AppContext)
pub fn close( &mut self, _: &CloseWindow, cx: &mut ViewContext<'_, Self> ) -> Option<Task<Result<()>>>
pub fn prepare_to_close( &mut self, quitting: bool, cx: &mut ViewContext<'_, Self> ) -> Task<Result<bool>>
pub fn open(&mut self, _: &Open, cx: &mut ViewContext<'_, Self>)
pub fn open_workspace_for_paths( &mut self, paths: Vec<PathBuf>, cx: &mut ViewContext<'_, Self> ) -> Task<Result<()>>
pub fn open_paths( &mut self, abs_paths: Vec<PathBuf>, visible: bool, cx: &mut ViewContext<'_, Self> ) -> Task<Vec<Option<Result<Box<dyn ItemHandle>, Error>>>>
pub fn items<'a>( &'a self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = &Box<dyn ItemHandle>>
pub fn item_of_type<T: Item>(&self, cx: &AppContext) -> Option<View<T>>
pub fn items_of_type<'a, T: Item>( &'a self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = View<T>>
pub fn active_item(&self, cx: &AppContext) -> Option<Box<dyn ItemHandle>>
pub fn active_item_as<I: 'static>(&self, cx: &AppContext) -> Option<View<I>>
pub fn save_active_item( &mut self, save_intent: SaveIntent, cx: &mut ViewContext<'_, Self> ) -> Task<Result<()>>
pub fn close_inactive_items_and_panes( &mut self, _: &CloseInactiveTabsAndPanes, cx: &mut ViewContext<'_, Self> )
pub fn close_all_items_and_panes( &mut self, action: &CloseAllItemsAndPanes, cx: &mut ViewContext<'_, Self> )
pub fn toggle_dock( &mut self, dock_side: DockPosition, cx: &mut ViewContext<'_, Self> )
pub fn close_all_docks(&mut self, cx: &mut ViewContext<'_, Self>)
sourcepub fn focus_panel<T: Panel>(
&mut self,
cx: &mut ViewContext<'_, Self>
) -> Option<View<T>>
pub fn focus_panel<T: Panel>( &mut self, cx: &mut ViewContext<'_, Self> ) -> Option<View<T>>
Transfer focus to the panel of the given type.
sourcepub fn toggle_panel_focus<T: Panel>(&mut self, cx: &mut ViewContext<'_, Self>)
pub fn toggle_panel_focus<T: Panel>(&mut self, cx: &mut ViewContext<'_, Self>)
Focus the panel of the given type if it isn’t already focused. If it is already focused, then transfer focus back to the workspace center.
pub fn panel<T: Panel>(&self, cx: &WindowContext<'_>) -> Option<View<T>>
pub fn add_item( &mut self, item: Box<dyn ItemHandle>, cx: &mut ViewContext<'_, Self> )
pub fn split_item( &mut self, split_direction: SplitDirection, item: Box<dyn ItemHandle>, cx: &mut ViewContext<'_, Self> )
pub fn open_abs_path( &mut self, abs_path: PathBuf, visible: bool, cx: &mut ViewContext<'_, Self> ) -> Task<Result<Box<dyn ItemHandle>>>
pub fn split_abs_path( &mut self, abs_path: PathBuf, visible: bool, cx: &mut ViewContext<'_, Self> ) -> Task<Result<Box<dyn ItemHandle>>>
pub fn open_path( &mut self, path: impl Into<ProjectPath>, pane: Option<WeakView<Pane>>, focus_item: bool, cx: &mut ViewContext<'_, Self> ) -> Task<Result<Box<dyn ItemHandle>, Error>>
pub fn split_path( &mut self, path: impl Into<ProjectPath>, cx: &mut ViewContext<'_, Self> ) -> Task<Result<Box<dyn ItemHandle>, Error>>
pub fn open_project_item<T>( &mut self, project_item: Model<T::Item>, cx: &mut ViewContext<'_, Self> ) -> View<T>where T: ProjectItem,
pub fn split_project_item<T>( &mut self, project_item: Model<T::Item>, cx: &mut ViewContext<'_, Self> ) -> View<T>where T: ProjectItem,
pub fn activate_item( &mut self, item: &dyn ItemHandle, cx: &mut ViewContext<'_, Self> ) -> bool
pub fn activate_next_pane(&mut self, cx: &mut ViewContext<'_, Self>)
pub fn activate_previous_pane(&mut self, cx: &mut ViewContext<'_, Self>)
pub fn activate_pane_in_direction( &mut self, direction: SplitDirection, cx: &mut ViewContext<'_, Self> )
pub fn swap_pane_in_direction( &mut self, direction: SplitDirection, cx: &mut ViewContext<'_, Self> )
pub fn split_pane( &mut self, pane_to_split: View<Pane>, split_direction: SplitDirection, cx: &mut ViewContext<'_, Self> ) -> View<Pane>
pub fn split_and_clone( &mut self, pane: View<Pane>, direction: SplitDirection, cx: &mut ViewContext<'_, Self> ) -> Option<View<Pane>>
pub fn split_pane_with_item( &mut self, pane_to_split: WeakView<Pane>, split_direction: SplitDirection, from: WeakView<Pane>, item_id_to_move: EntityId, cx: &mut ViewContext<'_, Self> )
pub fn split_pane_with_project_entry( &mut self, pane_to_split: WeakView<Pane>, split_direction: SplitDirection, project_entry: ProjectEntryId, cx: &mut ViewContext<'_, Self> ) -> Option<Task<Result<()>>>
pub fn move_item( &mut self, source: View<Pane>, destination: View<Pane>, item_id_to_move: EntityId, destination_index: usize, cx: &mut ViewContext<'_, Self> )
pub fn panes(&self) -> &[View<Pane>]
pub fn active_pane(&self) -> &View<Pane>
pub fn unfollow( &mut self, pane: &View<Pane>, cx: &mut ViewContext<'_, Self> ) -> Option<PeerId>
pub fn leader_for_pane(&self, pane: &View<Pane>) -> Option<PeerId>
pub fn on_window_activation_changed(&mut self, cx: &mut ViewContext<'_, Self>)
pub fn database_id(&self) -> WorkspaceId
pub fn register_action<A: Action>( &mut self, callback: impl Fn(&mut Self, &A, &mut ViewContext<'_, Self>) + 'static ) -> &mut Self
pub fn active_modal<V: ManagedView + 'static>( &mut self, cx: &ViewContext<'_, Self> ) -> Option<View<V>>
pub fn toggle_modal<V: ManagedView, B>( &mut self, cx: &mut ViewContext<'_, Self>, build: B )where B: FnOnce(&mut ViewContext<'_, V>) -> V,
Trait Implementations§
source§impl FocusableView for Workspace
impl FocusableView for Workspace
fn focus_handle(&self, cx: &AppContext) -> FocusHandle
impl EventEmitter<Event> for Workspace
Auto Trait Implementations§
impl !RefUnwindSafe for Workspace
impl !Send for Workspace
impl !Sync for Workspace
impl Unpin for Workspace
impl !UnwindSafe for Workspace
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more