Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 543281

Summary: Improve editor opening when using lsp4e.debug's source locators
Product: z_Archived Reporter: Jonah Graham <jonah>
Component: LSP4EAssignee: Jonah Graham <jonah>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: jonah, mistria
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=516470
https://git.eclipse.org/r/134802
https://git.eclipse.org/c/lsp4e/lsp4e.git/commit/?id=fda12d10396d27d017aa8f2d442c832e297d8fd9
Whiteboard:

Description Jonah Graham CLA 2019-01-08 16:44:58 EST
At the moment the lsp4e.debug's source locator infra hard codes the use of org.eclipse.ui.genericeditor.GenericEditor, for example when hitting a breakpoint or clicking on the stack frame.

We should really respect the user's choice of editor, and the IDE class makes that a bit easier by being able to get the cached editor id for an IFile, or the user's set default editor if they have not opened it before.

This depends on a platform change, Bug 516470, that I will provide a workaround for so that we don't yet need to depend on latest platform to get this rolled out.
Comment 1 Jonah Graham CLA 2019-01-08 16:46:24 EST
This is particularly needed for CDT so that CDT's C/C++ editor opens when a breakpoint is hit.
Comment 2 Mickael Istria CLA 2019-01-08 16:50:11 EST
Wouldn't IDE.openEditor(file) work?
Comment 3 Eclipse Genie CLA 2019-01-08 16:50:28 EST
New Gerrit change created: https://git.eclipse.org/r/134802
Comment 4 Jonah Graham CLA 2019-01-08 16:53:42 EST
(In reply to Mickael Istria from comment #2)
> Wouldn't IDE.openEditor(file) work?

No, the platform debug infra require we return an editor id so that somewhere else in the chain can actually do the opening. See org.eclipse.debug.ui.ISourcePresentation.getEditorId(IEditorInput, Object)
Comment 5 Jonah Graham CLA 2019-01-08 16:55:59 EST
For ref, the similar (but different) implementation of IDE.openEditor() used by debug is found here: org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.openEditor(ISourceLookupResult, IWorkbenchPage)