Bug 291502 - [Preferences] Setting default editor sometimes fails
Summary: [Preferences] Setting default editor sometimes fails
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-06 11:31 EDT by Krzysztof Daniel CLA
Modified: 2019-09-06 15:36 EDT (History)
3 users (show)

See Also:


Attachments
Work in progress (1.60 KB, patch)
2009-10-07 09:43 EDT, Krzysztof Daniel CLA
no flags Details | Diff
mylyn/context/zip (14.39 KB, application/octet-stream)
2009-10-07 09:43 EDT, Krzysztof Daniel CLA
no flags Details
TestCase (4.33 KB, application/x-zip)
2009-10-12 06:59 EDT, Krzysztof Daniel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof Daniel CLA 2009-10-06 11:31:34 EDT
This has been observed on Eclipse 3.4.2, and also reported in bug 236104 comment 1.

When you change default editor f.e. for sql, this associations does not persists during Eclipse restart.

The issue is caused by preferences format. Default editors are stored as an ordered list (some of them may be default, because they are declared as default in plugin xml). Eclipse displays only the first one from the list as a default and uses it for opening files.

The problem is that FileEditorMapping#getDeclaredDefaultEditors calls WorkbenchActivityHelper#restrictCollection. RestrictCollection is based on collections and iterators, so the ordering is lost => user selected default editor is lost.

The more default editors you have, the biggest changes you have that your settings will be lost.

It is necessary to add custom parameter to saved preferences to indicate which editor was set as default by the user.
Comment 1 Krzysztof Daniel CLA 2009-10-07 09:43:45 EDT
Created attachment 148989 [details]
Work in progress

Needs testing
Comment 2 Krzysztof Daniel CLA 2009-10-07 09:43:48 EDT
Created attachment 148990 [details]
mylyn/context/zip
Comment 3 Krzysztof Daniel CLA 2009-10-08 09:56:58 EDT
changing importance to RFE, because original issue is caused by 3rd party plug-in, but the code might be improved.
Comment 4 Krzysztof Daniel CLA 2009-10-12 06:59:59 EDT
Created attachment 149352 [details]
TestCase

Small test case
Comment 5 Eclipse Webmaster CLA 2019-09-06 15:36:47 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.