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 163769 - bindComponentToFile() does not work correctly
Summary: bindComponentToFile() does not work correctly
Alias: None
Product: debugger
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Martin Entlicher
: 165154 (view as bug list)
Depends on:
Blocks: 156523
  Show dependency tree
Reported: 2009-04-27 14:38 UTC by Daniel Prusa
Modified: 2010-04-29 09:50 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

source file for test case A (330 bytes, text/plain)
2009-04-27 15:01 UTC, Daniel Prusa
Proposed API change (14.18 KB, patch)
2009-05-15 17:45 UTC, Dusan Balek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Prusa 2009-04-27 14:38:13 UTC
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
right value)

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
Comment 1 Daniel Prusa 2009-04-27 15:01:41 UTC
Created attachment 80990 [details]
source file for test case A
Comment 2 Dusan Balek 2009-05-04 10:44:06 UTC
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.
Comment 3 Miloslav Metelka 2009-05-05 15:14:22 UTC
I'm wondering if this could be caused by automatic removal of trailing whitespace? You may try
to debug it.
Comment 4 Jan Stola 2009-05-14 14:40:06 UTC
*** Issue 165154 has been marked as a duplicate of this issue. ***
Comment 5 Jan Stola 2009-05-14 14:45:02 UTC
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.
Comment 6 Dusan Balek 2009-05-15 17:45:47 UTC
Created attachment 82214 [details]
Proposed API change
Comment 7 Vitezslav Stejskal 2009-05-15 21:01:14 UTC
java.editor should declare dependency on editor.lib2/1.11, otherwise the patch looks ok to me. Thanks
Comment 8 Dusan Balek 2009-05-19 13:24:45 UTC
Patch integrated into jet-main.

Debugger and Form module maintainers should modify their code to use DialogBinding.bindComponentToDocument instead of
DialogBinding.bindComponentToFile. Reassigning.
Comment 9 Quality Engineering 2009-05-21 08:13:14 UTC
Integrated into 'main-golden', will be available in build *200905210201* on (upload may still be in progress)
User: Dusan Balek <>
Log: DialogBinding.bindComponentToDocument added - see issue #163769.
Comment 10 Jan Stola 2009-05-21 09:58:55 UTC
Fixed in form:
Passing to debugger.
Comment 11 Martin Entlicher 2009-05-21 15:03:43 UTC
Fixed in all debuggers in changeset:   132863:f51d1e12b88e
Comment 12 Quality Engineering 2009-05-22 07:11:11 UTC
Integrated into 'main-golden', will be available in build *200905220201* on (upload may still be in progress)
Log: #163769 - Using DialogBinding.bindComponentToDocument instead of DialogBinding.bindComponentToFile to have correct code-completion.
Comment 13 Vladimir Voskresensky 2009-06-03 09:43:43 UTC
issue IZ#166439 is a regression caused by  mentlicher's
Please, check for regressions in other languages
Comment 14 Martin Entlicher 2009-06-03 10:18:58 UTC
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.
Comment 15 Vladimir Voskresensky 2009-06-03 10:34:43 UTC
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 :-(
=> regression.

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
as well. 

Comment 16 Martin Entlicher 2009-06-03 10:55:31 UTC
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.
Comment 17 Quality Engineering 2010-04-29 09:50:24 UTC
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.