Skip to content

Commit c1517a3

Browse files
committed
Make ContentTypes->default text editor as Generic Code Editor.
Fixes #2527 Make ContentTypes->default text editor as Generic Code Editor. Fixes #2527
1 parent 139fb8c commit c1517a3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/registry/EditorRegistry.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2017 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -1358,6 +1358,13 @@ private IEditorDescriptor selectDefaultEditor(List<IEditorDescriptor> descriptor
13581358
String key = IPreferenceConstants.DEFAULT_EDITOR_FOR_CONTENT_TYPE + contentType.getId();
13591359
String defaultEditorId = store.getString(key);
13601360
IEditorDescriptor descriptor = null;
1361+
if (defaultEditorId.isEmpty() && contentType.getId().contentEquals("org.eclipse.core.runtime.text")) { //$NON-NLS-1$
1362+
IEditorDescriptor genericEditor = descriptors.stream()
1363+
.filter(e -> "org.eclipse.ui.genericeditor.GenericEditor".equals(e.getId())) //$NON-NLS-1$
1364+
.findFirst().orElse(null);
1365+
store.setValue(key, genericEditor.getId());
1366+
return genericEditor;
1367+
}
13611368
if (defaultEditorId != null && !defaultEditorId.isBlank()) {
13621369
descriptor = descriptors.stream().filter(d -> defaultEditorId.equals(d.getId())).findFirst().orElse(null);
13631370
}

0 commit comments

Comments
 (0)