Tree buffer basics - ecb-home/ecb GitHub Wiki
General Introduction into Tree-Buffers
Content and Structure of a Tree-Buffer
ECB displays most of its informations (e.g. about directory-structures or file-contents) in so called tree-buffers which means the display of such a tree-buffer is structured in a tree consisting of tree-nodes. Every line in a tree-buffer displays exactly one tree-node. Each node can have any arbitrary number of children-nodes. If a tree-node has no children then it is called a leaf.
Each tree-buffer of ECB is displayed in an own special ECB-window/buffer which is read-only ie. not editable.
The difference between a natural tree like a fir and an ECB-tree is that the root(-node) of a tree-buffer is not visible but only its children. In the example below the nodes parent-node-1 and parent-node-2 are the children of the invisible root-node.
If a tree-node contains at least one child it is displayed with a special expand/collapse-symbol (see the example below). This symbol allows expanding (rsp. collapsing) the tree-node wheras expanding means to display the children-nodes and collapsing means to hide the childrens of a tree-node.
Here is an example of a tree-buffer:
[+] parent-node-1 -------.
[-] parent-node-2 -------|
[-] expanded --------|
leaf-node-1 -----|
leaf-node-2 -----|-----[tree-nodes]
leaf-node-3 -----|
leaf-node-4 -----|
[+] collapsed -------´
|
`-----------------[expand/collapse-symbol]
Possible Actions for a Tree-Node
In most cases an action is triggered when clicking with the mouse onto a tree-node (e.g. clicking onto “leaf-node-1” or “parent-node-1” in the example above). Which actions depends on the type of the tree-buffer. For example clicking on a tree-node in the ECB-sources-buffer (which is the name of a source-file) opens the relelated file in the edit-area of ECB (see ECB Sources-window) whereas clicking onto a node in the ECB-methods-buffer (which is the name of a tag in the current source-file displayed in the edit-area) “jumps” to the location of this tag in the source-buffer in the edit-area (see ECB Methods-window).
Almost every ECB-window of ECB offers a special popup-menu when clicking with the right mouse-button (of course also possible via keyboard, see Using the keyboard) onto a tree-node (e.g. some senseful actions possible for directory-nodes like grepping this directory or performing version-control actions for this directory or something else).
See ECB Directories-window, ECB Sources-window, ECB Methods-window and Add-on ECB-windows for a detailed description which actions are triggered and which popup-menus are offered in all the ECB-windows of ECB.
Sticky Parent-Node for Tree-Buffers
In the header-line (only for GNU Emacs) of a tree-buffer always the current-parent node of the first visible node is displayed (if there is a parent node). So a user always has a good overview to which parent a node belongs. This sticky node is exactly in the same manner clickable as all other nodes (see above).
There is a option ecb-tree-make-parent-node-sticky
which enabales/disables this feature (default is enabled).
There is also an option ecb-tree-stickynode-indent-string
. Normally there is no need to bother with this option but if you encounter alignment-problems with the sticky node in the headerline then take a look at this option, because it allows to fix the problem.
This feature is only available for GNU Emacs >= 21.