Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Syntax Highlighting

Hi All,

I have to do syntax highlighting for few keywords in my C Editor

The existing functionality of C Editor should be there along with my key words highlighting.

 

For starting:

 I have created a new editor using ‘org.eclipse.ui.editors’ extension point

In my class file I have extended from ‘CEditor’ and in this class, function ‘initializeEditor’

 

protected void initializeEditor() {

super.initializeEditor();

            setSourceViewerConfiguration(new MySourceViewerConfig(CUIPlugin.getDefault().getTextTools(),this));

}          

 

In class MySourceViewerConfig I have extended from ‘CSourceViewerConfiguration’

 

public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {

                        IPresentationReconciler reconciler = super.getPresentationReconciler(sourceViewer);

                        DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getTagScanner());

                        ((PresentationReconciler) reconciler).setDamager(dr, "my_highlight");

                        ((PresentationReconciler) reconciler).setRepairer(dr, "my_highlight");

                       

                        return reconciler;

}

 

 

In my tag scanner ‘getTagScanner()’ I have created my new Rule scanner

And added few  SingleLineRule for my IToken

 

Problem is that  now my CEditor’s syntax highlighting is working but it is not showing my keyword’s Highlighting.

 

What else do I need to add? Where am I going wrong?

 

 

Thanks in advance

 

 

 

 

Best Regards,

Harish Dewan

System Executive , Advanced Technology Solutions - Semiconductor Solutions Group | KPIT Cummins Infosystems Ltd. | +91 020 2538 2358 x 421 | harishd@xxxxxxxxxxxxxxx | www.kpitcummins.com

 


Back to the top