Example usage for com.intellij.openapi.ui ComboBoxWithWidePopup ComboBoxWithWidePopup

List of usage examples for com.intellij.openapi.ui ComboBoxWithWidePopup ComboBoxWithWidePopup

Introduction

In this page you can find the example usage for com.intellij.openapi.ui ComboBoxWithWidePopup ComboBoxWithWidePopup.

Prototype

public ComboBoxWithWidePopup(E @NotNull [] items) 

Source Link

Usage

From source file:org.sonarlint.intellij.config.project.SonarLintProjectBindPanel.java

License:Open Source License

private void createBindPanel() {
    Border b = IdeBorderFactory.createTitledBorder("Project binding");

    bindPanel = new JPanel(new GridBagLayout());
    bindPanel.setBorder(b);/*from   w  w  w.  j  ava  2 s  .  c om*/

    JLabel projectListLabel = new JLabel("SonarQube project:");
    projectComboBox = new ComboBoxWithWidePopup(new DefaultComboBoxModel<RemoteModule>());
    projectComboBox.setRenderer(new ProjectComboBoxRenderer());
    projectComboBox.setEditable(false);
    projectComboBox.addItemListener(new ProjectItemListener());

    JPanel serverPanel = new JPanel(new GridLayoutManager(1, 3));
    configureServerButton = new JButton();
    serverComboBox = new ComboBox();
    JLabel serverListLabel = new JLabel("Bind to server:");

    serverComboBox.setRenderer(new ServerComboBoxRenderer());
    serverComboBox.addItemListener(new ServerItemListener());

    serverListLabel.setLabelFor(serverComboBox);

    serverPanel.add(serverComboBox,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    serverPanel.add(configureServerButton,
            new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));

    configureServerButton.setAction(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            actionConfigureServers();
        }
    });
    configureServerButton.setText("Configure servers...");

    bindPanel.add(serverListLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0));
    bindPanel.add(serverPanel, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL, new Insets(2, 3, 0, 0), 0, 0));
    bindPanel.add(projectListLabel, new GridBagConstraints(0, 1, 1, 1, 0, 1, GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0));
    bindPanel.add(projectComboBox, new GridBagConstraints(1, 1, 1, 1, 1, 1, GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL, new Insets(2, 3, 0, 0), 0, 0));

}