Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / BulkEditorViewerConfiguration.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 package eu.etaxonomy.taxeditor.bulkeditor;
10
11 import org.eclipse.jface.text.IDocument;
12 import org.eclipse.jface.text.presentation.IPresentationReconciler;
13 import org.eclipse.jface.text.presentation.PresentationReconciler;
14 import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
15 import org.eclipse.jface.text.source.ISourceViewer;
16 import org.eclipse.jface.text.source.SourceViewerConfiguration;
17
18 import eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy;
19 import eu.etaxonomy.taxeditor.annotatedlineeditor.SupplementalTextScanner;
20
21
22 /**
23 * <p>BulkEditorViewerConfiguration class.</p>
24 *
25 * @author p.ciardelli
26 * @created 25.06.2009
27 * @version 1.0
28 */
29 public class BulkEditorViewerConfiguration extends SourceViewerConfiguration {
30
31 private ILineDisplayStrategy lineDisplayStrategy;
32
33 /**
34 * <p>Constructor for BulkEditorViewerConfiguration.</p>
35 *
36 * @param lineDisplayStrategy a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy} object.
37 */
38 public BulkEditorViewerConfiguration(ILineDisplayStrategy lineDisplayStrategy) {
39 this.lineDisplayStrategy = lineDisplayStrategy;
40 }
41
42
43 /* (non-Javadoc)
44 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
45 */
46 /** {@inheritDoc} */
47 @Override
48 public IPresentationReconciler getPresentationReconciler(
49 final ISourceViewer sourceViewer) {
50
51 PresentationReconciler reconciler = new PresentationReconciler();
52
53 // Color supplemental text, e.g. markers
54 DefaultDamagerRepairer damageRepairer = new DefaultDamagerRepairer(new SupplementalTextScanner(sourceViewer, lineDisplayStrategy));
55 reconciler.setDamager(damageRepairer, IDocument.DEFAULT_CONTENT_TYPE);
56 reconciler.setRepairer(damageRepairer, IDocument.DEFAULT_CONTENT_TYPE);
57
58 return reconciler;
59 }
60
61 /* (non-Javadoc)
62 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredContentTypes(org.eclipse.jface.text.source.ISourceViewer)
63 */
64 /** {@inheritDoc} */
65 @Override
66 public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
67 return new String[] { IDocument.DEFAULT_CONTENT_TYPE, ILineDisplayStrategy.SUPPLEMENTAL_TEXT };
68 }
69 }