| Summary: | NPE in org.eclipse.jface.text.contentassist.CompletionProposalPopup$9.keyTraversed | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Gary Karasiuk <karasiuk> | ||||
| Component: | Text | Assignee: | Markus Keller <markus.kell.r> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | remy.suen | ||||
| Version: | 3.6 | ||||||
| Target Milestone: | 3.7 M1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 172908 [details]
Fix
The NPE happens because you didn't call #setInformationControlCreator(..) on your ContentAssistant. But since that's not required, I've protected our code.
Fixed in HEAD. . |
I am trying to code my own content assist. When I press the TAB key on one of my content assist entries I get the following NPE: java.lang.NullPointerException at org.eclipse.jface.text.contentassist.CompletionProposalPopup$9.keyTraversed(CompletionProposalPopup.java:728) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:247) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062) at org.eclipse.swt.widgets.Control.traverse(Control.java:3693) at org.eclipse.swt.widgets.Control.translateTraversal(Control.java:3675) at org.eclipse.swt.widgets.Composite.translateTraversal(Composite.java:1218) at org.eclipse.swt.widgets.Display.translateTraversal(Display.java:4691) at org.eclipse.swt.widgets.Display.filterMessage(Display.java:1267) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3653) SNIP Here is my code that sets up the content assist proposals: private ICompletionProposal[] memorizedCompletions(String token, int offset) { List<MemorizedTransactionImmutable> mts = MTCache.instance.getByName(token.substring(2)); ICompletionProposal[] result= new ICompletionProposal[mts.size()]; int i = 0; for (MemorizedTransactionImmutable mt : mts){ IContextInformation ci = new ContextInformation(mt.key, mt.transaction); result[i++] = new CompletionProposal(mt.transaction, offset-token.length(), token.length(), mt.transaction.length(), null, mt.key, ci, null); } return result; }