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 181523

Summary: Singleline editors support (was: Export code completion support)
Product: editor Reporter: Egor Ushakov <gorrus>
Component: -- Other --Assignee: issues@editor <issues>
Status: RESOLVED FIXED    
Severity: normal CC: dbalek, mentlicher, vv159170
Priority: P2 Keywords: API
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 180100    
Attachments: Introducing org.netbeans.spi.debugger.ui.Utilities class with desired methods.
Notes from inception review
Patch supporting line/column based dialog bindings
Patch adding single line editors factory

Description Egor Ushakov 2010-03-04 08:37:52 UTC
Sun Studio would like to use code completion in own new watch and some other places. Now we have ContextBindingSupport in cnd.debugger.common but it duplicates core functionality from WatchPanel (Debugger Core UI).
Could you please make it public, we're mostly interested in:
setupContext
createScrollableLineEditor
Comment 1 Martin Entlicher 2010-03-04 10:07:09 UTC
I agree that this is useful to have accessible through an API.
Comment 2 Martin Entlicher 2010-03-08 08:47:36 UTC
Created attachment 94867 [details]
Introducing org.netbeans.spi.debugger.ui.Utilities class with desired methods.
Comment 3 Martin Entlicher 2010-03-08 08:48:56 UTC
Please review this simple API addition. Java debugger will use these methods as well.
Comment 4 Egor Ushakov 2010-03-09 04:50:55 UTC
looks fine, exactly what we need, thanks!
Comment 5 Jaroslav Tulach 2010-03-09 07:20:38 UTC
Y01 Private constructor for the Utilities class. Make it final.
Y02 Why the setContext method is in debugger and not in more general place, For example editor module?
Comment 6 Martin Entlicher 2010-03-10 08:38:55 UTC
Y01 O.K.

Y02 Utilities.createScrollableLineEditor() is not debugger-specific either.

Perhaps we could put API for creation of single-line editor (like this) and growable editor (like one in form module) somewhere under org.openide.awt ?
So that it's accessible for everyone...

Then the proposed Utilities.setContext() could go to DialogBinding for instance, like DialogBinding.bindComponentToFileLine().

It's a question what to do with Utilities.setupUI(), perhaps it should be somewhere in org.netbeans.editor.Utilities...

Comments?
Comment 7 Jaroslav Tulach 2010-03-15 14:48:51 UTC
Created attachment 95188 [details]
Notes from inception review

Inception review resulted in consensus about the need and place of various methods (see the attached text file). Most of the code will go to editor. Martin Entlicher promised to do the work. Víťa will provide commiter's guidance to Martin.
Comment 8 Martin Entlicher 2010-03-16 13:42:24 UTC
Moving to editor to implement TCRs:
1) A property on JTextComponent to disable visual limit indication.
   I suggest to introduce "TextLimitLineVisible" property, that would do:
   EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(textComponent);
   eui.textLimitLineVisible = 
    Boolean.TRUE.equals(textComponent.getClientProperty("TextLimitLineVisible"));

2) dialogBinding shall be able to work with line not only offset (and FileObject)
   Can be solved by:
   DialogBinding.bindComponentToFileLine(final FileObject fileObject, int line, int length, final JTextComponent component)
   or
   DialogBinding.bindComponentToFile(final FileObject fileObject, int line, int column, int length, final JTextComponent component)

3) We'll add putClientProperty support for 6.9

4) JComponent createOneLineEditor(JEditorPane) in editor API
   The implementation code could be taken from
   Utilities.createScrollableLineEditor(JEditorPane editoPane) attached here.
Comment 9 Martin Entlicher 2010-03-16 13:43:16 UTC
Please adjust the component if necessary, not sure if this is the correct one.
Comment 10 Vitezslav Stejskal 2010-03-26 13:14:39 UTC
http://hg.netbeans.org/jet-main/rev/f72324fbb0a5
Comment 11 Vitezslav Stejskal 2010-03-26 13:37:38 UTC
Created attachment 95951 [details]
Patch supporting line/column based dialog bindings

This is the API that allows dialog-bindings to be expressed in the form of a line/column pair rather than just a plain offset. In the list of requests this is described as #2.
Comment 12 Quality Engineering 2010-03-29 04:16:52 UTC
Integrated into 'main-golden', will be available in build *201003290201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/f72324fbb0a5
User: Vita Stejskal <vstejskal@netbeans.org>
Log: improving dialog binding mechanism to support line/column in addition to just an offset (related to #181523)
Comment 13 Vitezslav Stejskal 2010-03-29 13:31:54 UTC
Created attachment 96201 [details]
Patch adding single line editors factory

This patch add a new factory method for creating single line TextField-like controls and modifies debugger's WatchPanel to use this new factory method in combination with the new DialogBinding method (previsou patch).
Comment 14 Vitezslav Stejskal 2010-03-29 13:43:24 UTC
Please review the API changes in the following two patches:
http://netbeans.org/bugzilla/attachment.cgi?id=95951
http://netbeans.org/bugzilla/attachment.cgi?id=96201

Thanks
Comment 15 Dusan Balek 2010-03-29 15:51:27 UTC
Changes to DialogBinding seem to be OK. Minor typo in apichanges.xml: the first added method is named 'bindComponentToFile'.
Comment 17 Quality Engineering 2010-04-02 04:47:52 UTC
Integrated into 'main-golden', will be available in build *201004020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c24d2a221a50
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #181523: extending DialogBinding to support binding to a position specified as a line/column pair