85. toggleCollapsed
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 85. toggleCollapsed

Parameter syntax:

    [ 'toggle'|'collapse'|'expand'|'collapseAll'|'expandAll'
      [ '+' 'toggle'|'collapse'|'expand'|'collapseAll'|'expandAll']? ]?

Changes the state of the nearest collapsible view.

The ``nearest collapsible view'' is searched like this:

- Search starts at explicitly selected node if any; otherwise at node containing caret.

- If this node is an element and has a collapsible view, search is completed: this view is the ``nearest collapsible view''.

- Otherwise search continues with the parent of the node.

The parameter of this command specifies up to two operations. The default operation is `toggle`. Supported operations are:

toggle

  Collapses nearest collapsible view if it is expanded and expands nearest collapsible view if it is collapsed.

collapse

  Collapses nearest collapsible view if it is expanded; otherwise has no effect.

expand

  Expands nearest collapsible view if it is collapsed; otherwise has no effect.

collapseAll

  Collapses nearest collapsible view and then, recursively collapses all its collapsible descendant views.

expandAll

  Expands nearest collapsible view and then, recursively expands all its collapsible descendant views.

Recommended bindings (found in the add-on called "A sample customize.xxe" — download and install it using Options → Install Add-ons):

      <binding>
        <keyPressed code="ESCAPE" />
        <charTyped char="/" />
        <command name="toggleCollapsed" />
      </binding>

      <binding>
        <keyPressed code="ESCAPE" />
        <charTyped char="+" />
        <command name="toggleCollapsed" parameter="expandAll" />
      </binding>

      <binding>
        <keyPressed code="ESCAPE" />
        <charTyped char="-" />
        <command name="toggleCollapsed" parameter="collapseAll" />
      </binding>

      <binding>
        <keyPressed code="ESCAPE" />
        <charTyped char="1" />
        <command name="toggleCollapsed" parameter="collapseAll+expand" />
      </binding>

Prev | Up | Next
84. status | Home | 86. undo