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 183120 - [69cat] No preview for folded code
Summary: [69cat] No preview for folded code
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 6.x
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords: REGRESSION
: 183354 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-29 19:19 UTC by Michel Graciano
Modified: 2010-06-15 03:27 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Attempting to fix the tooltip (doesn't work) (7.14 KB, patch)
2010-04-06 08:15 UTC, Vitezslav Stejskal
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2010-03-29 19:19:22 UTC
[ BUILD # : 069d5678d609 ]
[ JDK VERSION : 1.6.* ]

When I pass the mouse point in any folded code the preview is not shown
anymore. I tested it in GTK and Metal LAF.
Comment 1 Vitezslav Stejskal 2010-04-01 10:15:38 UTC
I'm looking into this.
Comment 2 Michel Graciano 2010-04-01 13:57:47 UTC
*** Bug 183354 has been marked as a duplicate of this bug. ***
Comment 3 Vitezslav Stejskal 2010-04-06 08:15:02 UTC
Created attachment 96734 [details]
Attempting to fix the tooltip (doesn't work)

There are two problems:

1. editor.fold can't depend on editor.lib and therefore can't use ToolTipSupport. This is not a big deal, I modified ToolTipSupport to detect that the mouse hovers over a code fold and attempt to show a the preview tooltip. This however leads to the problem #2.

2. I don't seem to be able to create the preview tooltip. I'd need a view over a portion of the document, which would then be passed to FoldingToolTip component and displayed on the screen. The problem is that all my attempts to create this fragment view failed. I got to the state where I have the view, but it's either empty, uninitialized or somehow fails to compute its spans. Therefore FoldingToolTip component has a zero size and shows nothing.

Any help would be appreciated. I'm attaching the patch, which shows the changes. The most interesting part is in ToolTipSupport.getExpandedView(). Thanks.
Comment 4 Miloslav Metelka 2010-04-06 09:27:43 UTC
Vito, I thought that for the preview we could:
1) Determine bounds of the fold and align to full lines.
2) Pass the offset boundaries to a special constructor of DocumentView.
3) Make the FoldViewFactory sensitive to a property e.g. "tooltip" property set to Boolean.TRUE in which case it would not return any fold views for the collapsed folds so it would fallback to HighlightsViewFactory. In EditorViewFactory there's currently initProperties() but it's probably useless - it would be enough if infrastructure would set the properties values and the particular factory would just see and use a EVF.getProperty().
4) The tooltip would have to ask the view for the tooltip in which case a new JEditorPane would be created with the DocumentView over the portion of the document. Hopefully the pane will not object again doing Ext-BasicTextUI.setView(modified-document-view) even when in fact its pane.getDocument() will be different.
 Or now it comes to my mind that we could even set the same document to the pane for the tooltip we would just have have an extra property on the pane e.g. pane.putClientProperty("tooltip-range", new int[] { tooltip-start-line-start-offset, tooltip-end-line-end-offset }) and the DocumentView would be sensitive to that property and instead of covering the full document's area with the views it would just cover the range.
Comment 5 Miloslav Metelka 2010-06-14 09:23:39 UTC
http://hg.netbeans.org/jet-main/rev/88dbed0f347e
Comment 6 Quality Engineering 2010-06-15 03:27:09 UTC
Integrated into 'main-golden', will be available in build *201006150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/88dbed0f347e
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #183120 - No preview for folded code.