ref #6190 removing svn property place holder in first line of code - java files
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / annotatedlineeditor / LineSelectionSource.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.taxeditor.annotatedlineeditor;
11
12 import org.apache.log4j.Logger;
13 import org.eclipse.jface.text.source.Annotation;
14 import org.eclipse.jface.text.source.IAnnotationModel;
15 import org.eclipse.jface.text.source.ISourceViewer;
16
17 /**
18 * <p>LineSelectionSource class.</p>
19 *
20 * @author p.ciardelli
21 * @created 03.07.2009
22 * @version 1.0
23 */
24 public class LineSelectionSource implements ILineSelectionSource {
25 @SuppressWarnings("unused")
26 private static final Logger logger = Logger
27 .getLogger(LineSelectionSource.class);
28
29 private ISourceViewer viewer;
30
31 /**
32 * <p>Constructor for LineSelectionSource.</p>
33 *
34 * @param viewer a {@link org.eclipse.jface.text.source.ISourceViewer} object.
35 */
36 public LineSelectionSource(ISourceViewer viewer) {
37 this.viewer = viewer;
38 }
39
40 /* (non-Javadoc)
41 * @see eu.etaxonomy.taxeditor.bulkeditor.ILineSelectionSource#getSelectedObjectAtLine(int)
42 */
43 /** {@inheritDoc} */
44 public Object getSelectedObjectAtLine(int line) {
45 IAnnotationModel model = viewer.getAnnotationModel();
46 if (model instanceof LineAnnotationModel) {
47 Annotation annotation = ((LineAnnotationModel) model).
48 getAnnotationAtLine(line, viewer.getDocument());
49 if (annotation != null) {
50 return ((LineAnnotation) annotation).getEntity();//getPropertySource();
51 }
52 }
53 return null;
54 }
55 }