Bug 151086 - [EditorMgmt] Editor History not updated when SourceLookupFacility reuses an open editor
Summary: [EditorMgmt] Editor History not updated when SourceLookupFacility reuses an o...
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-19 10:17 EDT by Tracy Hodges CLA
Modified: 2019-09-06 15:35 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tracy Hodges CLA 2006-07-19 10:17:07 EDT
When the SourceLookupFacility reuses an already open editor (openEditor method calls setInput), the new IEditiorInput is not added to the workbench's editor history.

If a page.openEditor is called, then the workbench editor history is updated.

Problem can be demonstrated with the JDT.
To recreate the problem:
   Make sure the Run/Debug preferences is set to reuse editors
   Set a breakpoint somewhere in a Java program
      (The breakpoint will need to be several calls deep through different classes).
   Close All Editors
   (Open and close enough editors on class files you will not be debugging, to fill up the MRU with irrelevant files)
   Execute the Java program and hit the breakpoint.
   The file with the breakpoint should be opened automatically.
   Notice that the file should have been added to the MRU (under the File menu)
   Now using the Debug View, click back into the stack frame to a method that is in another class.
   The editor should switch to that class.
   Check the MRU list.  It should not be showing the 2nd class like I think it should.

Basically, SourceLookupFacility.openEditor(...) will call setInput on the editor directly if it is an IReusableEditor and it is already opened.   This bypasses the IWorkbenchPage.openEditor call.   If the IWorkbenchPage.openEditor call was made, then eventually the workbench's EditorHistory would be modified.

The IWorkbenchPage interface defines a reuseEditor() method that I think should be being called instead.
Comment 1 Darin Wright CLA 2006-07-19 10:26:44 EDT
Using IWorkbenchPage.reuseEditor(...) lead me to this error:

Problem detected with part org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor (class = org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor): Editor is not firing a PROP_INPUT event in response to IReusableEditor.setInput(...)
Comment 2 Darin Wright CLA 2006-07-19 10:34:11 EDT
Fixed in SourceLookupFacility and CommonSourceNotFoundEditor.
Comment 3 Michael Rennie CLA 2006-07-19 11:33:46 EDT
fixed, pending verification
Comment 4 Michael Rennie CLA 2006-07-19 11:58:59 EDT
Doesn't seem to be working when you select another frame.

The following simple exmaple demonstrates:

public class C1 {
	public void foo() {
		System.out.println("breakpoint"); //breakpoint here
	}
}

public class C2 {

	public static void main(String[] args) {
		C1 c1 = new C1();
		c1.foo();
	}
}

Run C2 following the steps above, and notice that if you select the stack frame for C2 while suspended at C1, the C2 editor is not added to the MRU editor list.

As we are now using the workbench page's method I'll kick it over to them for comment.
Comment 5 Kim Horne CLA 2007-05-08 11:07:41 EDT
Punting to Boris
Comment 6 Boris Bokowski CLA 2007-05-11 23:31:56 EDT
Cannot reproduce. WorkbenchPage.reuseEditor() was changed as part of the fix for bug 165970, which might have fixed the issue described here as well.
Comment 7 Tracy Hodges CLA 2010-01-26 17:14:17 EST
I have retested this myself again using the 3.4 codebase.  The problem is still present and easily reproducable.   

NOTE: You must have the debug preference 'Reuse editor when displaying source code' set to checked.

Reopening the issue.
Comment 8 Eclipse Webmaster CLA 2019-09-06 15:35:13 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.