All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.jface.text.source.Annotation Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright (c) 2000, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.text.source;


/**
 * Annotation managed by an
 * {@link org.eclipse.jface.text.source.IAnnotationModel}.
 * 

* Annotations are typed, can have an associated text and can be marked as persistent and * deleted. Annotations which are not explicitly initialized with an annotation * type are of type "org.eclipse.text.annotation.unknown". */ public class Annotation { /** * Constant for unknown annotation types.

* Value: "org.eclipse.text.annotation.unknown" * @since 3.0 */ public final static String TYPE_UNKNOWN= "org.eclipse.text.annotation.unknown"; //$NON-NLS-1$ /** * The type of this annotation. * @since 3.0 */ private String fType; /** * Indicates whether this annotation is persistent or not. * @since 3.0 */ private boolean fIsPersistent= false; /** * Indicates whether this annotation is marked as deleted or not. * @since 3.0 */ private boolean fMarkedAsDeleted= false; /** * The text associated with this annotation. * @since 3.0 */ private String fText; /** * Creates a new annotation that is not persistent and type less. */ protected Annotation() { this(null, false, null); } /** * Creates a new annotation with the given properties. * * @param type the unique name of this annotation type * @param isPersistent true if this annotation is * persistent, false otherwise * @param text the text associated with this annotation * @since 3.0 */ public Annotation(String type, boolean isPersistent, String text) { fType= type; fIsPersistent= isPersistent; fText= text; } /** * Creates a new annotation with the given persistence state. * * @param isPersistent true if persistent, false otherwise * @since 3.0 */ public Annotation(boolean isPersistent) { this(null, isPersistent, null); } /** * Returns whether this annotation is persistent. * * @return true if this annotation is persistent, false * otherwise * @since 3.0 */ public boolean isPersistent() { return fIsPersistent; } /** * Sets the type of this annotation. * * @param type the annotation type * @since 3.0 */ public void setType(String type) { fType= type; } /** * Returns the type of the annotation. * * @return the type of the annotation * @since 3.0 */ public String getType() { return fType == null ? TYPE_UNKNOWN : fType; } /** * Marks this annotation deleted according to the value of the * deleted parameter. * * @param deleted true if annotation should be marked as deleted * @since 3.0 */ public void markDeleted(boolean deleted) { fMarkedAsDeleted= deleted; } /** * Returns whether this annotation is marked as deleted. * * @return true if annotation is marked as deleted, false * otherwise * @since 3.0 */ public boolean isMarkedDeleted() { return fMarkedAsDeleted; } /** * Sets the text associated with this annotation. * * @param text the text associated with this annotation * @since 3.0 */ public void setText(String text) { fText= text; } /** * Returns the text associated with this annotation. * * @return the text associated with this annotation or null * @since 3.0 */ public String getText() { return fText; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy