1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

use the getAdapter() to find a resource for the annotation model.

This commit is contained in:
Alain Magloire 2003-01-02 21:46:52 +00:00
parent a96a1d14e4
commit d1018a280e

View file

@ -6,6 +6,7 @@ package org.eclipse.cdt.internal.ui.editor;
*/ */
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage; import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.AbstractDocument; import org.eclipse.jface.text.AbstractDocument;
@ -91,6 +92,13 @@ public class CDocumentProvider extends FileDocumentProvider {
if (element instanceof IFileEditorInput) { if (element instanceof IFileEditorInput) {
IFileEditorInput input= (IFileEditorInput) element; IFileEditorInput input= (IFileEditorInput) element;
return new CMarkerAnnotationModel(input.getFile()); return new CMarkerAnnotationModel(input.getFile());
} else if (element instanceof IStorageEditorInput) {
// Fall back on the adapter.
IStorageEditorInput input = (IStorageEditorInput) element;
IResource res = (IResource)input.getAdapter(IResource.class);
if (res != null && res.exists()) {
return new CMarkerAnnotationModel(res);
}
} }
return super.createAnnotationModel(element); return super.createAnnotationModel(element);