1 package net.sourceforge.phpeclipse.editors;
3 import org.eclipse.jface.text.IDocument;
4 import org.eclipse.jface.text.ITextDoubleClickStrategy;
5 import org.eclipse.jface.text.TextAttribute;
6 import org.eclipse.jface.text.presentation.IPresentationReconciler;
7 import org.eclipse.jface.text.presentation.PresentationReconciler;
8 import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
9 import org.eclipse.jface.text.rules.Token;
10 import org.eclipse.jface.text.source.ISourceViewer;
11 import org.eclipse.jface.text.source.SourceViewerConfiguration;
13 public class PHPConfiguration extends SourceViewerConfiguration
15 private PHPScanner scanner;
16 private ColorManager colorManager;
18 public PHPConfiguration(ColorManager colorManager)
20 this.colorManager = colorManager;
22 public String[] getConfiguredContentTypes(ISourceViewer sourceViewer)
25 IDocument.DEFAULT_CONTENT_TYPE,
26 PHPPartitionScanner.HTML_COMMENT,
27 PHPPartitionScanner.HTML_TAG };
30 protected PHPScanner getXMLScanner()
34 scanner = new PHPScanner(colorManager);
35 scanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IPHPColorConstants.DEFAULT))));
45 public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer)
47 PresentationReconciler reconciler = new PresentationReconciler();
49 DefaultDamagerRepairer dr =
50 new DefaultDamagerRepairer(getXMLScanner());
51 reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
52 reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);