Search in sources :

Example 1 with SkipSelfSearchComponent

use of com.intellij.application.options.SkipSelfSearchComponent in project intellij-community by JetBrains.

the class SearchUtil method processComponent.

private static void processComponent(JComponent component, Set<OptionDescription> configurableOptions, String path) {
    if (component instanceof SkipSelfSearchComponent)
        return;
    final Border border = component.getBorder();
    if (border instanceof TitledBorder) {
        final TitledBorder titledBorder = (TitledBorder) border;
        final String title = titledBorder.getTitle();
        if (title != null) {
            processUILabel(title, configurableOptions, path);
        }
    }
    if (component instanceof JLabel) {
        final String label = ((JLabel) component).getText();
        if (label != null) {
            processUILabel(label, configurableOptions, path);
        }
    } else if (component instanceof JCheckBox) {
        final String checkBoxTitle = ((JCheckBox) component).getText();
        if (checkBoxTitle != null) {
            processUILabel(checkBoxTitle, configurableOptions, path);
        }
    } else if (component instanceof JRadioButton) {
        final String radioButtonTitle = ((JRadioButton) component).getText();
        if (radioButtonTitle != null) {
            processUILabel(radioButtonTitle, configurableOptions, path);
        }
    } else if (component instanceof JButton) {
        final String buttonTitle = ((JButton) component).getText();
        if (buttonTitle != null) {
            processUILabel(buttonTitle, configurableOptions, path);
        }
    }
    if (component instanceof JTabbedPane) {
        final JTabbedPane tabbedPane = (JTabbedPane) component;
        final int tabCount = tabbedPane.getTabCount();
        for (int i = 0; i < tabCount; i++) {
            final String title = path != null ? path + '.' + tabbedPane.getTitleAt(i) : tabbedPane.getTitleAt(i);
            processUILabel(title, configurableOptions, title);
            final Component tabComponent = tabbedPane.getComponentAt(i);
            if (tabComponent instanceof JComponent) {
                processComponent((JComponent) tabComponent, configurableOptions, title);
            }
        }
    } else if (component instanceof TabbedPaneWrapper.TabbedPaneHolder) {
        final TabbedPaneWrapper tabbedPane = ((TabbedPaneWrapper.TabbedPaneHolder) component).getTabbedPaneWrapper();
        final int tabCount = tabbedPane.getTabCount();
        for (int i = 0; i < tabCount; i++) {
            String tabTitle = tabbedPane.getTitleAt(i);
            final String title = path != null ? path + '.' + tabTitle : tabTitle;
            processUILabel(title, configurableOptions, title);
            final JComponent tabComponent = tabbedPane.getComponentAt(i);
            if (tabComponent != null) {
                processComponent(tabComponent, configurableOptions, title);
            }
        }
    } else {
        final Component[] components = component.getComponents();
        if (components != null) {
            for (Component child : components) {
                if (child instanceof JComponent) {
                    processComponent((JComponent) child, configurableOptions, path);
                }
            }
        }
    }
}
Also used : TabbedPaneWrapper(com.intellij.ui.TabbedPaneWrapper) TitledBorder(javax.swing.border.TitledBorder) SkipSelfSearchComponent(com.intellij.application.options.SkipSelfSearchComponent) SimpleColoredComponent(com.intellij.ui.SimpleColoredComponent) SkipSelfSearchComponent(com.intellij.application.options.SkipSelfSearchComponent) Border(javax.swing.border.Border) TitledBorder(javax.swing.border.TitledBorder)

Aggregations

SkipSelfSearchComponent (com.intellij.application.options.SkipSelfSearchComponent)1 SimpleColoredComponent (com.intellij.ui.SimpleColoredComponent)1 TabbedPaneWrapper (com.intellij.ui.TabbedPaneWrapper)1 Border (javax.swing.border.Border)1 TitledBorder (javax.swing.border.TitledBorder)1