Skip to main content

Mountain/Environment/
StatusBarProvider.rs

1//! # StatusBarProvider (Environment)
2//!
3//! Implements the `StatusBarProvider` trait for the `MountainEnvironment`. This
4//! provider handles creating, updating, and removing status bar items, and
5//! orchestrates communication between the `Cocoon` sidecar and the `Sky`
6//! frontend.
7
8use CommonLibrary::{
9	Error::CommonError::CommonError,
10	StatusBar::{DTO::StatusBarEntryDTO::StatusBarEntryDTO, StatusBarProvider::StatusBarProvider},
11};
12use async_trait::async_trait;
13use serde_json::Value;
14
15use super::MountainEnvironment::MountainEnvironment;
16
17// Private submodules containing the actual implementation
18#[path = "StatusBarProvider/EntryManagement.rs"]
19mod EntryManagement;
20#[path = "StatusBarProvider/MessageManagement.rs"]
21mod MessageManagement;
22#[path = "StatusBarProvider/Tooltip.rs"]
23mod Tooltip;
24
25#[async_trait]
26impl StatusBarProvider for MountainEnvironment {
27	/// Creates a new status bar entry or updates an existing one.
28	async fn SetStatusBarEntry(&self, entry:StatusBarEntryDTO) -> Result<(), CommonError> {
29		EntryManagement::set_status_bar_entry_impl(self, entry).await
30	}
31
32	/// Removes a status bar item from the UI.
33	async fn DisposeStatusBarEntry(&self, entry_identifier:String) -> Result<(), CommonError> {
34		EntryManagement::dispose_status_bar_entry_impl(self, entry_identifier).await
35	}
36
37	/// Shows a temporary message in the status bar.
38	async fn SetStatusBarMessage(&self, message_identifier:String, text:String) -> Result<(), CommonError> {
39		MessageManagement::set_status_bar_message_impl(self, message_identifier, text).await
40	}
41
42	/// Disposes of a temporary status bar message.
43	async fn DisposeStatusBarMessage(&self, message_identifier:String) -> Result<(), CommonError> {
44		MessageManagement::dispose_status_bar_message_impl(self, message_identifier).await
45	}
46
47	/// Resolves a dynamic Tooltip by making a reverse call to the extension
48	/// host.
49	async fn ProvideTooltip(&self, entry_identifier:String) -> Result<Option<Value>, CommonError> {
50		Tooltip::provide_tooltip_impl(self, entry_identifier).await
51	}
52}