Java源代码编辑器作为Eclipse视图 [英] Java source code editor as an Eclipse view

查看:111
本文介绍了Java源代码编辑器作为Eclipse视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义了一个EMF元模型,其中某些元素具有一个String字段,其中将包含一些Java代码。

I have defined an EMF metamodel in which some elements have a String field which will contain some Java code.

我试图创建/重用(Java)源代码编辑器作为选项卡式属性视图的一部分,从而能够使用某些类似IDE的功能来编辑该字段。让JDT编辑器在这里使用它会很棒,但是据我所读,这是不可行的。扩展org.eclipse.swt.widgets.Text以提供所有功能对于这个简单的项目来说似乎太过分了。

I am trying to create/reuse a (Java) source code editor as part of the tabbed properties view to be able to edit that field with some IDE-like functionality. It would be great to adapt the JDT editor to use it here, but for I have read, it is not feasible. Extending org.eclipse.swt.widgets.Text to provide all that functionality seems to be too much of an overkill for this simple project.

因此,问题是,您将推荐哪种方法作为实现此目标的最佳功能/工作量比率?,您现在是否可以在视图中/视图中重用任何源代码编辑器?

Therefore, the question would be, which approach would you recommend as the best functionality/effort ratio to achieve this?, do you now of any source code editor which may be reusable as/within a view?

推荐答案

好友...
这确实是一项艰巨的任务。
在SWT小部件/ ViewParts中重新使用EditorParts并不容易。我要做的唯一一件事就是重用设计为用作EditorPart的EPF RichText-Widget。

Buddy... This is really going to be a hard task. Re-Using EditorParts in SWT widgets/ViewParts is not easy. The only thing that I got to manage was to reuse the EPF RichText-Widget which was designed for use as an EditorPart.

在这种情况下,这很容易,因为它只需要一个IEditorSite作为构造函数参数。然后,我将其扩展并将IViewSite修改为IEditorSite。

In that case it was easy, because it only needed an IEditorSite as a constructor parameter. I then extended it and adapted the IViewSite to an IEditorSite.

但是关于JDT:有太多的功能与Eclipse的Base-Text-Editor功能直接相关。 IEditorParts ...我认为这是不值得的。

But concerning JDT: There is so much funcionality which is directly related to the Base-Text-Editor functionality from eclipses IEditorParts... I think it won't be worth the effort.

您是否找不到Java-IDE for Java-Code? Swing / AWT没有任何工作吗?
然后,您可以使用SWT_AWT-Brigde-Widget包含Source-Code-Editor-Swing-Frame。这样,我就成功地将Swing-PDF-Viewer集成到了Eclipse ViewPart中。

Could't you find a Java-IDE for Java-Code? Isn't there anything working with Swing/AWT? You could then possibly include a Source-Code-Editor-Swing-Frame using a SWT_AWT-Brigde-Widget. This way I successfully integrated an Swing-PDF-Viewer into an eclipse ViewPart.

看看 Eclipse API描述

作为Java IDE的第一个粗略尝试:
drJava

这篇关于Java源代码编辑器作为Eclipse视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆