### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.tests Index: Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/EditorTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/EditorTests.java,v retrieving revision 1.7 diff -u -r1.7 EditorTests.java --- Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/EditorTests.java 8 May 2006 20:51:33 -0000 1.7 +++ Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/EditorTests.java 19 Jan 2010 21:23:37 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. + * Copyright (c) 2004, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,6 +19,7 @@ import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.content.IContentType; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorRegistry; @@ -83,15 +84,23 @@ assertEquals(0, window.getActivePage().getEditors().length); } - public void testEditorProperties() { + public void testEditorProperties() throws Exception { IEditorRegistry registry = WorkbenchPlugin.getDefault().getEditorRegistry(); assertNull(registry.findEditor(EDITOR_ID)); getBundle(); + + IFile file = getFile("test.xml"); + IContentType contentType = IDE.getContentType(file); IEditorDescriptor desc = registry.findEditor(EDITOR_ID); assertNotNull(desc); testEditorProperties(desc); + + // tests bug 193361 + IEditorDescriptor descriptor = registry.getDefaultEditor(file.getName(), contentType); + assertEquals(desc, descriptor); + removeBundle(); assertNull(registry.findEditor(EDITOR_ID)); try { @@ -111,16 +120,20 @@ assertNotNull(desc.getImageDescriptor()); } + private IFile getFile() throws CoreException { + return getFile("someFile"); + } + /** * */ - private IFile getFile() throws CoreException { + private IFile getFile(String fileName) throws CoreException { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IProject testProject = workspace.getRoot().getProject(getName()); testProject.create(null); testProject.open(null); - IFile iFile = testProject.getFile("someFile"); + IFile iFile = testProject.getFile(fileName); iFile.create(new ByteArrayInputStream(new byte[] { '\n' }), true, null); return iFile; } Index: data/org.eclipse.newEditor1/plugin.xml =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/data/org.eclipse.newEditor1/plugin.xml,v retrieving revision 1.4 diff -u -r1.4 plugin.xml --- data/org.eclipse.newEditor1/plugin.xml 15 Dec 2004 15:22:09 -0000 1.4 +++ data/org.eclipse.newEditor1/plugin.xml 19 Jan 2010 21:23:37 -0000 @@ -17,6 +17,7 @@ id="testDynamicEditorAddition" point="org.eclipse.ui.editors">