1 11 package org.eclipse.pde.internal.ui.editor; 12 13 import java.io.File ; 14 15 import org.eclipse.core.filebuffers.IDocumentSetupParticipant; 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.IAdaptable; 18 import org.eclipse.jface.text.IDocument; 19 import org.eclipse.jface.text.source.IAnnotationModel; 20 import org.eclipse.ui.editors.text.StorageDocumentProvider; 21 22 public class PDEStorageDocumentProvider extends StorageDocumentProvider { 23 24 private IDocumentSetupParticipant fSetupParticipant; 25 26 public PDEStorageDocumentProvider(IDocumentSetupParticipant participant) { 27 fSetupParticipant = participant; 28 } 29 30 protected void setupDocument(Object element, IDocument document) { 31 if (document != null && fSetupParticipant != null) { 32 fSetupParticipant.setup(document); 33 } 34 } 35 36 39 protected IAnnotationModel createAnnotationModel(Object element) throws CoreException { 40 if (element instanceof IAdaptable) { 41 IAdaptable input= (IAdaptable) element; 42 File file = (File )input.getAdapter(File .class); 43 if (file != null) { 44 return new SystemFileMarkerAnnotationModel(); 45 } 46 } 47 return super.createAnnotationModel(element); 48 } 49 50 51 } 52 | Popular Tags |