01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.texteditor;
11:
12: import org.eclipse.core.runtime.IPath;
13:
14: import org.eclipse.core.resources.IFile;
15:
16: import org.eclipse.core.filebuffers.FileBuffers;
17: import org.eclipse.core.filebuffers.IAnnotationModelFactory;
18:
19: import org.eclipse.jface.text.source.AnnotationModel;
20: import org.eclipse.jface.text.source.IAnnotationModel;
21:
22: /**
23: * An annotation model factory for resource marker annotation models.
24: *
25: * @since 3.0
26: */
27: public class ResourceMarkerAnnotationModelFactory implements
28: IAnnotationModelFactory {
29:
30: /*
31: * @see org.eclipse.core.filebuffers.IAnnotationModelFactory#createAnnotationModel(org.eclipse.core.runtime.IPath)
32: */
33: public IAnnotationModel createAnnotationModel(IPath location) {
34: IFile file = FileBuffers.getWorkspaceFileAtLocation(location);
35: if (file != null)
36: return new ResourceMarkerAnnotationModel(file);
37: return new AnnotationModel();
38: }
39: }
|