| How to add a page to existing multi-page editor at runtime [message #329242] | 
Tue, 17 June 2008 07:42  | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: adrian_.nerdshack.com 
 
Hi, 
 
I wanna add a page to an existing multi-page editor at runtime and only  
if event "xyz" occurs. 
 
I tried something like this: 
 
IEditorPart activePart = window.getActivePage().getActiveEditor(); 
		if (activePart instanceof MultiPageEditorPart) { 
			MultiPageEditorPart multiPageEditorPart = (MultiPageEditorPart)  
activePart; 
			try { 
				multiPageEditorPart.addPage(new EmptyEditorPart(), 
						new EmptyEditorInput()); 
			} catch (PartInitException e) { 
				e.printStackTrace(); 
			} 
		} 
 
That works so far. 
 
But how is it possible to "rename" the tab? 
Is it possible to do the same for existing non-multi-page editors? 
Is it possible to change the origin IEditorPart to an  
MultiPageEditorPart which includes the origin? 
Is there an extension point for doing this in an easy way? 
Or another approach? 
 
Some background: 
 
I only wanna have the new pages appended to the editor if the origin  
files are set to have the pages, independently of content or file  
extension. So some file with extension "ext" may have the extra pages  
and some not. 
 
Regards 
 
Adrian
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.02886 seconds