Ejemplo n.º 1
0
  private void setValues() {
    /*
     *  This method updates the context of the build property pages
     *   - Which configuration/resource configuration is selected
     *   - Which tool/option category is selected
     *
     *  It is called:
     *   - When a property page becomes visible
     *   - When the user changes the configuration selection
     *   - When the user changes the "exclude" setting for a resource
     */

    IConfiguration icfg = getCfg(icfgd.getConfiguration());
    if (icfg instanceof IMultiConfiguration) {
      fTree.setInput(null);
      fTree.getControl().setEnabled(false);
      currentSettingsPage.setVisible(false);
      return;
    }

    IAConfiguration currCfg = getAutotoolsCfg();

    //  Create the Tree Viewer content provider if first time
    if (listprovider == null) {
      listprovider = new ToolListContentProvider();
      fTree.setContentProvider(listprovider);
    }

    //  Update the selected configuration and the Tree Viewer
    ToolListElement[] newElements;

    fTree.setInput(currCfg);
    fTree.getControl().setEnabled(true);
    newElements = (ToolListElement[]) listprovider.getElements(currCfg);
    fTree.expandAll();

    selectedElement = newElements[0];
    fTree.setSelection(new StructuredSelection(selectedElement), true);
  }
  protected void setValues() {
    /*
     *  This method updates the context of the build property pages
     *   - Which configuration/resource configuration is selected
     *   - Which tool/option category is selected
     *
     *  It is called:
     *   - When a property page becomes visible
     *   - When the user changes the configuration selection
     *   - When the user changes the "exclude" setting for a resource
     */

    IConfiguration icfg = getCfg(icfgd.getConfiguration());
    if (icfg instanceof IMultiConfiguration) {
      fTree.setInput(null);
      fTree.getControl().setEnabled(false);
      currentSettingsPage.setVisible(false);
      return;
    }

    IAConfiguration currCfg = getAutotoolsCfg();

    //  Create the Tree Viewer content provider if first time
    if (listprovider == null) {
      listprovider = new ToolListContentProvider();
      fTree.setContentProvider(listprovider);
    }

    //  Update the selected configuration and the Tree Viewer
    ToolListElement[] newElements;

    fTree.setInput(currCfg);
    fTree.getControl().setEnabled(true);
    newElements = (ToolListElement[]) listprovider.getElements(currCfg);
    fTree.expandAll();

    selectedElement = newElements[0];
    fTree.setSelection(new StructuredSelection(selectedElement), true);

    //		//  Determine what the selection in the tree should be
    //		//  If the saved selection is not null, try to match the saved selection
    //		//  with an object in the new element list.
    //		//  Otherwise, select the first tool in the tree
    //		Object primaryObject = null;
    //		if (selectedElement != null) {
    //			selectedElement = matchSelectionElement(selectedElement, newElements);
    //		}
    //
    //		if (selectedElement == null) {
    //			selectedElement = (newElements != null && newElements.length > 0 ? newElements[0] : null);
    //		}
    //
    //		if (selectedElement != null) {
    //			primaryObject = selectedElement.getTool();
    //			if (primaryObject == null) {
    //				primaryObject = selectedElement.getOptionCategory();
    //			}
    //			if (primaryObject != null) {
    //				if (primaryObject instanceof IOptionCategory) {
    //					((ToolSettingsPrefStore)settingsStore).setSelection(getResDesc(), selectedElement,
    // (IOptionCategory)primaryObject);
    //				}
    //				optionList.setSelection(new StructuredSelection(selectedElement), true);
    //			}
    //		}
    //		specificResize();
  }