KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-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.jface.text.source.Annotation;
14 import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
15
16 public class AnnotationAccess extends DefaultMarkerAnnotationAccess {
17
18     /* (non-Javadoc)
19      * @see org.eclipse.jface.text.source.IAnnotationAccess#getType(org.eclipse.jface.text.source.Annotation)
20      */

21     public Object JavaDoc getType(Annotation annotation) {
22         if (annotation instanceof IXMLAnnotation) {
23             IXMLAnnotation xmlAnnotation= (IXMLAnnotation) annotation;
24             if (xmlAnnotation.isRelevant()) {
25                 return xmlAnnotation.getType();
26             }
27         }
28         
29         return super.getType(annotation);
30     }
31
32     /* (non-Javadoc)
33      * @see org.eclipse.jface.text.source.IAnnotationAccess#isTemporary(org.eclipse.jface.text.source.Annotation)
34      */

35     public boolean isTemporary(Annotation annotation) {
36         if (annotation instanceof IXMLAnnotation) {
37             IXMLAnnotation xmlAnnotation= (IXMLAnnotation) annotation;
38             if (xmlAnnotation.isRelevant()) {
39                 return xmlAnnotation.isTemporary();
40             }
41         }
42         return super.isTemporary(annotation);
43     }
44 }
Popular Tags