CodeFoldingChanges201302

(Difference between revisions)
Sdedic (Talk | contribs)
(Created page with '== Separation from Editor == For legacy reasons, part of the Code Folding (sidebar, bindings to caret) was placed in the ''editor.lib'' module. This complicates dependencies, and…')
Newer edit →

Revision as of 12:41, 19 February 2013

Separation from Editor

For legacy reasons, part of the Code Folding (sidebar, bindings to caret) was placed in the editor.lib module. This complicates dependencies, and puts an add-on feature into the base editor module. Instead of moving the parts of folding code to editor.lib2, they will be merged with the data layer in editor.fold.

Several legacy classes are moved and deprecated:

  • CodeFoldingSidebar
  • CustomFoldManager

Classes are moved between modules, with editor.lib injecting dependency on editor.fold module, so existing clients continue to compile and run.

Two hooks between editor.lib and editor.fold are needed to integrate folding with the caret operations. New method

public void refresh(boolean retainInView)

is introduced, so fold support can refresh caret position on the screen.

The 2nd hook is used by BaseCaret handling of mouse clicks, which needs an immediate info on whether the current visual position falls into a folded view, since the behaviour is then different. Since the mouse support is quite mixed with BaseCaret with no points for extension, I decided to use a pseudo-API: register a Callable<Boolean> as org.netbeans.api.fold.expander property on the text component. Base caret calls the Callable to obtain the necessary information. The pseudo-API is documented in arch document of editor.lib module.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo