Skip to main content

WorkspaceManager

Import :

const WorkspaceManager = brackets.getModule("view/WorkspaceManager")

view/WorkspaceManager

Manages layout of panels surrounding the editor area, and size of the editor area (but not its contents).

Updates panel sizes when the window is resized. Maintains the max resizing limits for panels, based on currently available window size.

Events: workspaceUpdateLayout When workspace size changes for any reason (including panel show/hide panel resize, or the window resize). The 2nd arg is the available workspace height. The 3rd arg is a refreshHint flag for internal use (passed in to recomputeLayout)

view/WorkspaceManager.PANEL_TYPE_BOTTOM_PANEL : string

Constant representing the type of bottom panel

Kind: static property of view/WorkspaceManager

view/WorkspaceManager.PANEL_TYPE_PLUGIN_PANEL : string

Constant representing the type of plugin panel

Kind: static property of view/WorkspaceManager

view/WorkspaceManager.$bottomPanelContainer : jQueryObject

The single container wrapping all bottom panels

Kind: inner property of view/WorkspaceManager

view/WorkspaceManager.$statusBarPanelToggle : jQueryObject

Chevron toggle in the status bar

Kind: inner property of view/WorkspaceManager

view/WorkspaceManager._statusBarToggleInProgress : boolean

True while the status bar toggle button is handling a click

Kind: inner property of view/WorkspaceManager

view/WorkspaceManager.EVENT_WORKSPACE_UPDATE_LAYOUT

Event triggered when the workspace layout updates.

Kind: inner constant of view/WorkspaceManager

view/WorkspaceManager.EVENT_WORKSPACE_PANEL_SHOWN

Event triggered when a panel is shown.

Kind: inner constant of view/WorkspaceManager

view/WorkspaceManager.EVENT_WORKSPACE_PANEL_HIDDEN

Event triggered when a panel is hidden.

Kind: inner constant of view/WorkspaceManager

view/WorkspaceManager.createBottomPanel(id, $panel, [minSize], [title]) ⇒ Panel

Creates a new resizable panel beneath the editor area and above the status bar footer. Panel is initially invisible. The panel's size & visibility are automatically saved & restored as a view-state preference.

Kind: inner method of view/WorkspaceManager

ParamTypeDescription
idstringUnique id for this panel. Use package-style naming, e.g. "myextension.feature.panelname"
$paneljQueryObjectDOM content to use as the panel. Need not be in the document yet. Must have an id attribute, for use as a preferences key.
[minSize]number@deprecated No longer used. Pass undefined.
[title]stringDisplay title shown in the bottom panel tab bar.

view/WorkspaceManager.destroyBottomPanel(id)

Destroys a bottom panel, removing it from internal registries, the tab bar, and the DOM. After calling this, the panel ID is no longer valid and the Panel instance should not be reused.

Kind: inner method of view/WorkspaceManager

ParamTypeDescription
idstringThe panel ID that was passed to createBottomPanel.

view/WorkspaceManager.createPluginPanel(id, $panel, [minSize], $toolbarIcon, [initialSize]) ⇒ Panel

Creates a new resizable plugin panel associated with the given toolbar icon. Panel is initially invisible. The panel's size & visibility are automatically saved & restored. Only one panel can be associated with a toolbar icon.

Kind: inner method of view/WorkspaceManager

ParamTypeDescription
idstringUnique id for this panel. Use package-style naming, e.g. "myextension.panelname". will overwrite an existing panel id if present.
$paneljQueryObjectDOM content to use as the panel. Need not be in the document yet. Must have an id attribute, for use as a preferences key.
[minSize]numberMinimum height of panel in px.
$toolbarIconjQueryObjectAn icon that should be present in main-toolbar to associate this panel to. The panel will be shown only if the icon is visible on the toolbar and the user clicks on the icon.
[initialSize]numberOptional Initial size of panel in px. If not given, panel will use minsize or current size.

view/WorkspaceManager.getAllPanelIDs() ⇒ Array

Returns an array of all panel ID's

Kind: inner method of view/WorkspaceManager
Returns: Array - List of ID's of all bottom panels

view/WorkspaceManager.getPanelForID(panelID) ⇒ Object

Gets the Panel interface for the given ID. Can return undefined if no panel with the ID is found.

Kind: inner method of view/WorkspaceManager
Returns: Object - Panel object for the ID or undefined

ParamType
panelIDstring

view/WorkspaceManager.recomputeLayout(refreshHint)

Called when an external widget has appeared and needs some of the space occupied by the mainview manager

Kind: inner method of view/WorkspaceManager

ParamTypeDescription
refreshHintbooleantrue to refresh the editor, false if not

view/WorkspaceManager.isPanelVisible(panelID) ⇒ boolean

Responsible to check if the panel is visible or not. Returns true if visible else false.

Kind: inner method of view/WorkspaceManager

Param
panelID

view/WorkspaceManager.setPluginPanelWidth(width)

Programmatically sets the plugin panel content width to the given value in pixels. The total toolbar width is adjusted to account for the plugin icons bar. Width is clamped to respect panel minWidth and max size (75% of window). No-op if no panel is currently visible.

Kind: inner method of view/WorkspaceManager

ParamTypeDescription
widthnumberDesired content width in pixels

view/WorkspaceManager.addEscapeKeyEventHandler(consumerName, eventHandler) ⇒ boolean

If any widgets related to the editor needs to handle the escape key event, add it here. returning true from the registered handler will prevent primary escape key toggle panel behavior of phoenix. Note that returning true will no stop the event bubbling, that has to be controlled with the event parameter forwarded to the handler.

Kind: inner method of view/WorkspaceManager
Returns: boolean - true if added

ParamTypeDescription
consumerNamestringa unique name for your consumer
eventHandlerfunctionIf the eventHandler returns true for this callback, the escape key event will not lead to panel toggle default behavior.

view/WorkspaceManager.removeEscapeKeyEventHandler(consumerName) ⇒ boolean

Removing the escape key event consumer.

Kind: inner method of view/WorkspaceManager
Returns: boolean - true if removed

ParamTypeDescription
consumerNamestringused to register the consumer.