Example #1
0
  /**
   * @param element
   * @param parent
   * @return true if we should exit (no more loadings) false if we should continue extensions scan.
   * @throws BuildException
   */
  private boolean loadTab(IConfigurationElement element, Composite parent) {
    //	MBSCustomPageData currentPageData;
    // Check whether it's our tab
    if (!this.getClass().getName().equals(element.getAttribute(PARENT_NAME))) return false;

    ICPropertyTab page = null;
    try {
      page = (ICPropertyTab) element.createExecutableExtension(CLASS_NAME);
    } catch (CoreException e) {
      System.out.println(Messages.AbstractPage_14 + e.getLocalizedMessage());
      return false;
    }
    if (page == null) return false;

    String helpId = element.getAttribute(HELPID_NAME);
    if (helpId != null
        && helpId.length() > 0
        // TODO: in next version: refer to ICPropertyTab instead of AbstractCPropertyTab
        && page instanceof AbstractCPropertyTab) {
      ((AbstractCPropertyTab) page).setHelpContextId(helpId);
    }

    Image _img = getIcon(element);
    if (_img != null) page.handleTabEvent(ICPropertyTab.SET_ICON, _img);

    if (isSingle()) {
      // note that name, image and tooltip
      // are ignored for single page.
      page.createControls(parent, this);
      InternalTab itab = new InternalTab(parent, EMPTY_STR, null, page, null);
      itabs.add(itab);
      currentTab = page;
      return true; // don't load other tabs
    }
    String _name = element.getAttribute(TEXT_NAME);
    String _tip = element.getAttribute(TIP_NAME);

    Composite _comp = new Composite(folder, SWT.NONE);
    page.createControls(_comp, this);
    InternalTab itab = new InternalTab(_comp, _name, _img, page, _tip);
    itab.createOn(folder);
    itabs.add(itab);
    return false;
  }