KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > texteditor > ResourceMarkerAnnotationModelFactory


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.texteditor;
12
13 import org.eclipse.core.runtime.IPath;
14
15 import org.eclipse.core.resources.IFile;
16
17 import org.eclipse.core.filebuffers.FileBuffers;
18 import org.eclipse.core.filebuffers.IAnnotationModelFactory;
19
20 import org.eclipse.jface.text.source.AnnotationModel;
21 import org.eclipse.jface.text.source.IAnnotationModel;
22
23 /**
24  * An annotation model factory for resource marker annotation models.
25  *
26  * @since 3.0
27  */

28 public class ResourceMarkerAnnotationModelFactory implements 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 }
40
Popular Tags