KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > editor > text > XMLProblemAnnotation


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.ant.internal.ui.editor.text;
12
13 import org.eclipse.ant.internal.ui.model.IProblem;
14 import org.eclipse.jface.text.source.Annotation;
15
16 /**
17  * Annotation representing an <code>IProblem</code>.
18  */

19 public class XMLProblemAnnotation extends Annotation {
20     
21     public static final String JavaDoc ERROR_ANNOTATION_TYPE= "org.eclipse.ui.workbench.texteditor.error"; //$NON-NLS-1$
22
public static final String JavaDoc WARNING_ANNOTATION_TYPE= "org.eclipse.ui.workbench.texteditor.warning"; //$NON-NLS-1$
23
public static final String JavaDoc INFO_ANNOTATION_TYPE= "org.eclipse.ui.workbench.texteditor.info"; //$NON-NLS-1$
24

25     private IProblem fProblem;
26     
27     public XMLProblemAnnotation(IProblem problem) {
28         
29         fProblem= problem;
30         
31         if (fProblem.isError()) {
32             setType(ERROR_ANNOTATION_TYPE);
33         } else if (fProblem.isWarning()) {
34             setType(WARNING_ANNOTATION_TYPE);
35         } else {
36             setType(INFO_ANNOTATION_TYPE);
37         }
38         
39         setText(fProblem.getMessage());
40     }
41 }
42
Popular Tags