Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 230865 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/ide/IDE.java (-1 / +17 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ui.ide;
11
package org.eclipse.ui.ide;
12
12
13
import java.io.IOException;
14
import java.io.InputStream;
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.ArrayList;
16
import java.util.ArrayList;
15
import java.util.Collections;
17
import java.util.Collections;
Lines 1099-1107 Link Here
1099
	 * @since 3.3
1101
	 * @since 3.3
1100
	 */
1102
	 */
1101
	private static String getEditorId(IFileStore fileStore) {
1103
	private static String getEditorId(IFileStore fileStore) {
1104
		String name = fileStore.getName();
1105
		try {
1106
			InputStream inputStream = fileStore.openInputStream(0, null);
1107
			IContentType[] contentTypes = Platform.getContentTypeManager().findContentTypesFor(inputStream, fileStore.getName());
1108
			IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
1109
			for (int i = 0; i < contentTypes.length; i++) {
1110
				IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(name, contentTypes[i]);
1111
				if (descriptor != null) {
1112
					return descriptor.getId();
1113
				}
1114
			}
1115
		} catch (CoreException e) {
1116
		} catch (IOException e) {
1117
		}
1102
		IEditorDescriptor descriptor;
1118
		IEditorDescriptor descriptor;
1103
		try {
1119
		try {
1104
			descriptor = IDE.getEditorDescriptor(fileStore.getName());
1120
			descriptor = IDE.getEditorDescriptor(name);
1105
		} catch (PartInitException e) {
1121
		} catch (PartInitException e) {
1106
			return null;
1122
			return null;
1107
		}
1123
		}

Return to bug 230865