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>) -> ViewHandle<V> )
pub fn show_notification<V: Notification>( &mut self, id: usize, cx: &mut ViewContext<'_, '_, Self>, build_notification: impl FnOnce(&mut ViewContext<'_, '_, Self>) -> ViewHandle<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: ModelHandle<Project>, app_state: Arc<AppState>, cx: &mut ViewContext<'_, '_, Self> ) -> Self
pub fn weak_handle(&self) -> WeakViewHandle<Self>
pub fn left_dock(&self) -> &ViewHandle<Dock>
pub fn bottom_dock(&self) -> &ViewHandle<Dock>
pub fn right_dock(&self) -> &ViewHandle<Dock>
pub fn add_panel<T: Panel>( &mut self, panel: ViewHandle<T>, cx: &mut ViewContext<'_, '_, Self> )where T::Event: Debug,
pub fn add_panel_with_extra_event_handler<T: Panel, F>( &mut self, panel: ViewHandle<T>, cx: &mut ViewContext<'_, '_, Self>, handler: F )where T::Event: Debug, F: Fn(&mut Self, &ViewHandle<T>, &T::Event, &mut ViewContext<'_, '_, Self>) + 'static,
pub fn status_bar(&self) -> &ViewHandle<StatusBar>
pub fn app_state(&self) -> &Arc<AppState>
pub fn user_store(&self) -> &ModelHandle<UserStore>
pub fn project(&self) -> &ModelHandle<Project>
pub fn go_back( &mut self, pane: WeakViewHandle<Pane>, cx: &mut ViewContext<'_, '_, Workspace> ) -> Task<Result<()>>
pub fn go_forward( &mut self, pane: WeakViewHandle<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: AnyViewHandle, cx: &mut ViewContext<'_, '_, Self> )
pub fn titlebar_item(&self) -> Option<AnyViewHandle>
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 = ModelHandle<Worktree>>
pub fn visible_worktrees<'a>( &self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = ModelHandle<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> ) -> Option<Task<Result<()>>>
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>>>>
sourcepub fn toggle_modal<V, F>(
&mut self,
cx: &mut ViewContext<'_, '_, Self>,
add_view: F
) -> Option<ViewHandle<V>>where
V: 'static + Modal,
F: FnOnce(&mut Self, &mut ViewContext<'_, '_, Self>) -> ViewHandle<V>,
pub fn toggle_modal<V, F>( &mut self, cx: &mut ViewContext<'_, '_, Self>, add_view: F ) -> Option<ViewHandle<V>>where V: 'static + Modal, F: FnOnce(&mut Self, &mut ViewContext<'_, '_, Self>) -> ViewHandle<V>,
Returns the modal that was toggled closed if it was open.
pub fn modal<V: 'static + View>(&self) -> Option<ViewHandle<V>>
pub fn dismiss_modal( &mut self, cx: &mut ViewContext<'_, '_, Self> ) -> Option<AnyViewHandle>
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<ViewHandle<T>>
pub fn items_of_type<'a, T: Item>( &'a self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = ViewHandle<T>>
pub fn active_item(&self, cx: &AppContext) -> Option<Box<dyn ItemHandle>>
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> ) -> Option<Task<Result<()>>>
pub fn close_all_items_and_panes( &mut self, action: &CloseAllItemsAndPanes, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>
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<ViewHandle<T>>
pub fn focus_panel<T: Panel>( &mut self, cx: &mut ViewContext<'_, '_, Self> ) -> Option<ViewHandle<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<ViewHandle<T>>
pub fn add_item_to_center( &mut self, item: Box<dyn ItemHandle>, cx: &mut ViewContext<'_, '_, Self> ) -> bool
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<WeakViewHandle<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: ModelHandle<T::Item>, cx: &mut ViewContext<'_, '_, Self> ) -> ViewHandle<T>where T: ProjectItem,
pub fn split_project_item<T>( &mut self, project_item: ModelHandle<T::Item>, cx: &mut ViewContext<'_, '_, Self> ) -> ViewHandle<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: ViewHandle<Pane>, split_direction: SplitDirection, cx: &mut ViewContext<'_, '_, Self> ) -> ViewHandle<Pane>
pub fn split_and_clone( &mut self, pane: ViewHandle<Pane>, direction: SplitDirection, cx: &mut ViewContext<'_, '_, Self> ) -> Option<ViewHandle<Pane>>
pub fn split_pane_with_item( &mut self, pane_to_split: WeakViewHandle<Pane>, split_direction: SplitDirection, from: WeakViewHandle<Pane>, item_id_to_move: usize, cx: &mut ViewContext<'_, '_, Self> )
pub fn split_pane_with_project_entry( &mut self, pane_to_split: WeakViewHandle<Pane>, split_direction: SplitDirection, project_entry: ProjectEntryId, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>
pub fn move_item( &mut self, source: ViewHandle<Pane>, destination: ViewHandle<Pane>, item_id_to_move: usize, destination_index: usize, cx: &mut ViewContext<'_, '_, Self> )
pub fn panes(&self) -> &[ViewHandle<Pane>]
pub fn active_pane(&self) -> &ViewHandle<Pane>
pub fn follow_next_collaborator( &mut self, _: &FollowNextCollaborator, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>
pub fn follow( &mut self, leader_id: PeerId, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>
pub fn unfollow( &mut self, pane: &ViewHandle<Pane>, cx: &mut ViewContext<'_, '_, Self> ) -> Option<PeerId>
pub fn is_being_followed(&self, peer_id: PeerId) -> bool
pub fn leader_for_pane(&self, pane: &ViewHandle<Pane>) -> Option<PeerId>
pub fn on_window_activation_changed( &mut self, active: bool, cx: &mut ViewContext<'_, '_, Self> )
pub fn database_id(&self) -> WorkspaceId
Trait Implementations§
source§impl View for Workspace
impl View for Workspace
fn ui_name() -> &'static str
fn render(&mut self, cx: &mut ViewContext<'_, '_, Self>) -> AnyElement<Self>
fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<'_, '_, Self>)
fn modifiers_changed( &mut self, e: &ModifiersChangedEvent, cx: &mut ViewContext<'_, '_, Self> ) -> bool
fn focus_out(&mut self, _: AnyViewHandle, _: &mut ViewContext<'_, '_, Self>)
fn key_down( &mut self, _: &KeyDownEvent, _: &mut ViewContext<'_, '_, Self> ) -> bool
fn key_up(&mut self, _: &KeyUpEvent, _: &mut ViewContext<'_, '_, Self>) -> bool
fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext)
fn reset_to_default_keymap_context(keymap: &mut KeymapContext)
fn debug_json(&self, _: &AppContext) -> Value
fn text_for_range(&self, _: Range<usize>, _: &AppContext) -> Option<String>
fn selected_text_range(&self, _: &AppContext) -> Option<Range<usize>>
fn marked_text_range(&self, _: &AppContext) -> Option<Range<usize>>
fn unmark_text(&mut self, _: &mut ViewContext<'_, '_, Self>)
fn replace_text_in_range( &mut self, _: Option<Range<usize>>, _: &str, _: &mut ViewContext<'_, '_, Self> )
fn replace_and_mark_text_in_range( &mut self, _: Option<Range<usize>>, _: &str, _: Option<Range<usize>>, _: &mut ViewContext<'_, '_, Self> )
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§
§impl<T> AnyModel for Twhere
T: Entity,
impl<T> AnyModel for Twhere T: Entity,
§impl<V> AnyView for Vwhere
V: View,
impl<V> AnyView for Vwhere V: View,
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn release(&mut self, cx: &mut AppContext)
fn app_will_quit( &mut self, cx: &mut AppContext ) -> Option<Pin<Box<dyn Future<Output = ()>, Global>>>
fn ui_name(&self) -> &'static str
fn render( &mut self, cx: &mut WindowContext<'_>, view_id: usize ) -> Box<dyn AnyRootElement, Global>
fn focus_in( &mut self, focused_id: usize, cx: &mut WindowContext<'_>, view_id: usize )
fn focus_out( &mut self, blurred_id: usize, cx: &mut WindowContext<'_>, view_id: usize )
fn key_down( &mut self, event: &KeyDownEvent, cx: &mut WindowContext<'_>, view_id: usize ) -> bool
fn key_up( &mut self, event: &KeyUpEvent, cx: &mut WindowContext<'_>, view_id: usize ) -> bool
fn modifiers_changed( &mut self, event: &ModifiersChangedEvent, cx: &mut WindowContext<'_>, view_id: usize ) -> bool
fn update_keymap_context(&self, keymap: &mut KeymapContext, cx: &AppContext)
fn debug_json(&self, cx: &WindowContext<'_>) -> Value
fn text_for_range( &self, range: Range<usize>, cx: &WindowContext<'_> ) -> Option<String>
fn selected_text_range(&self, cx: &WindowContext<'_>) -> Option<Range<usize>>
fn marked_text_range(&self, cx: &WindowContext<'_>) -> Option<Range<usize>>
fn unmark_text(&mut self, cx: &mut WindowContext<'_>, view_id: usize)
fn replace_text_in_range( &mut self, range: Option<Range<usize>>, text: &str, cx: &mut WindowContext<'_>, view_id: usize )
fn replace_and_mark_text_in_range( &mut self, range: Option<Range<usize>>, new_text: &str, new_selected_range: Option<Range<usize>>, cx: &mut WindowContext<'_>, view_id: usize )
fn any_handle( &self, window: AnyWindowHandle, view_id: usize, cx: &AppContext ) -> AnyViewHandle
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