diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java index 4e95ef17895..8827a8e46f9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java @@ -75,6 +75,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.SafeRunner; @@ -617,6 +618,11 @@ public static String getEditorID(IEditorInput input, Object inputObject) { if (input instanceof IFileEditorInput) { IFileEditorInput editorInput = (IFileEditorInput) input; IFile file = editorInput.getFile(); + try { + return IDE.getEditorDescriptor(file, true, false).getId(); + } catch (PartInitException | OperationCanceledException e) { + // do nothing + } // Try file specific editor. try { String editorID = file.getPersistentProperty(IDE.EDITOR_KEY);