@Override
 public void dispose() {
   if (page != null) {
     aboutToBeHidden();
     page.dispose();
     page = null;
   }
   super.dispose();
 }
  @Override
  public void setInput(IWorkbenchPart part, ISelection selection) {
    if (part == getPart() && selection == getSelection()) {
      return;
    }
    super.setInput(part, selection);
    if (page != null) {
      page.getControl().removeControlListener(controlListener);
      aboutToBeHidden();
      page.dispose();
      page.getControl().dispose();
      page = null;
    }
    Object first = Selections.getFirstSelection(selection);
    if (first == null) {
      return;
    }
    page = createPage(first);
    if (page != null) {
      if (page instanceof IPageBookViewPage) {
        try {
          ((IPageBookViewPage) page).init(parentPage.getSite());
        } catch (PartInitException e) {
          Activator.getDefault().getLog().log(e.getStatus());
        }
      }
      page.createControl(container);
      FormData data = new FormData();
      data.left = new FormAttachment(0, 0);
      data.right = new FormAttachment(100, 0);
      data.top = new FormAttachment(0, 0);
      data.bottom = new FormAttachment(100, 0);
      page.getControl().setLayoutData(data);

      page.getControl().addControlListener(controlListener);
    }

    container.layout(true, true);
    parentPage.resizeScrolledComposite();
  }