1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Bug 579758 - Codan marker resolution doesn't work with CEditor embedded

in a multi page editor

Adapt editorPart to ITextEditor to support more use cases

Change-Id: I21e367e793bc17da263775b22ed13e82742be10f
Signed-off-by: Dominic Scharfe <dominic.scharfe@coseda-tech.com>
This commit is contained in:
Dominic Scharfe 2022-04-26 14:56:54 +02:00
parent 290136af02
commit 491333aaa4

View file

@ -35,6 +35,7 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.text.BadLocationException;
@ -177,12 +178,8 @@ public abstract class AbstractCodanCMarkerResolution implements ICodanMarkerReso
* @return the document of that part
*/
protected IDocument openDocument(IEditorPart editorPart) {
if (editorPart instanceof ITextEditor) {
ITextEditor editor = (ITextEditor) editorPart;
IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
return doc;
}
return null;
ITextEditor textEditor = Adapters.adapt(editorPart, ITextEditor.class);
return textEditor == null ? null : textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
}
/**