Java Code Examples for com.intellij.util.ui.UIUtil#findComponentsOfType()

The following examples show how to use com.intellij.util.ui.UIUtil#findComponentsOfType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SelectionAwareListCellRenderer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public Component getListCellRendererComponent(@Nonnull JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
  @SuppressWarnings({"unchecked"}) final JComponent comp = myFun.fun((T)value);
  comp.setOpaque(true);
  if (isSelected) {
    comp.setBackground(list.getSelectionBackground());
    comp.setForeground(list.getSelectionForeground());
  }
  else {
    comp.setBackground(list.getBackground());
    comp.setForeground(list.getForeground());
  }
  for (JLabel label : UIUtil.findComponentsOfType(comp, JLabel.class)) {
    label.setForeground(UIUtil.getListForeground(isSelected));
  }
  return comp;
}
 
Example 2
Source File: JBListTable.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void installPaddingAndBordersForEditors(JBTableRowEditor editor) {
  final List<EditorTextField> editors = UIUtil.findComponentsOfType(editor, EditorTextField.class);
  for (EditorTextField textField : editors) {
    textField.putClientProperty("JComboBox.isTableCellEditor", Boolean.FALSE);
    textField.putClientProperty("JBListTable.isTableCellEditor", Boolean.TRUE);
  }
}
 
Example 3
Source File: SearchTextArea.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void updateExtraActions() {
  for (ActionButton button : UIUtil.findComponentsOfType(myExtraActionsPanel, ActionButton.class)) {
    button.update();
  }
}
 
Example 4
Source File: ChangeSignatureDialogBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected JComponent createCenterPanel() {
  final JPanel panel = new JPanel(new BorderLayout());

  //Should be called from here to initialize fields !!!
  final JComponent optionsPanel = createOptionsPanel();

  final JPanel subPanel = new JPanel(new BorderLayout());
  final List<Pair<String, JPanel>> panels = createAdditionalPanels();
  if (myMethod.canChangeParameters()) {
    final JPanel parametersPanel = createParametersPanel(!panels.isEmpty());
    if (!panels.isEmpty()) {
      parametersPanel.setBorder(IdeBorderFactory.createEmptyBorder());
    }
    subPanel.add(parametersPanel, BorderLayout.CENTER);
  }

  if (myMethod.canChangeVisibility() && !(myVisibilityPanel instanceof ComboBoxVisibilityPanel)) {
    subPanel.add(myVisibilityPanel, myMethod.canChangeParameters() ? BorderLayout.EAST : BorderLayout.CENTER);
  }

  panel.add(subPanel, BorderLayout.CENTER);
  final JPanel main;
  if (panels.isEmpty()) {
    main = panel;
  }
  else {
    final TabbedPaneWrapper tabbedPane = new TabbedPaneWrapper(getDisposable());
    tabbedPane.addTab(RefactoringBundle.message("parameters.border.title"), panel);
    for (Pair<String, JPanel> extraPanel : panels) {
      tabbedPane.addTab(extraPanel.first, extraPanel.second);
    }
    main = new JPanel(new BorderLayout());
    final JComponent tabs = tabbedPane.getComponent();
    main.add(tabs, BorderLayout.CENTER);
    //remove traversal policies
    for (JComponent c : UIUtil.findComponentsOfType(tabs, JComponent.class)) {
      c.setFocusCycleRoot(false);
      c.setFocusTraversalPolicy(null);
    }
  }
  final JPanel bottom = new JPanel(new BorderLayout());
  bottom.add(optionsPanel, BorderLayout.NORTH);
  bottom.add(createSignaturePanel(), BorderLayout.SOUTH);
  main.add(bottom, BorderLayout.SOUTH);
  main.setBorder(IdeBorderFactory.createEmptyBorder(5, 0, 0, 0));
  return main;
}