Incorrect code completion items are provided when DialogBinding.bindComponentToFile() is used.
Steps to reproduce:
test case A:
use the attached source file, place cursor at the beginning of line 8, invoke New Watch dialog (by pressing
Ctrl+Shift+F7), invoke code completion -> strange items "arSes" and "arStrings" are displayed
moreover, place cursor at the beginning of line 11, invoke New Watch dialog, invoke code completion -> it offers items
having "St" prefix (It seems like an incorrect document offset is used, but I have verified that the debugger passes
test case B:
create JFrame, in GUI editor, add JLabel to it, rightclick the label and invoke Customize Code
invoke code completion at the first line -> displays some items starting by "p"
invoke code completion at the third line -> the list does not contain jLabel1
- Both scenarios worked in nb 6.5
- After invoking bindComponentToFile(), there is the following debug text printed in the console:
no file object for org.netbeans.modules.editor.NbEditorDocument@5f758a, mimeType = 'text/x-dialog-binding', kitClass =
null, length = 0
Created attachment 80990 [details]
source file for test case A
Test case A can be reproduced only if the source is modified and the document content differs from the content of the
corresponding file. Test case B is the same. Document content differs from the corresponding file because of deleted
guarded document marks (in 6.5 marks were replaced by spaces). Probably we should come up with
DialogBinding.bindComponentToDocument(...) alternative that binds component to the living Document instead of FileObject.
I'm wondering if this could be caused by automatic removal of trailing whitespace? You may try
to debug it.
*** Issue 165154 has been marked as a duplicate of this issue. ***
This issue affects GUI builder seriously. The code completion doesn't work correctly in GUI builder's dialogs. In
affects also debugging of forms (code completion is broken in debugger windows) => increasing the priority to P2.
Created attachment 82214 [details]
Proposed API change
java.editor should declare dependency on editor.lib2/1.11, otherwise the patch looks ok to me. Thanks
Patch integrated into jet-main.
Debugger and Form module maintainers should modify their code to use DialogBinding.bindComponentToDocument instead of
Integrated into 'main-golden', will be available in build *200905210201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Dusan Balek <email@example.com>
Log: DialogBinding.bindComponentToDocument added - see issue #163769.
Fixed in form: http://hg.netbeans.org/cdev/rev/b73660605871
Passing to debugger.
Fixed in all debuggers in changeset: 132863:f51d1e12b88e
Integrated into 'main-golden', will be available in build *200905220201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Log: #163769 - Using DialogBinding.bindComponentToDocument instead of DialogBinding.bindComponentToFile to have correct code-completion.
issue IZ#166439 is a regression caused by mentlicher's http://hg.netbeans.org/main/rev/f51d1e12b88e
Please, check for regressions in other languages
vv159170, your code depends on "dialogBinding.fileObject", which is NOT an API. Depending on implementation details
makes the code non-maintainable. Also it's unfortunate that this bug was not fixed without requiring changes in it's
No other debugger depends on this attribute, therefore I consider this as fixed.
It's up to you.
You are right, there had to be correspondent C++ IZ to migrate from file-binding to doc-binding, but there was none :-(
Btw, I don't know what is API here? "dialogBinding.document"? What have to be used by client to extract bidning info?
I reopened IZ to pay attention, that some debuggers where broken. I have fixed C++ one, but probably python's is broken
You're right, next time I have to create a special issue and let the fix up to you.
My point was, that there's nothing wrong with the fix
until someone depends on the implementation details of these methods.
"dialogBinding.fileObject" is simply not an API, it's not mentioned anywhere. Depending on this is simply dangerous -
viz issue #166439.
Why python's debugger would be broken? It does not use "dialogBinding.fileObject". If it uses some other side-effects of
bindComponentToFile(), which can not be seen from the code, then it might be broken. In such case QE will certainly find it.
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.