Mar 10
By default, the MultiPageEditorPage doesn’t allow to create closable editor pages. What is closable editor page? It means you can dynamically load and close editor pages, like what you have in EditorPlus, UltraEdit, and Notepad++.
To enable closable editor page, there are a few works to do:
1. Create your subclass of MultiPageEditorPart
2. Add your own addPage method. It will call the existing addPage(…) method, and get a pageIndex of newly added editor page:
-
-
//……
-
int pageIndex = addPage(editor, new MyEditorInput(stepInfo));
-
setPageText(pageIndex, stepInfo.getName());
-
setActivePage(pageIndex);
-
-
// start to set closable property
-
if(container instanceof CTabFolder){
-
CTabItem tabItem = ((CTabFolder)container).getItem(pageIndex);
-
tabItem.setShowClose(true);
-
}
-
// voila! done!
-