如何在Eclipse RCP应用程序的Composite中嵌入TextEditor

时间:2018-09-16 17:31:27

标签: java eclipse-plugin eclipse-rcp

我创建了一个包含两页的多页编辑器(MultiPageEditorPart):

  1. 文本编辑器,扩展了org.eclipse.ui.editors.text.TextEditor的类。
  2. 需要在其中显示拆分视图的页面,左侧是第1页的“文本编辑器”,右侧是源的可视表示。

问题是在第2页的拆分视图的左侧添加了文本编辑器,我试图将其添加到Composite中,如下所示:

Composite leftSide = new Composite(parent, SWT.NONE);
leftSide.setLayout(new FillLayout(SWT.HORIZONTAL));

MyTextEditor sourceView = new MyTextEditor (leftSide); // This class extends TextEditor

,然后将2页添加到多页编辑器中:

int index = addPage(sourceView); // This page contains only the Text Editor
setPageText(index, "Source View");

int index = addPage(splitView); // This page needs to contain the Text Editor and other composite
setPageText(index, "Split View");

第一页(源代码视图)可以很好地加载文本编辑器,语法高亮显示和所有其他功能都可以正常工作,但是拆分视图的左侧(应该加载相同的文本编辑器)看起来像空白,是否可以将文本编辑器嵌入到复合物中?还是有其他方法可以实现?

0 个答案:

没有答案