Skip to main content

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

Hi Harish,
 
You need to define the color contant for keyword as
     public static final RGB KEYWORD = new RGB(144,4,86);
 
It gives the keyword as Bold with maroon color.
--
Thanks & Regards
Shiva Shankar.B
Phone : 09945133039

 
On 2/28/06, Harish Dewan <harishd@xxxxxxxxxxxxxxx> wrote:

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

 


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev





Back to the top