@Test public void selectingTreeNodeChangesDescriptionPanel() { JPanel toolPanel = toolWindow.getContent(); Component[] components = toolPanel.getComponents(); OnePixelSplitter splitter = (OnePixelSplitter) components[0]; JBScrollPane leftPane = (JBScrollPane) splitter.getFirstComponent(); JViewport leftView = leftPane.getViewport(); Tree suggestionTree = (Tree) leftView.getView(); JPanel rightPane = (JPanel) splitter.getSecondComponent(); assertThat(suggestionTree.getSelectionCount()).isEqualTo(0); for (Component component : rightPane.getComponents()) { if (component instanceof JButton || component instanceof JBLabel || component instanceof HyperlinkLabel) { assertThat(component.isVisible()).isFalse(); } } TreePath webPPath = getTreePathWithString(suggestionTree, webPSuggestionData.toString()); suggestionTree.addSelectionPath(webPPath); assertThat(suggestionTree.getSelectionCount()).isEqualTo(1); for (Component component : rightPane.getComponents()) { if (component instanceof JButton || component instanceof JBLabel || component instanceof HyperlinkLabel) { assertThat(component.isVisible()).isTrue(); } if (component instanceof JButton) { assertThat(((JButton) component).getText()).isEqualTo(webPSuggestionData.getAutoFixTitle()); } if (component instanceof JBLabel) { assertThat(((JBLabel) component).getText()) .containsMatch( "(" + webPSuggestionData.getTitle() + "|" + webPSuggestionData.getDesc() + ")"); } } }
public JPanel getContent() { window.validate(); return window; }
AnalyzeSizeToolWindow { public JPanel getContent() { window.validate(); return window; } }
AnalyzeSizeToolWindow { public JPanel getContent() { window.validate(); return window; } AnalyzeSizeToolWindow(
      ToolWindow toolWindow,
      Project project,
      ImmutableListMultimap<Category, Suggestion> categorizedSuggestions,
      ImmutableList<Category> categoryDisplayOrder); }
AnalyzeSizeToolWindow { public JPanel getContent() { window.validate(); return window; } AnalyzeSizeToolWindow(
      ToolWindow toolWindow,
      Project project,
      ImmutableListMultimap<Category, Suggestion> categorizedSuggestions,
      ImmutableList<Category> categoryDisplayOrder); JPanel getContent(); void setCategorizedSuggestions(
      ImmutableListMultimap<Category, Suggestion> categorizedSuggestions); void setCategoryDisplayOrder(ImmutableList<Category> categoryDisplayOrder); }
AnalyzeSizeToolWindow { public JPanel getContent() { window.validate(); return window; } AnalyzeSizeToolWindow(
      ToolWindow toolWindow,
      Project project,
      ImmutableListMultimap<Category, Suggestion> categorizedSuggestions,
      ImmutableList<Category> categoryDisplayOrder); JPanel getContent(); void setCategorizedSuggestions(
      ImmutableListMultimap<Category, Suggestion> categorizedSuggestions); void setCategoryDisplayOrder(ImmutableList<Category> categoryDisplayOrder);  }