This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 226978

Summary: Fold SPI to integrate with NB Editor UI
Product: editor Reporter: Svata Dedic <sdedic>
Component: Code foldingAssignee: Svata Dedic <sdedic>
Status: RESOLVED FIXED    
Severity: normal CC: mmetelka
Priority: P3 Keywords: API, API_REVIEW_FAST
Version: 7.4   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Proposed SPI

Description Svata Dedic 2013-03-04 12:13:00 UTC
Created attachment 132148 [details]
Proposed SPI

During discussions following issue #226368, it was decided to split editor.fold into two modules to reduce dependencies of Fold API clients to the deprecated editor.lib. 

Because of that separation, a hook is needed to attach handlers to UI components; formerly this would be done in the FoldHierarchyExecution, but that class should remain independent of editor.lib dependencies now. Currently it is not possible to observe that folding (or an editor) was initialized for a JTextComponent, except hooking using "doc-install-action-name-list" preference key, which seems as inappropriate for this initialization API.

As a minimal change the FoldHierarchyMonitor SPI will be introduced (see the attached diff). It allows to "ping" implementations of UI that a FoldHierarchy was created and - depending on future observations of the performance - when the 1st FoldManager registers for the hierarchy. 
The UI (e.g. BaseCaret bridge) can then hook to UI (folding changes and caret movement) and mediate the processing.
Comment 1 Svata Dedic 2013-03-08 17:24:20 UTC
Changeset: 0d6c8d4a4534
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2013-03-08 18:24
Message:   Added hook to initialize on fold hierarchy creation.
Comment 2 Quality Engineering 2013-03-13 02:10:06 UTC
Integrated into 'main-golden', will be available in build *201303122300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/0d6c8d4a4534
User: Svata Dedic <sdedic@netbeans.org>
Log: Issue #226978 - Fold SPI to integrate with NB Editor UI: fixed
Added hook to initialize on fold hierarchy creation.