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

Bug 486665

Summary: Resolve API breakage of IDE#getEditorDescription (OperationCanceledException, user interaction)
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: Mickael Istria <mistria>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P1 CC: gautier.desaintmartinlacaze, Lars.Vogel, loskutov, markus.kell.r, mistria, psuzzi
Version: 4.6   
Target Milestone: 4.6 M6   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=485201
https://git.eclipse.org/r/65348
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=912f0f8bfe79b6c3e7bb8ae687d7399738b29d13
Whiteboard:
Bug Depends on:    
Bug Blocks: 90292    

Description Dani Megert CLA 2016-01-27 11:36:10 EST
Adapt all callers of #getEditorDescription in the SDK to the new OperationCanceledException.

We should also add an entry to the migration guide.
Comment 1 Markus Keller CLA 2016-01-27 12:53:34 EST
The OperationCanceledException is a small breakage that would be acceptable. But the problem is much deeper. The IDE#getEditorDescriptor(..) APIs are headless APIs that resolve an editor deterministically and without user interaction.

Opening a dialog from these APIs was a breaking change that must be reverted.

One scenario that is broken due to these changes:

- Preferences > File Associations: Open unassociated files with: Ask via pop-up
- create a new file a.zz
- open in Text Editor, add some content, Save
- Team > Show Local History
- try to open the context menu on a history entry (e.g. right-click)

=> "Editor Selection" dialog is opened. Context menu is inaccessible.
Comment 2 Dani Megert CLA 2016-01-27 14:49:14 EST
Mickael, maybe you can move the logic that asks the user into the #openEditor methods. That would also allow us to get rid of the OperationCanceledException.
Comment 3 Dani Megert CLA 2016-01-28 05:01:15 EST
(In reply to Dani Megert from comment #2)
> Mickael, maybe you can move the logic that asks the user into the
> #openEditor methods. That would also allow us to get rid of the
> OperationCanceledException.

Here is a better and cleaner solution:

- Introduce new #getEditorDescriptor API(s) that take a boolean which tells whether it is OK to open a dialog in the UI.
- Deprecate the old methods and call the new ones with 'false'.
- Fix all new deprecation warnings where #getEditorDescriptor is called, using either 'true' or 'false', depending on the case.
- Add an entry to the migration guide.
Comment 4 Mickael Istria CLA 2016-01-28 05:07:58 EST
(In reply to Dani Megert from comment #3)
> Here is a better and cleaner solution:
> - Introduce new #getEditorDescriptor API(s) that take a boolean which tells
> whether it is OK to open a dialog in the UI.
> - Deprecate the old methods and call the new ones with 'false'.
> - Fix all new deprecation warnings where #getEditorDescriptor is called,
> using either 'true' or 'false', depending on the case.
> - Add an entry to the migration guide.

I thought about that. I'll do it like this.
Comment 5 Eclipse Genie CLA 2016-01-28 06:22:33 EST
New Gerrit change created: https://git.eclipse.org/r/65348