Bug 25034 - Loosing last used editor as default editor
Summary: Loosing last used editor as default editor
Status: RESOLVED DUPLICATE of bug 24684
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-17 17:41 EDT by Richard Kulp CLA
Modified: 2002-10-18 09:26 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 Richard Kulp CLA 2002-10-17 17:41:24 EDT
There is a bug in that if you open a file that has more than one type of editor 
assigned to it using a specific editor. If you do the following this is the bug:

1) Using OpenWith-> a specific editor that is not the default editor
2) Close the editor
 (now this specific editor is marked as the default editor)
3) Using OpenWith-> select that specific editor again
 (now this specific editor is no longer marked as the default editor)

Double-clicking always opens the default editor without changing who the next 
default editor will be.

The problem is in:

EditorManager.openEditor(String editorId,IEditorInput input,boolean setVisible)

It is in this piece of code:

// Update the default editor for this file.
IEditorDescriptor defaultDesc = (EditorDescriptor)getEditorRegistry
().getDefaultEditor(file);
if (defaultDesc == null)
  defaultDesc = (EditorDescriptor)getEditorRegistry().getDefaultEditor();
String editorID = desc.getId();
if(defaultDesc.getId().equals(editorId)) {
  getEditorRegistry().setDefaultEditor(file, null);
} else {
  getEditorRegistry().setDefaultEditor(file, editorID);
}

In this case getDefaultEditor(file) will return the current selected editor as 
the default editor (since we choose that one specifically) and so it will match 
the current selected editor and so do a setDefaultEditor(file, null); Which 
then wipes out this specific selected editor as the default and returns it to 
the filetype default editor, which is a different editor. The problem is that 
it is not the default editor that is wanted for this test, but the default 
default editor (i.e. the default editor for the file type, not the default 
editor for the file itself). In that case if you specifically selected the 
default default (filetype editor) you want to wipe out the selection.

Thanks,
Rich Kulp
Comment 1 Sonia Dimitrov CLA 2002-10-18 09:26:03 EDT

*** This bug has been marked as a duplicate of 24684 ***