// Check if we already created the control for selected
PageRecord record = pages.get(selected);
if( record == null ){
// record has not been created yet
IPageBookViewPage page = selected.createPage();
if( page == null ){
MessagePage messagePage = new MessagePage();
record = new PageRecord( this, messagePage);
messagePage.init( record.getSite() );
messagePage.createControl( pagebook );
messagePage.setMessage( selected.getName() );
}
else {
record = new PageRecord( this, page );
try {
page.init( record.getSite() );
} catch (PartInitException e) {
UiPlugin.log(getClass(), "initPage", e); //$NON-NLS-1$
}
page.createControl( pagebook );
}
pages.put(selected, record );
}
Control selectedControl = record.getControl();