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 166937 - code completion broken on JTextComponent
Summary: code completion broken on JTextComponent
Status: RESOLVED DUPLICATE of bug 110237
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords: REGRESSION
Depends on: 110237
Blocks:
  Show dependency tree
 
Reported: 2009-06-11 20:12 UTC by err
Modified: 2009-06-23 15:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description err 2009-06-11 20:12:08 UTC
The fix for Issue 156127 "Code completion cannot be disabled" causes this problem.

jVi pops up a dialog containing a JComboBox for vi command mode; the box's JTextComponent is registered as a completion
provider, see Issue #110239 and Issue #113673 for patches that fixed problems to get the JTextComponent to work. There
is Issue 110237, which remains unfixed, about API problems between CodeCompletion and EditorRegistry. Note: the jVi ":"
command brings up the command entry dialog.

After the fix for Issue 156127 there is no longer default bindings provided for code completion. This causes the jVi use
case to fail. The problem is exacerbated because CompletionImpl.findEditorKeys finds nothing unless the JTextComponent
has a Kit derived from NBs' BaseKit. So a workaround that has jVi adding the proper keystrokes for the action name will
fail.
Comment 1 err 2009-06-11 20:20:18 UTC
Noted its a REGRESSION. Set priority to P2 because there doesn't seem to be an obvious workaround.
Comment 2 Miloslav Metelka 2009-06-17 14:40:21 UTC
Ernie, do you need a regular plain JTextField to have a code completion or could it be a JTextField with BaseKit (and BaseDocument) installed? If the latter 
case would suffice then the solution that I've described in issue 110237 would suffice IMHO.
Comment 3 err 2009-06-17 15:33:40 UTC
> the solution that I've described in issue 110237 would suffice IMHO

Yes, that was my thought as well, assuming
  > or more generically JTextComponent in case of install-into way
is the technique implemented. I've been meaning to ask if I should depend this issue on that one.

I wonder if there should be a client property/parameter for the level of support. BaseKit may have too much or it may be
just fine if it doesn't get all the "fancy" stuff. jVi's command entry window does not want all the editor
baggage/bindings. This is simple text entry (embedded in a combo box helps provide command history feature). So if
BaseKit is relatively "plain" then that would work great. Alternately the type JTextComponent vs JEditorPane could be
used to guess what to put in; but there might be cases where a simpler JEditorPane is wanted, I don't know what kind of
flexibility you want.
Comment 4 err 2009-06-17 15:35:17 UTC
BTW, I found a workaround. I install a binding for Ctrl-Space and do showCompletion. This seems to be good enough for
what jVi needs.
Comment 5 Miloslav Metelka 2009-06-23 11:56:07 UTC
If we can resolve this by using the workaround then let's close this issue and just continue the API effort under issue 110237.
Regarding factory API the factory should probably take JTextComponent as parameter and attempt to work with the JTextField as well. BTW the BaseKit-
related things do not handle well the single-line mode so JTextField is definitely better at the moment regarding this.
Comment 6 err 2009-06-23 15:51:47 UTC

*** This issue has been marked as a duplicate of 110237 ***