| Summary: | Exception when dragging a method to another class using the package explorer | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Hanna Farah <farahtech2002> |
| Component: | Text | Assignee: | Christof Marti <christof_marti> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P2 | CC: | dirk_baeumer, eclipse, kai-uwe_maetzel, markus.kell.r |
| Version: | 3.0 | ||
| Target Milestone: | 3.0.1 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 62862 | ||
| Attachments: | |||
|
Description
Hanna Farah
Markus, can you please investigate and asses how important this is for 3.0. Can reproduce: - create packages p1, p2, and p3. - create class p1.C1 with wizard; close editor. - create class p2.C2 with wizard - add empty methods one() and two() to C2 - save the editor but do *not* close it - move p2/C2.java to p3 - drill down to p3/C2.java/C2 and drag one() to C1.java/C1 We don't get a REMOVED IJavaElementDelta for one(). This is why p3.C2#one() stays in the PackageExplorer. The problem is that the reconciler seems to be completely quiet after CU has been moved. The exception is only a consequence of touching the (outdated) java element of the moved method. Tom, could you please have a look at what the reconciler does? It looks like we are uninstalling the reconciler but not re-install it again. - JavaSourceViewerConfiguration.getReconciler(ISourceViewer) line: 413 returns null because it thinks the editor is read-only. - the editor thinks it is read-only because it still refers to the old (p2/C2.java) file, which does not exist. Second RC3 vote required. Approved by Dirk & Kai. The problem is in JavaEditor#doSetInput(): The source viewer is configured before the new input has been set. During configuration the source viewer requests a reconciler which is 'null' because the old input is still connected to the document provider. The new input gets set and connected too late. Created attachment 12383 [details]
Minimal patch that moves the call to super() between un-/configure()
Created attachment 12385 [details]
The PresentationReconciler should take up an initial document
The previous patch triggers another problem: PresentationReconciler#install()
does not check whether the document has already been set on the viewer and in
this case never registers its internal listener on the document and the widget.
Previous to the support of project settings the PresentationReconciler was
reused on doSetInput() - now a new PresentationReconciler is instantiated when
configuring the source viewer on doSetInput().
Created attachment 12386 [details]
AbstractReconciler should take up an initial document too
Additional ripple of the inital patch.
When opening an editor we call in that order: - IDocumentProvider#connect(..) - ISourceViewer#configure(..) - ITextViewer#setDocument(..) Each call depends on the previous. When reusing an editor: RC2 calls configure(), connect(), setDocument(). The patch moves configure() to the end. connect() and setDocument() are called as part of AbstractTextEditor#doSetInput(). Reviewed by DM. Fixed in HEAD. Will be released into I200406181600. starting to verify. Not fixed. I get the same behaviour as initially reported on RC 3. We detected one part of the problem and fixed it. Then, while testing it we missed the important part of the test scenario: we reused the project setup described in comment 0 a. to d. opened the files and then continued. As it turns out, the really important part is "save it" in step d. In our fix we re-install the reconciler using IReconciler.install(ITextViewer) and here's the second not-fixed part of the problem: AbstractReconciler.install(ITextViewer) makes the non-speced assumption that the viewer hasn't a document yet and that the reconciler will be triggered via ITextInputListener. This is not true in our case: the viewer has its document already set. I've attached a patch to AbstractReconciler which removes the assumptions from AbstractReconciler.install(ITextViewer) and AbstractReconciler.unstall(ITextViewer). Open issue: investigate why the save triggers the bug. Created attachment 12740 [details]
Patch to be applied to AbstractReconciler.java
Will be fixed post 3.0. Changing target milestone. This fix had to be put into 3.0.1 in order to fix bug 62862. started verifying... verified for 3.1 M1 Verified in M200409010800. |