Eclipse plugin 具有动态添加选项卡功能的MultiTab编辑器
我正在开发一个EclipseRCP插件。现在我需要创建一个multitab编辑器,该编辑器能够在运行时动态添加选项卡,但我不知道如何做到这一点。有人知道我怎么做吗Eclipse plugin 具有动态添加选项卡功能的MultiTab编辑器,eclipse-plugin,eclipse-rcp,Eclipse Plugin,Eclipse Rcp,我正在开发一个EclipseRCP插件。现在我需要创建一个multitab编辑器,该编辑器能够在运行时动态添加选项卡,但我不知道如何做到这一点。有人知道我怎么做吗 谢谢您应该能够执行类似于多页面编辑器部分的操作-它有几个添加页面功能。可以按原样使用此编辑器,也可以从中获得灵感。为时已晚,但有些人可能会从这段代码中获益: /** The text editor used in the new page. */ private TextEditor editor; private StyledT
谢谢您应该能够执行类似于
多页面编辑器部分
的操作-它有几个添加页面
功能。可以按原样使用此编辑器,也可以从中获得灵感。为时已晚,但有些人可能会从这段代码中获益:
/** The text editor used in the new page. */
private TextEditor editor;
private StyledText text;
/**
* Creates a multi-page editor example.
*/
public MultiPageEditor() {
super();
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
}
void createDynamicPage() {
try {
editor = new TextEditor();
int index = addPage(editor, getEditorInput());
setPageText(index, "new page"+index);
} catch (PartInitException e) {
ErrorDialog.openError(
getSite().getShell(),
"Error creating nested editor",
null,
e.getStatus());
}
}
void createMainPage() {
Composite composite = new Composite(getContainer(), SWT.NONE);
GridLayout layout = new GridLayout();
composite.setLayout(layout);
layout.numColumns = 2;
Button clickButton = new Button(composite, SWT.NONE);
GridData gd = new GridData(GridData.BEGINNING);
gd.horizontalSpan = 2;
clickButton.setLayoutData(gd);
clickButton.setText("click");
clickButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
createDynamicPage();
}
});
int index = addPage(composite);
setPageText(index, "main page");
}
/**
* Creates the pages of the multi-page editor.
*/
protected void createPages() {
createMainPage();