Add an indicator icon on the status bar
This document outlines the basic features of working with Status Bar, including:
Adding a button on Status Bar
-
Import the
StatusBar
module.const StatusBar = brackets.getModule("widgets/StatusBar");
-
Register the command.
Register the command that will trigger the clicking.
var MY_COMMAND_ID = "helloworld_sayhello";
CommandManager.register("Hello World", MY_COMMAND_ID, handleHelloWorld); -
Add the button to the StatusBar.
To add the button to StatusBar, use
addIndicator()
:-
StatusBar.addIndicator(
MY_COMMAND_ID, // unique ID for this indicator
$("<div>Test</div>").click(handleHelloWorld), // Optional DOMNode for the indicator
true, // show the indicator
"hello-world-status", // CSS class
"tooltip", // tooltip text
);
→ The parameters of the addIndicator()
method :-
Param | Type | Description |
---|---|---|
id | string | Registration id of the indicator to be updated. |
[indicator] | DOMNode or jQueryObject | Optional DOMNode for the indicator |
[visible] | boolean | Shows or hides the indicator over the statusbar. |
[style] | string | Sets the attribute "class" of the indicator. |
[tooltip] | string | Sets the attribute "title" of the indicator. |
[insertBefore] | string | An id of an existing status bar indicator. The new indicator will be inserted before (i.e. to the left of) the indicator specified by this parameter. |
For a detailed description, refer to this link.