简体   繁体   中英

Eclipse 4 RCP application creating C editor

I'm creating a pure eclipse 4 RCP application. My application has to provide C code editing functionality to user. Features like

  1. Coloring of keywords, identifier, comments...
  2. Line numbering

I'm not interested in providing features like content assist or auto parse and show error...

Is there any plugins that is already available that will help me to attain this ?

If I have to create my own editor is there any good tutorial that explains how I should go about it ?

I have already searched in google for this but I always end up in sites that explains about creating editors using eclipse 3.x.

The Eclipse C/C++ Development Tooling (CDT) provides a C / C++ editor. The editor probably depends on other plugins in the CDT so just using the editor may be tricky.

A little late but perhaps for future views:

For basic editing features you can use the SourceViewer from the JFace library. You can simple enable the showing of line numbers by adding a ruler to the composite ruler of the viewer.

lineNumberRuler = new LineNumberRulerColumn();

compositeRuler = new CompositeRuler();
compositeRuler.addDecorator(0, lineNumberRuler);

int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
viewer = new SourceViewer(defaultComposite, compositeRuler, styles);

Coloring of keywords can be done via SourceViewerConfiguration and PresentationReconciler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM