Package org.eclipse.test.internal.performance.results.model

Examples of org.eclipse.test.internal.performance.results.model.ScenarioResultsElement


* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
*/
public void selectionChanged(SelectionChangedEvent event) {
  ResultsElement selectedElement = (ResultsElement) ((TreeSelection) event.getSelection()).getFirstElement();
  ComponentResultsElement componentElement = null;
  ScenarioResultsElement scenarioResultsElement = null;
  ConfigResultsElement configResultsElement = null;
  BuildResultsElement buildResultsElement = null;
  if (selectedElement instanceof ComponentResultsElement) {
    componentElement = (ComponentResultsElement) selectedElement;
  } else if (selectedElement instanceof ScenarioResultsElement) {
    scenarioResultsElement = (ScenarioResultsElement) selectedElement;
    componentElement = (ComponentResultsElement) scenarioResultsElement.getParent(null);
  } else if (selectedElement instanceof ConfigResultsElement) {
    configResultsElement = (ConfigResultsElement) selectedElement;
    scenarioResultsElement = (ScenarioResultsElement) configResultsElement.getParent(null);
    componentElement = (ComponentResultsElement) scenarioResultsElement.getParent(null);
  } else if (selectedElement instanceof BuildResultsElement) {
    buildResultsElement = (BuildResultsElement) selectedElement;
    configResultsElement = (ConfigResultsElement) buildResultsElement.getParent(null);
    scenarioResultsElement = (ScenarioResultsElement) configResultsElement.getParent(null);
    componentElement = (ComponentResultsElement) scenarioResultsElement.getParent(null);
  } else if (selectedElement instanceof DimResultsElement) {
    buildResultsElement = (BuildResultsElement) selectedElement.getParent(null);
    configResultsElement = (ConfigResultsElement) buildResultsElement.getParent(null);
    scenarioResultsElement = (ScenarioResultsElement) configResultsElement.getParent(null);
    componentElement = (ComponentResultsElement) scenarioResultsElement.getParent(null);
  }
  if (componentElement != this.componentResultsElement) {
    this.componentResultsElement = componentElement;
    if (componentElement == null || this.componentResultsElement.getChildren(null).length > 0) {
      resetTabFolders(true);
View Full Code Here


      String toolTipMessage = null;
      int toolTipStyle = SWT.BALLOON;

      // Otherwise get values for a scenario
      Font italic2 = italic;
      ScenarioResultsElement scenarioResultsElement = (ScenarioResultsElement) scenarios[col-1];
      if (milestoneName != null || (!fingerprints && scenarioResultsElement.hasSummary())) {
        italic2 = this.boldItalicFont;
        item.setFont(col, this.boldFont);
      }
      // Otherwise get values for a scenario
      double[] values = (double[]) line.get(col);
      if (values == ComponentResults.NO_BUILD_RESULTS) {
        item.setText(col, "Missing");
        item.setForeground(col, GRAY);
        item.setFont(col, italic2);
      } else if (values == ComponentResults.INVALID_RESULTS) {
        item.setText(col, "Invalid");
        item.setForeground(col, RED);
        item.setFont(col, italic2);
      } else {
        // Get values array
        double buildValue = values[ComponentResults.BUILD_VALUE_INDEX];
        double baselineValue = values[ComponentResults.BASELINE_VALUE_INDEX];
        double delta = values[ComponentResults.DELTA_VALUE_INDEX];
        double error = values[ComponentResults.DELTA_ERROR_INDEX];

        // Set text with delta value
        item.setText(col, PERCENTAGE_FORMAT.format(delta));

        // Compute the tooltip to display on the cell
        if (error > 0.03) {
          // error is over the 3% threshold
          item.setImage(col, ResultsElement.WARN_IMAGE);
          item.setForeground(col, this.darkyellow);
          if (toolTipText == null) {
            toolTipText = "";
          } else {
            toolTipText += ", ";
          }
          toolTipText += "May be not reliable";
          if (toolTipMessage == null) {
            toolTipMessage = "";
          } else {
            toolTipMessage += ".\n";
          }
          toolTipMessage += "The error on this result is "+PERCENTAGE_FORMAT.format(error)+", hence it may be not reliable";
          toolTipStyle |= SWT.ICON_WARNING;
        }
        if (delta < -0.1) {
          // delta < -10%: failure shown by an red-cross icon + text in red
          item.setImage(col, ResultsElement.ERROR_IMAGE);
          item.setForeground(col, RED);
        } else if (delta < -0.05) {
          // negative delta over 5% shown in red
          item.setForeground(col, RED);
        } else if (delta < 0) {
          // negative delta shown in magenta
          item.setForeground(col, MAGENTA);
        } else if (delta > 0.2) {
          // positive delta over 20% shown in green
          item.setForeground(col, DARK_GREEN);
        } else if (delta > 0.1) {
          // positive delta between 10% and 20% shown in blue
          item.setForeground(col, BLUE);
        }

        // Moderate the status if the build value or the difference is small
        if (delta < 0) {
          double diff = Math.abs(baselineValue - buildValue);
          if (buildValue < 100 || diff < 100) {
            if (toolTipText == null) {
              toolTipText = "";
            } else {
              toolTipText += ", ";
            }
            toolTipText += "Small value";
            if (toolTipMessage == null) {
              toolTipMessage = "";
            } else {
              toolTipMessage += ".\n";
            }
            if (buildValue < 100) {
              toolTipMessage += "This test has a small value ("+buildValue+"ms)";
            } else {
              toolTipMessage += "This test variation has a small value ("+diff+"ms)";
            }
            toolTipMessage +=  ", hence it may not be necessary to spend time on fixing this possible regression";
            // set the text in italic
            item.setFont(col, italic2);
            toolTipStyle |= SWT.ICON_INFORMATION;
          }
        }

        // Add information in tooltip when history shows big variation
        if (deviations[col-1] < 0) {
          ConfigResultsElement configResultsElement = (ConfigResultsElement) scenarioResultsElement.getResultsElement(this.configName);
          double[] stats = configResultsElement.getStatistics();
          deviations[col-1] = stats[3];
        }
        if (deviations[col-1] > 20) {
          // deviation is over 20% over the entire history
          if (toolTipText == null) {
            toolTipText = "";
          } else {
            toolTipText += ", ";
          }
          toolTipText += "History shows erratic values";
          if (toolTipMessage == null) {
            toolTipMessage = "";
          } else {
            toolTipMessage += ".\n";
          }
          toolTipMessage += "The results history shows that the variation of its delta is over 20% ("+PERCENTAGE_FORMAT.format(deviations[col-1])+"), hence its result is surely not reliable";
          // set the text in italic
          item.setFont(col, italic2);
          toolTipStyle |= SWT.ICON_INFORMATION;
        } else if (deviations[col-1] > 10) { // moderate the status when the test
          // deviation is between 10% and 20% over the entire history
          if (toolTipText == null) {
            toolTipText = "";
          } else {
            toolTipText += ", ";
          }
          toolTipText += "History shows unstable values";
          if (toolTipMessage == null) {
            toolTipMessage = "";
          } else {
            toolTipMessage += ".\n";
          }
          toolTipMessage += "The results history shows that the variation of its delta is between 10% and 20% ("+PERCENTAGE_FORMAT.format(deviations[col-1])+"), hence its result may not be really reliable";
          // set the text in italic
          item.setFont(col, italic2);
          if (toolTipStyle == SWT.BALLOON && delta >= -0.1) {
            toolTipStyle |= SWT.ICON_INFORMATION;
          } else {
            // reduce icon severity from error to warning
            toolTipStyle |= SWT.ICON_WARNING;
          }
        }
      }

      // Set tooltip
      if (toolTipText != null) {
        createToolTip(toolTipText, toolTipMessage, toolTipStyle, new Point(col, row));
      }

      // Baseline name
      ConfigResultsElement configResultsElement = (ConfigResultsElement) scenarioResultsElement.getResultsElement(this.configName);
      if (configResultsElement != null) {
        String configBaselineName = configResultsElement.getBaselineBuildName(buildName);
        if (baselineName == null) {
          baselineName = configBaselineName;
        } else if (baselineName.indexOf(configBaselineName) < 0) {
View Full Code Here

      if (element instanceof ScenarioResultsElement) {
//        Action fingerprints = ComponentsView.this.filterNonFingerprints;
//        if (fingerprints != null && !fingerprints.isChecked()) {
        boolean fingerprints = ComponentsView.this.preferences.getBoolean(IPerformancesConstants.PRE_FILTER_ADVANCED_SCENARIOS, IPerformancesConstants.DEFAULT_FILTER_ADVANCED_SCENARIOS);
        if (!fingerprints) {
          ScenarioResultsElement scenarioElement = (ScenarioResultsElement) element;
          if (scenarioElement.hasSummary()) {
            return getBoldFont(font);
          }
        }
      }
      if (element instanceof BuildResultsElement) {
View Full Code Here

    this.viewer.collapseToLevel(iterator.next(), AbstractTreeViewer.ALL_LEVELS);
  }
  this.expandedComponents.clear();

  // Set the tree selection
  ScenarioResultsElement scenarioResultsElement = (ScenarioResultsElement) componentResults.getResultsElement(scenarioName);
  if (scenarioResultsElement != null) {
    ConfigResultsElement configResultsElement = (ConfigResultsElement) scenarioResultsElement.getResultsElement(configName);
    if (configResultsElement != null) {
      BuildResultsElement buildResultsElement = (BuildResultsElement) configResultsElement.getResultsElement(buildName);
      if (buildResultsElement != null) {
        this.viewer.setSelection(new StructuredSelection(buildResultsElement), true);
        this.setFocus();
View Full Code Here

TOP

Related Classes of org.eclipse.test.internal.performance.results.model.ScenarioResultsElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.