简体   繁体   English

Eclipse插件中的源代码编辑器

[英]Source Editor in Eclipse plug-in

I'm developing an Eclipse plug-in, mostly as a learning exercise, in which I have a wizard page. 我正在开发一个Eclipse插件,主要是作为学习练习,其中有一个向导页面。 In this wizard page I would like to have a small text area that behaves like a code editor with the appropriate content assist and information hovers etc, much like the breakpoint properties wizard has for adding conditions. 在此向导页面中,我希望有一个很小的文本区域,其行为类似于具有适当内容辅助和信息悬停等功能的代码编辑器,就像断点属性向导用于添加条件一样。

I'm new to plug-in development and I may not have quite picked up the vocabulary, so I'm not having much luck searching for examples. 我是插件开发的新手,我可能还不太熟悉词汇表,因此我在寻找示例方面没有太多运气。 Can someone please point me in the right direction? 有人可以指出正确的方向吗?

I assume that you are looking for an embeddable Java source editor - and with that you hit a difficult topic. 我假设您正在寻找可嵌入的Java源代码编辑器-并且遇到了一个困难的话题。

The source viewer mentioned by Chris Gerken is called JDISourceViewer . Chris Gerken提到的源代码查看器称为JDISourceViewer It is instantiated and configured in JavaBreakpointConditionEditor::createControl . 它在JavaBreakpointConditionEditor::createControl实例化和配置。

If you cannot find the mentioned classes, or if you want to experiment with them, then open the Plug-ins view, find the org.eclipse.jdt.debug.ui plug-in and select Import As > Source Project from the context menu. 如果找不到所提到的类,或者要尝试使用它们,请打开“ 插件”视图,找到org.eclipse.jdt.debug.ui插件,然后从上下文菜单中选择“ 导入为”>“源项目 ” 。

Unfortunately - in the beginning - the (Java) editors weren't designed to be embedded outside of the editor area and many editor participants (eg actions, formatter, etc) still expect an IEditorPart . 不幸的是-从一开始-(Java)编辑器并未设计为嵌入在编辑器区域之外,并且许多编辑器参与者(例如action,formatter等)仍然期望使用IEditorPart Hence it is a quirky and complicated endeavour to use an editor in a dialog or the like. 因此,在对话框等中使用编辑器是古怪而复杂的努力。

Moreover, the Java source editing infrastructure is not exposed as public API. 此外,Java源代码编辑基础结构未公开为公共API。 It isn't meant to be used by clients and can change at any time without prior notice. 它不是供客户使用的,可以随时更改,恕不另行通知。 You will see respective warnings in yoyur code. 您将在yoyur代码中看到相应的警告。 For a learning exercise, however, that shouldn't matter much. 但是,对于学习练习而言,这并不重要。

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

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