Bug 226867 [Browser] Web browser preference change causes web browser editor error through open file
Build ID: M20080221-1800 Steps To Reproduce: 1.File->Open file...->A htm file 2.Open successfullly 3.Windows->Preferences...->Web browser->Change any setting(even later change back)->Apply 4.File->Open file...->Same htm file 5.Open failed. org.eclipse.ui.PartInitException: Could not open Web browser on abc.htm. Ensure that it is an uncompressed file. at org.eclipse.ui.internal.browser.WebBrowserEditor.init(WebBrowserEditor.java:225) More information: It seems that web browser preference change affects browser editor setings.When first open a htm file, the FileStoreEditorInput adapters a WebBrowserEditorInput. After change, the FileStoreEditorInput can adapters neither a IPathEditorInput or a WebBrowserEditorInput.A PartInitException ocurred.
bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/WebBrowserEditor.java
doOpenExternalEditor(id, input);
            }
        };
        Display display = getSite().getShell().getDisplay();
        close();
        display.asyncExec(runnable);
    }
    
    protected void doOpenExternalEditor(String id, IEditorInput input) {
        IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
        String name = input.getName();
        IEditorDescriptor [] editors = registry.getEditors(name);
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        String editorId = null;
        for (int i = 0; i < editors.length; i++) {
            IEditorDescriptor editor = editors[i];
            if (editor.getId().equals(id))
                continue;
            editorId = editor.getId();
            break;
        } 
        
        IEditorDescriptor ddesc = registry.getDefaultEditor(name);
        if (ddesc!=null && ddesc.getId().equals(id)) {
            int dot = name.lastIndexOf('.');
            String ext = name;
            if (dot!= -1)
                ext = "*."+name.substring(dot+1); 
            registry.setDefaultEditor(ext, null);
        }