1 package eu
.etaxonomy
.taxeditor
.prototype2
.view
.nameviewersupport
;
3 import org
.eclipse
.jface
.text
.presentation
.IPresentationReconciler
;
4 import org
.eclipse
.jface
.text
.presentation
.PresentationReconciler
;
5 import org
.eclipse
.jface
.text
.rules
.DefaultDamagerRepairer
;
6 import org
.eclipse
.jface
.text
.source
.ISourceViewer
;
7 import org
.eclipse
.jface
.text
.source
.SourceViewerConfiguration
;
9 public class NameViewerConfig
extends SourceViewerConfiguration
{
12 * Whenever a change is made to the document, a notification is sent to the
13 * IPresentationDamager for each content type in the affected area of the document.
14 * The IPresentationDamager in turn returns an IRegion indicating the area of the
15 * document which needs to be rebuilt as a result of the change. This information is
16 * then passed on to the IPresentationRepairer, which is responsible for reapplying
17 * the textual presentation for the affected region.
19 * This all probably sounds quite complicated. Fortunately you probably won't ever need
20 * to implement any of these classes yourself. JFace Text provides a
21 * DefaultDamagerRepairer which does the job both of the IPresentationDamager and the
22 * IPresentationRepairer. It also provides a PresentationReconciler class which performs
23 * the co-ordination role we described earlier.
27 * If you understand document partitioning then you are in a very good position to understand
28 * syntax highlighting in a JFace Text application. Essentially, syntax highlighting involves
29 * dividing a region into tokens, each of which has its own text display attributes. The
30 * standard mechanism for doing this also involves the use of the already familiar tokens,
34 public IPresentationReconciler
getPresentationReconciler(ISourceViewer sourceViewer
)
36 PresentationReconciler reconciler
= new PresentationReconciler();
38 DefaultDamagerRepairer dr
= new NameDamagerRepairer(new NamePartitionScanner());
39 // reconciler.setDamager(dr, "genus");
40 // reconciler.setRepairer(dr, "genus");