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
21#[path = "StatusBarProvider/MessageManagement.rs"]
22mod MessageManagement;
23
24#[path = "StatusBarProvider/Tooltip.rs"]
25mod Tooltip;
26
27#[async_trait]
28impl StatusBarProvider for MountainEnvironment {
29	/// Creates a new status bar entry or updates an existing one.
30	async fn SetStatusBarEntry(&self, entry:StatusBarEntryDTO) -> Result<(), CommonError> {
31		EntryManagement::set_status_bar_entry_impl(self, entry).await
32	}
33
34	/// Removes a status bar item from the UI.
35	async fn DisposeStatusBarEntry(&self, entry_identifier:String) -> Result<(), CommonError> {
36		EntryManagement::dispose_status_bar_entry_impl(self, entry_identifier).await
37	}
38
39	/// Shows a temporary message in the status bar.
40	async fn SetStatusBarMessage(&self, message_identifier:String, text:String) -> Result<(), CommonError> {
41		MessageManagement::set_status_bar_message_impl(self, message_identifier, text).await
42	}
43
44	/// Disposes of a temporary status bar message.
45	async fn DisposeStatusBarMessage(&self, message_identifier:String) -> Result<(), CommonError> {
46		MessageManagement::dispose_status_bar_message_impl(self, message_identifier).await
47	}
48
49	/// Resolves a dynamic Tooltip by making a reverse call to the extension
50	/// host.
51	async fn ProvideTooltip(&self, entry_identifier:String) -> Result<Option<Value>, CommonError> {
52		Tooltip::provide_tooltip_impl(self, entry_identifier).await
53	}
54}