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.
JSP text editor produces some events 4 times if measured at editor.ext.Completion listeners. The completion listeners get for four times all document and caret events. It's odd.
It may affect issue 27785 for JSPs.
Petr, can you please be more specific and describe what events are fired, when exactly, and include stack trace if you have one ? I am afraid I don't know what exactly you mean by "measured at editor.ext.Completion listeners". Thanks Petr
org.netbeans.editor.ext.Completion$1$CompletionCaretListener.caretUpdate(Completion.java:147) org.netbeans.editor.ext.Completion$1$CompletionDocumentListener.insertUpdate(Completion.java:122) Traces are identical, it means that listeners are registere multiple times. They are. ExtEditorUI.COMPONENT_PROPERTY propery change is fired 4 times, its handler registers above listeners. See attachement.
Created attachment 8016 [details] Four registration traces
From the stack stace and source of o.n.e.ext.Completion I see that editor simulates PCE in constructor of Completion. Because JSP completion is special one encapsulating HTML and Java completion together with some aditional features it looks OK that several objects is created. How often this happens?
On every key stroke.
Tegal planning
http://web.netbeans.org/source/browse/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/RestoreColoring.java.diff?r1=1.3&r2=1.4 One quarter reduced (no NbJavaCompletion that is replaced with JspJavaCompletion that extends it). I don't know how to supress events generated from HTMLCompletion and extended JavaCompletion to be fired when we actually need only the last one that delegates to them.
Sorry - correct link is: http://web.netbeans.org/source/browse/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/JSPKit.java.diff?r1=1.4&r2=1.5
It's worse than I have expected. DocumentListeners duplicates itself on every key stroke! A will attach the test path.
Created attachment 9152 [details] A editor patch that exposes this bug
Sorry but your patch doesn't compile (getDocumentListeners() acnnot be resolved)
Hint JDK 1.4.1
All listeners are of the same instance. It would be worthy to add in editor's BaseDocument a check that would prevent it pointing to culprit.
Another hint - print listeners instances rather then whole array several times ;-) I will attach listeners registered to JSP file and short patch eliminating too many HtmlSyntaxSupport objects registered.
Created attachment 9173 [details] patch for JSP syntax module
Created attachment 9174 [details] listeners registered to JSP document
patch commited http://web.netbeans.org/source/browse/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/JspSyntaxSupport.java.diff?r1=1.10&r2=1.11 There are probably still too many listeners and we will need further investigation how to eliminate some of them. Julian can you check that JSP editor still works for your documents?
Seems to work fine. Julian
thanks Julian.
v