9131a02950bd78290f13f417198fb9549c1b6f03
[taxeditor.git] / taxeditor-bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / LineAnnotation.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.bulkeditor;
11
12 import org.eclipse.core.runtime.Assert;
13 import org.eclipse.jface.text.source.Annotation;
14
15 /**
16 * An <code>Annotation</code> which spans an entire line and holds an object associated
17 * with the line in an <code>IEntityContainer</code>.
18 *
19 * @author p.ciardelli
20 * @created 25.06.2009
21 * @version 1.0
22 */
23 public class LineAnnotation extends Annotation {
24
25 public static final String TYPE_GENERIC = Annotation.TYPE_UNKNOWN;
26
27 private IEntityContainer<?> container;
28
29 public LineAnnotation(IEntityContainer<?> container) {
30 Assert.isNotNull(container);
31 this.container = container;
32 setType(TYPE_GENERIC);
33 }
34
35 public IEntityContainer<?> getEntityContainer() {
36 return container;
37 }
38
39 @Override
40 public String getText() {
41 return container.getEditableText();
42 }
43
44 @Override
45 public void markDeleted(boolean deleted) {
46 super.markDeleted(deleted);
47 container.markAsDeleted();
48 }
49
50 @Override
51 public void setText(String text) {
52 super.setText(text);
53 container.setText(text);
54 }
55
56 @Override
57 public String toString() {
58 // For debugging
59 return getText();
60 }
61 }