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