コード例 #1
0
  /**
   * The <code>PropertySheet</code> implementation of this <code>IPartListener</code> method first
   * sees if the active part is an <code>IContributedContentsView</code> adapter and if so, asks it
   * for its contributing part.
   */
  public void partActivated(IWorkbenchPart part) {
    // Look for a declaratively-contributed adapter - including not yet loaded adapter factories.
    // See bug 86362 [PropertiesView] Can not access AdapterFactory, when plugin is not loaded.
    IContributedContentsView view =
        (IContributedContentsView)
            ViewsPlugin.getAdapter(part, IContributedContentsView.class, true);
    IWorkbenchPart source = null;
    if (view != null) {
      source = view.getContributingPart();
    }
    if (source != null) {
      super.partActivated(source);
    } else {
      super.partActivated(part);
    }

    if (isImportant(part)) {
      currentPart = part;
      // reset the selection (to allow selectionChanged() accept part change for empty selections)
      currentSelection = null;
    }

    // When the view is first opened, pass the selection to the page
    if (bootstrapSelection != null) {
      IPropertySheetPage page = (IPropertySheetPage) getCurrentPage();
      if (page != null) {
        page.selectionChanged(part, bootstrapSelection);
      }
      bootstrapSelection = null;
    }
  }
コード例 #2
0
 /* (non-Javadoc)
  * Method declared on PageBookView.
  * Returns the default property sheet page.
  */
 protected IPage createDefaultPage(PageBook book) {
   IPageBookViewPage page =
       (IPageBookViewPage) ViewsPlugin.getAdapter(this, IPropertySheetPage.class, false);
   if (page == null) {
     page = new PropertySheetPage();
   }
   initPage(page);
   page.createControl(book);
   return page;
 }
コード例 #3
0
  /* (non-Javadoc)
   * Method declared on PageBookView.
   */
  protected PageRec doCreatePage(IWorkbenchPart part) {
    // Get a custom property sheet page but not if the part is also a
    // PropertySheet. In this case the child property sheet would
    // accidentally reuse the parent's property sheet page.
    if (part instanceof PropertySheet) {
      return null;
    }
    IPropertySheetPage page =
        (IPropertySheetPage) ViewsPlugin.getAdapter(part, IPropertySheetPage.class, false);
    if (page != null) {
      if (page instanceof IPageBookViewPage) {
        initPage((IPageBookViewPage) page);
      }
      page.createControl(getPageBook());
      return new PageRec(part, page);
    }

    // Use the default page
    return null;
  }