Menu

Change UI (cross post)

shaice
2007-08-30
2013-04-24
  • shaice

    shaice - 2007-08-30

    I dunno where to put this post so I put it everywhere..
    sorry

    s

    Hi all, I'm here again.
    Now I've finished to calculatethe metrics, and I want to add another column in the view to diplay directly the hints related to the over-maximum metrics. I'm workin' on:

    Metrics Table

    and

    Metrics Plugin

    but I cannot add a column to the metric view. I add:

    private TreeColumn hint;

    and 

    hint = new TreeColumn(this, SWT.LEFT);
    hint.setText("Hint");

    and
    String[] hints = plugin.getMetricDescriptions(); //HINT
    ...
    String[] cols = new String[] {descriptions[i],"","","","","","",hints[i]};

    so I jsut add a new column with the descriptions again.

    But no luck for me, it runs like no line of code was added.. :-(

    Please help me!!
    Thankyou in advance,

    s

     
    • shaice

      shaice - 2007-08-30

      Resolved. I didn't refresh the Metrics View.

      I've added this little code to add the hint:

          /**
           * return the correct Hint if the metric is our of range
           *
           * @author Francesco Agrusti
           */
          private String setHint(Metric metric, TreeItem row) {
              if (metric == null) {
                  return "";
              } else {
                  MetricDescriptor md = MetricsPlugin.getDefault().getMetricDescriptor(metric.getName());
                  if (md.isValueInRange(metric.doubleValue())){
                      return "";
                  } else {
                      return md.getHint();
                  }
                  }
          }

      see ya

       

Log in to post a comment.