public interface StatusBarWidgetFactory
LightEditCompatible
.
Prohibiting the widget for the main IDE could be done in the isAvailable(Project)
method.Modifier and Type | Field and Description |
---|---|
static ExtensionPointName<StatusBarWidgetFactory> |
EP_NAME |
Modifier and Type | Method and Description |
---|---|
boolean |
canBeEnabledOn(StatusBar statusBar) |
StatusBarWidget |
createWidget(Project project)
Creates a widget to be added to the status bar.
|
void |
disposeWidget(StatusBarWidget widget) |
java.lang.String |
getDisplayName() |
java.lang.String |
getId() |
boolean |
isAvailable(Project project)
Returns availability of widget.
|
default boolean |
isConfigurable() |
default boolean |
isEnabledByDefault() |
static final ExtensionPointName<StatusBarWidgetFactory> EP_NAME
java.lang.String getId()
java.lang.String getDisplayName()
boolean isAvailable(Project project)
`False` means that IDE won't try to create a widget or will dispose it on StatusBarWidgetsManager.updateWidget(java.lang.Class<? extends com.intellij.openapi.wm.StatusBarWidgetFactory>)
call.
E.g. `false` can be returned for
Whenever availability is changed, you need to call StatusBarWidgetsManager.updateWidget(StatusBarWidgetFactory)
explicitly to get status bar updated.
StatusBarWidget createWidget(Project project)
Once the method is invoked on project initialization, the widget won't be recreated or disposed implicitly.
You may need to recreate it if:
isAvailable(Project)
com.intellij.openapi.wm.impl.status.widget.StatusBarWidgetSettings
To do this, you need to explicitly invoke StatusBarWidgetsManager.updateWidget(StatusBarWidgetFactory)
to recreate the widget and re-add it to the status bar.
void disposeWidget(StatusBarWidget widget)
boolean canBeEnabledOn(StatusBar statusBar)
It's better to have this method aligned with EditorBasedStatusBarPopup.WidgetState.HIDDEN
,
whenever state is HIDDEN, this method should return false.
Otherwise enabling widget via context menu won't take any visual effect.
E.g. EditorBasedWidget
are available if editor is opened in a frame that given status bar is attached to
For creating editor based widgets see also StatusBarEditorBasedWidgetFactory
default boolean isEnabledByDefault()
true
if the widget should be created by default.
Otherwise, the user must enable it explicitly via status bar context menu or settings.default boolean isConfigurable()
Some widgets are controlled by application-level settings (e.g., Memory indicator) or cannot be disabled (e.g., Write thread indicator) and thus shouldn't be configurable via status bar context menu or settings.