Project

General

Profile

« Previous | Next » 

Revision 3be6ef3e

Added by Niels Hoffmann over 13 years ago

performed javacscript:fix and worked on documentation

View differences:

taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorViewerConfiguration.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.apache.log4j.Logger;
13
import org.eclipse.jface.text.IDocument;
14
import org.eclipse.jface.text.presentation.IPresentationReconciler;
15
import org.eclipse.jface.text.presentation.PresentationReconciler;
16
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
17
import org.eclipse.jface.text.source.ISourceViewer;
18
import org.eclipse.jface.text.source.SourceViewerConfiguration;
19

  
20
import eu.etaxonomy.taxeditor.annotatedlineeditor.SupplementalTextScanner;
21
import eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy;
22

  
23

  
24
/**
25
 * @author p.ciardelli
26
 * @created 25.06.2009
27
 * @version 1.0
28
 */
29
public class BulkEditorViewerConfiguration extends SourceViewerConfiguration {
30
	private static final Logger logger = Logger
31
			.getLogger(BulkEditorViewerConfiguration.class);
32
	
33
	private ILineDisplayStrategy lineDisplayStrategy;
34

  
35
	public BulkEditorViewerConfiguration(ILineDisplayStrategy lineDisplayStrategy) {
36
		this.lineDisplayStrategy = lineDisplayStrategy;
37
	}
38
	
39
	
40
	/* (non-Javadoc)
41
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
42
	 */
43
	@Override
44
	public IPresentationReconciler getPresentationReconciler(
45
			final ISourceViewer sourceViewer) {
46
		
47
		PresentationReconciler reconciler = new PresentationReconciler();
48
		
49
		// Color supplemental text, e.g. markers
50
		DefaultDamagerRepairer damageRepairer = new DefaultDamagerRepairer(new SupplementalTextScanner(sourceViewer, lineDisplayStrategy));
51
		reconciler.setDamager(damageRepairer, IDocument.DEFAULT_CONTENT_TYPE);
52
		reconciler.setRepairer(damageRepairer, IDocument.DEFAULT_CONTENT_TYPE);
53
		
54
		return reconciler;
55
	}
56
	
57
	/* (non-Javadoc)
58
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredContentTypes(org.eclipse.jface.text.source.ISourceViewer)
59
	 */
60
	@Override
61
	public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
62
		return new String[] { IDocument.DEFAULT_CONTENT_TYPE, ILineDisplayStrategy.SUPPLEMENTAL_TEXT };
63
	}
64
}
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.apache.log4j.Logger;
13
import org.eclipse.jface.text.IDocument;
14
import org.eclipse.jface.text.presentation.IPresentationReconciler;
15
import org.eclipse.jface.text.presentation.PresentationReconciler;
16
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
17
import org.eclipse.jface.text.source.ISourceViewer;
18
import org.eclipse.jface.text.source.SourceViewerConfiguration;
19

  
20
import eu.etaxonomy.taxeditor.annotatedlineeditor.SupplementalTextScanner;
21
import eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy;
22

  
23

  
24
/**
25
 * <p>BulkEditorViewerConfiguration class.</p>
26
 *
27
 * @author p.ciardelli
28
 * @created 25.06.2009
29
 * @version 1.0
30
 */
31
public class BulkEditorViewerConfiguration extends SourceViewerConfiguration {
32
	private static final Logger logger = Logger
33
			.getLogger(BulkEditorViewerConfiguration.class);
34
	
35
	private ILineDisplayStrategy lineDisplayStrategy;
36

  
37
	/**
38
	 * <p>Constructor for BulkEditorViewerConfiguration.</p>
39
	 *
40
	 * @param lineDisplayStrategy a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy} object.
41
	 */
42
	public BulkEditorViewerConfiguration(ILineDisplayStrategy lineDisplayStrategy) {
43
		this.lineDisplayStrategy = lineDisplayStrategy;
44
	}
45
	
46
	
47
	/* (non-Javadoc)
48
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
49
	 */
50
	/** {@inheritDoc} */
51
	@Override
52
	public IPresentationReconciler getPresentationReconciler(
53
			final ISourceViewer sourceViewer) {
54
		
55
		PresentationReconciler reconciler = new PresentationReconciler();
56
		
57
		// Color supplemental text, e.g. markers
58
		DefaultDamagerRepairer damageRepairer = new DefaultDamagerRepairer(new SupplementalTextScanner(sourceViewer, lineDisplayStrategy));
59
		reconciler.setDamager(damageRepairer, IDocument.DEFAULT_CONTENT_TYPE);
60
		reconciler.setRepairer(damageRepairer, IDocument.DEFAULT_CONTENT_TYPE);
61
		
62
		return reconciler;
63
	}
64
	
65
	/* (non-Javadoc)
66
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredContentTypes(org.eclipse.jface.text.source.ISourceViewer)
67
	 */
68
	/** {@inheritDoc} */
69
	@Override
70
	public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
71
		return new String[] { IDocument.DEFAULT_CONTENT_TYPE, ILineDisplayStrategy.SUPPLEMENTAL_TEXT };
72
	}
73
}

Also available in: Unified diff