public void setMetricsResults(MetricDisplaySpecification displaySpecification, MetricsRun run) {
   final MetricCategory[] categories = MetricCategory.values();
   for (final MetricCategory category : categories) {
     final JTable table = tables.get(category);
     final String type = MetricsCategoryNameUtil.getShortNameForCategory(category);
     final MetricTableSpecification tableSpecification =
         displaySpecification.getSpecification(category);
     final MetricsResult results = run.getResultsForCategory(category);
     final MetricTableModel model = new MetricTableModel(results, type, tableSpecification);
     table.setModel(model);
     final Container tab = table.getParent().getParent();
     if (model.getRowCount() == 0) {
       tabbedPane.remove(tab);
       continue;
     }
     final String longName = MetricsCategoryNameUtil.getLongNameForCategory(category);
     tabbedPane.add(tab, longName);
     final MyColumnListener columnListener = new MyColumnListener(tableSpecification, table);
     final TableColumnModel columnModel = table.getColumnModel();
     columnModel.addColumnModelListener(columnListener);
     final int columnCount = columnModel.getColumnCount();
     for (int i = 0; i < columnCount; i++) {
       final TableColumn column = columnModel.getColumn(i);
       column.addPropertyChangeListener(columnListener);
     }
     setRenderers(table, type);
     setColumnWidths(table, tableSpecification);
   }
 }
 public MetricCategory getSelectedCategory() {
   final Component component = tabbedPane.getSelectedComponent();
   for (MetricCategory category : MetricCategory.values()) {
     final JTable table = tables.get(category);
     if (table.getParent().getParent().equals(component)) {
       return category;
     }
   }
   return null;
 }
 public void updateMetricsResults(
     MetricsRun run, MetricDisplaySpecification displaySpecification) {
   final MetricCategory[] categories = MetricCategory.values();
   for (final MetricCategory category : categories) {
     final JTable table = tables.get(category);
     final MetricTableModel model = (MetricTableModel) table.getModel();
     model.setResults(run.getResultsForCategory(category));
     final String shortName = MetricsCategoryNameUtil.getShortNameForCategory(category);
     setRenderers(table, shortName);
     final MetricTableSpecification specification =
         displaySpecification.getSpecification(category);
     setColumnWidths(table, specification);
   }
 }
 public MetricsDisplay(@NotNull Project project) {
   final JTable projectMetricsTable = new JBTable();
   tables.put(MetricCategory.Project, projectMetricsTable);
   final JTable fileTypeMetricsTable = new JBTable();
   tables.put(MetricCategory.FileType, fileTypeMetricsTable);
   final JTable moduleMetricsTable = new JBTable();
   tables.put(MetricCategory.Module, moduleMetricsTable);
   final JTable packageMetricsTable = new JBTable();
   tables.put(MetricCategory.Package, packageMetricsTable);
   final JTable classMetricsTable = new JBTable();
   tables.put(MetricCategory.Class, classMetricsTable);
   final JTable interfaceMetricsTable = new JBTable();
   tables.put(MetricCategory.Interface, interfaceMetricsTable);
   final JTable methodMetricsTable = new JBTable();
   tables.put(MetricCategory.Method, methodMetricsTable);
   setupTable(projectMetricsTable, project);
   setupTable(fileTypeMetricsTable, project);
   setupTable(moduleMetricsTable, project);
   setupTable(packageMetricsTable, project);
   setupTable(classMetricsTable, project);
   setupTable(interfaceMetricsTable, project);
   setupTable(methodMetricsTable, project);
   tabbedPane.add(
       MetricsReloadedBundle.message("project.metrics"),
       ScrollPaneFactory.createScrollPane(projectMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("file.type.metrics"),
       ScrollPaneFactory.createScrollPane(fileTypeMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("module.metrics"),
       ScrollPaneFactory.createScrollPane(moduleMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("package.metrics"),
       ScrollPaneFactory.createScrollPane(packageMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("class.metrics"),
       ScrollPaneFactory.createScrollPane(classMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("interface.metrics"),
       ScrollPaneFactory.createScrollPane(interfaceMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("method.metrics"),
       ScrollPaneFactory.createScrollPane(methodMetricsTable));
 }
 public void removeDiffOverlay(MetricDisplaySpecification displaySpecification) {
   final MetricCategory[] categories = MetricCategory.values();
   for (final MetricCategory category : categories) {
     final JTable table = tables.get(category);
     final MetricTableModel model = (MetricTableModel) table.getModel();
     model.setPrevResults(null);
     final Container tab = table.getParent().getParent();
     if (model.getRowCount() == 0) {
       tabbedPane.remove(tab);
       continue;
     }
     final String longName = MetricsCategoryNameUtil.getLongNameForCategory(category);
     tabbedPane.add(tab, longName);
     final String shortName = MetricsCategoryNameUtil.getShortNameForCategory(category);
     setRenderers(table, shortName);
     final MetricTableSpecification specification =
         displaySpecification.getSpecification(category);
     setColumnWidths(table, specification);
   }
   hasOverlay = false;
 }