Reputation: 1427
I currently have en Eclipse plugin that provides a multi-page editor, one page for a visual editor and one page for a source editor, similar to other editors, i.e:
This is the important part of my code:
public class DockerfileEditor extends FormEditor implements IResourceChangeListener {
....
@Override
protected void addPages() {
try {
SourceEditor sourceEditor = new SourceEditor(); // Extends from EditorPart
addPage(new DesignForm(this, "Design")); //$NON-NLS-1$
addPage(sourceEditor, sourceEditor.getEditorInput());
} catch (PartInitException e) {
e.printStackTrace();
}
}
}
In the addPages()
method I'm adding my 2 pages, the first of them extends from FormPage
so setting the title is really easy, but the second page extends from EditorPart
(this will be my source editor), how can I set the title of this page?
Upvotes: 0
Views: 542
Reputation: 111142
addPage
returns you the index of the page that was added so you can use:
int pageIndex = addPage(sourceEditor, sourceEditor.getEditorInput());
setPageText(pageIndex, "Source");
Upvotes: 1