简体   繁体   English

Eclipse 4 RCP应用程序创建C编辑器

[英]Eclipse 4 RCP application creating C editor

I'm creating a pure eclipse 4 RCP application. 我正在创建一个纯Eclipse 4 RCP应用程序。 My application has to provide C code editing functionality to user. 我的应用程序必须向用户提供C代码编辑功能。 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. 我已经在google中搜索了此内容,但我总是最终进入解释使用eclipse 3.x创建编辑器的网站。

The Eclipse C/C++ Development Tooling (CDT) provides a C / C++ editor. Eclipse C / C ++开发工具 (CDT)提供了一个C / C ++编辑器。 The editor probably depends on other plugins in the CDT so just using the editor may be tricky. 编辑器可能依赖CDT中的其他插件,因此仅使用编辑器可能会比较棘手。

A little late but perhaps for future views: 有点晚了,但也许对于将来的看法:

For basic editing features you can use the SourceViewer from the JFace library. 对于基本的编辑功能,可以使用JFace库中的SourceViewer。 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. 可以通过SourceViewerConfiguration和PresentationReconciler对关键字进行着色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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