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

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

Introduction

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

Prototype

public TextFieldWithBrowseButton() 

Source Link

Usage

From source file:com.intellij.refactoring.lang.ExtractIncludeDialog.java

License:Apache License

@Override
protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new VerticalFlowLayout());

    JLabel nameLabel = new JLabel();
    panel.add(nameLabel);/*w w w  .j av  a 2  s  .c  om*/

    myNameField = new JTextField();
    nameLabel.setLabelFor(myNameField);
    myNameField.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            validateOKButton();
        }
    });
    panel.add(myNameField);
    nameLabel.setText(getNameLabel());

    myTargetDirLabel = new JLabel();
    panel.add(myTargetDirLabel);

    myTargetDirectoryField = new TextFieldWithBrowseButton();
    myTargetDirectoryField.setText(myCurrentDirectory.getVirtualFile().getPresentableUrl());
    myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"),
            RefactoringBundle.message("select.target.directory.description"), null,
            FileChooserDescriptorFactory.createSingleFolderDescriptor());

    myTargetDirLabel.setText(RefactoringBundle.message("extract.to.directory"));
    panel.add(myTargetDirectoryField);

    myTargetDirectoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        public void textChanged(DocumentEvent event) {
            validateOKButton();
        }
    });

    validateOKButton();

    return panel;
}

From source file:com.microsoft.alm.plugin.idea.common.ui.checkout.CheckoutForm.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/*from w w  w  .ja  v a2  s  .c o m*/
 */
private void $$$setupUI$$$() {
    createUIComponents();
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(10, 3, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.setName("");
    final JLabel label1 = new JLabel();
    this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoCheckoutForm.SelectRepository"));
    contentPanel.add(label1,
            new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    repositoryFilter = new JTextField();
    repositoryFilter.setName("");
    contentPanel.add(repositoryFilter,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoCheckoutForm.ParentDirectory"));
    contentPanel.add(label2,
            new GridConstraints(5, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label3 = new JLabel();
    this.$$$loadLabelText$$$(label3, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoCheckoutForm.DirectoryName"));
    contentPanel.add(label3,
            new GridConstraints(7, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    directoryName = new JTextField();
    directoryName.setName("");
    contentPanel.add(directoryName,
            new GridConstraints(8, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    contentPanel.add(userAccountPanel,
            new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    repositoryTableScrollPane = new JScrollPane();
    contentPanel.add(repositoryTableScrollPane,
            new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    repositoryTable = new JTable();
    repositoryTable.setFillsViewportHeight(true);
    repositoryTable.setName("");
    repositoryTable.setShowHorizontalLines(false);
    repositoryTable.setShowVerticalLines(false);
    repositoryTableScrollPane.setViewportView(repositoryTable);
    parentDirectory = new TextFieldWithBrowseButton();
    contentPanel.add(parentDirectory,
            new GridConstraints(6, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    refreshButton = new JButton();
    refreshButton.setIcon(new ImageIcon(getClass().getResource("/actions/refresh.png")));
    refreshButton.setText("");
    refreshButton.setToolTipText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("CheckoutDialog.RefreshButton.ToolTip"));
    contentPanel.add(refreshButton,
            new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    busySpinner = new BusySpinnerPanel();
    contentPanel.add(busySpinner,
            new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    helpPanel = new HelpPanel();
    helpPanel.setHelpText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoLookupHelp.helpText"));
    helpPanel.setPopupText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoLookupHelp.Instructions"));
    contentPanel.add(helpPanel,
            new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    advancedCheckBox = new JCheckBox();
    advancedCheckBox.setText("example text");
    contentPanel.add(advancedCheckBox,
            new GridConstraints(9, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}

From source file:com.microsoft.alm.plugin.idea.git.ui.simplecheckout.SimpleCheckoutForm.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/*w w w .  jav a 2s .  c o m*/
 */
private void $$$setupUI$$$() {
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(6, 1, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.setMinimumSize(new Dimension(500, 180));
    final JLabel label1 = new JLabel();
    label1.setText("Directory Name:");
    contentPanel.add(label1,
            new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    directoryName = new JTextField();
    contentPanel.add(directoryName,
            new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    label2.setText("Repository Url:");
    contentPanel.add(label2,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    repoUrl = new JTextField();
    repoUrl.setEditable(false);
    contentPanel.add(repoUrl,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    parentDirectory = new TextFieldWithBrowseButton();
    contentPanel.add(parentDirectory,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null,
                    new Dimension(150, -1), null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setText("Parent Directory:");
    contentPanel.add(label3,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
}

From source file:com.microsoft.alm.plugin.idea.tfvc.ui.settings.ProjectConfigurableForm.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL//from   w  w w.j  a v a2 s  .  co m
 */
private void $$$setupUI$$$() {
    myContentPane = new JPanel();
    myContentPane.setLayout(new GridLayoutManager(5, 3, new Insets(0, 0, 0, 0), -1, -1));
    serverLabel = new JPanel();
    serverLabel.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1));
    myContentPane.add(serverLabel,
            new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    serverLabel.setBorder(BorderFactory.createTitledBorder("Servers and workspaces"));
    myManageButton = new JButton();
    myManageButton.setText("Manage...");
    myManageButton.setMnemonic('M');
    myManageButton.setDisplayedMnemonicIndex(0);
    serverLabel.add(myManageButton,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer1 = new Spacer();
    serverLabel.add(spacer1,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    myUseIdeaHttpProxyCheckBox = new JCheckBox();
    myUseIdeaHttpProxyCheckBox.setEnabled(true);
    myUseIdeaHttpProxyCheckBox.setSelected(false);
    myUseIdeaHttpProxyCheckBox.setText("Use HTTP Proxy settings");
    myUseIdeaHttpProxyCheckBox.setMnemonic('U');
    myUseIdeaHttpProxyCheckBox.setDisplayedMnemonicIndex(0);
    serverLabel.add(myUseIdeaHttpProxyCheckBox,
            new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    passwordLabel = new JPanel();
    passwordLabel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    myContentPane.add(passwordLabel,
            new GridConstraints(2, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    passwordLabel.setBorder(BorderFactory.createTitledBorder("Passwords"));
    final Spacer spacer2 = new Spacer();
    passwordLabel.add(spacer2,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    myResetPasswordsButton = new JButton();
    myResetPasswordsButton.setText("Reset Saved Passwords");
    myResetPasswordsButton.setMnemonic('R');
    myResetPasswordsButton.setDisplayedMnemonicIndex(0);
    passwordLabel.add(myResetPasswordsButton,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    checkinPolicyLabel = new JPanel();
    checkinPolicyLabel.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
    myContentPane.add(checkinPolicyLabel,
            new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    checkinPolicyLabel.setBorder(BorderFactory.createTitledBorder("Checkin policies compatibility"));
    myReportNotInstalledPoliciesCheckBox = new JCheckBox();
    myReportNotInstalledPoliciesCheckBox.setText("Warn about not installed policies");
    myReportNotInstalledPoliciesCheckBox.setMnemonic('W');
    myReportNotInstalledPoliciesCheckBox.setDisplayedMnemonicIndex(0);
    checkinPolicyLabel.add(myReportNotInstalledPoliciesCheckBox,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    noteLabel = new JLabel();
    noteLabel.setText("(Note: these settings may be overridden for individual team project)");
    checkinPolicyLabel.add(noteLabel,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    myTFSCheckBox = new JCheckBox();
    myTFSCheckBox.setText("Evaluate Team Explorer policies");
    myTFSCheckBox.setMnemonic('T');
    myTFSCheckBox.setDisplayedMnemonicIndex(9);
    checkinPolicyLabel.add(myTFSCheckBox,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    myStatefulCheckBox = new JCheckBox();
    myStatefulCheckBox.setText("Evaluate Teamprise policies");
    myStatefulCheckBox.setMnemonic('E');
    myStatefulCheckBox.setDisplayedMnemonicIndex(10);
    checkinPolicyLabel.add(myStatefulCheckBox,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    pathLabel = new JLabel();
    pathLabel.setText("Path to tf executable:");
    myContentPane.add(pathLabel,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    tfExeField = new TextFieldWithBrowseButton();
    myContentPane.add(tfExeField,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    testExeButton = new JButton();
    testExeButton.setText("Test");
    myContentPane.add(testExeButton,
            new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0,
                    false));
    final Spacer spacer3 = new Spacer();
    myContentPane.add(spacer3,
            new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
                    GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
}

From source file:com.microsoft.alm.plugin.idea.ui.checkout.CheckoutForm.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL//from  w  w w .  jav  a  2s  .c o  m
 */
private void $$$setupUI$$$() {
    createUIComponents();
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(9, 3, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.setName("");
    final JLabel label1 = new JLabel();
    this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoCheckoutForm.SelectRepository"));
    contentPanel.add(label1,
            new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    repositoryFilter = new JTextField();
    repositoryFilter.setName("");
    contentPanel.add(repositoryFilter,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoCheckoutForm.ParentDirectory"));
    contentPanel.add(label2,
            new GridConstraints(5, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label3 = new JLabel();
    this.$$$loadLabelText$$$(label3, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoCheckoutForm.DirectoryName"));
    contentPanel.add(label3,
            new GridConstraints(7, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    directoryName = new JTextField();
    directoryName.setName("");
    contentPanel.add(directoryName,
            new GridConstraints(8, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    contentPanel.add(userAccountPanel,
            new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    repositoryTableScrollPane = new JScrollPane();
    contentPanel.add(repositoryTableScrollPane,
            new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    repositoryTable = new JTable();
    repositoryTable.setFillsViewportHeight(true);
    repositoryTable.setName("");
    repositoryTable.setShowHorizontalLines(false);
    repositoryTable.setShowVerticalLines(false);
    repositoryTableScrollPane.setViewportView(repositoryTable);
    parentDirectory = new TextFieldWithBrowseButton();
    contentPanel.add(parentDirectory,
            new GridConstraints(6, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    refreshButton = new JButton();
    refreshButton.setIcon(new ImageIcon(getClass().getResource("/actions/refresh.png")));
    refreshButton.setText("");
    refreshButton.setToolTipText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("CheckoutDialog.RefreshButton.ToolTip"));
    contentPanel.add(refreshButton,
            new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    busySpinner = new BusySpinnerPanel();
    contentPanel.add(busySpinner,
            new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    helpPanel = new HelpPanel();
    helpPanel.setHelpText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoLookupHelp.helpText"));
    helpPanel.setPopupText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin")
            .getString("VsoLookupHelp.Instructions"));
    contentPanel.add(helpPanel,
            new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionAdvancedConfigDialog.java

License:Open Source License

private void addRemoteDebugLineItem() {
    enableRemoteDebugCheckBox = new JCheckBox("Enable Spark remote debug", true);
    enableRemoteDebugCheckBox.setToolTipText(
            "Enable Spark remote debug, use with caution since this might override data previously generated");
    add(enableRemoteDebugCheckBox, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin / 6, 0, 0, 0), 0, 0));

    String sshUserNameToolTipText = "Secure shell (SSH) user name used in Spark remote debugging, by default using sshuser";
    JLabel sshUserNameLabel = new JLabel("Secure Shell (SSH) User Name:");
    sshUserNameLabel.setToolTipText(sshUserNameToolTipText);
    add(sshUserNameLabel, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 0, 0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    sshUserNameTextField = new JTextField("sshuser");
    sshUserNameTextField.setToolTipText(sshUserNameToolTipText);
    add(sshUserNameTextField,/*  w w  w. jav a 2 s.com*/
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));

    JLabel sshAuthTypeLabel = new JLabel("Secure Shell (SSH) Auth Type");
    sshAuthTypeLabel.setToolTipText(
            "Secure shell (SSH) authentication type used in Spark remote debugging, by default using the password");

    sshPasswordUsePasswordRadioButton = new JRadioButton("Use secure shell (SSH) password:", false);
    String sshPasswordUsePasswordToolTip = "For secure shell (SSH) password, use the password specified here";
    sshPasswordUsePasswordRadioButton.setToolTipText(sshPasswordUsePasswordToolTip);
    sshPasswordUsePasswordField = new JPasswordField();
    sshPasswordUsePasswordField.setToolTipText(sshPasswordUsePasswordToolTip);

    sshPasswordUseKeyFileRadioButton = new JRadioButton("Use private key file:", false);
    String sshPasswordUseKeyFileToolTip = "For secure shell (SSH) password, use the key file specified here";
    sshPasswordUseKeyFileRadioButton.setToolTipText(sshPasswordUseKeyFileToolTip);
    sshPasswordUseKeyFileTextField = new TextFieldWithBrowseButton();
    sshPasswordUseKeyFileTextField.setToolTipText(sshPasswordUseKeyFileToolTip);
    sshPasswordUseKeyFileTextField.getButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false,
                    false, false);

            fileChooserDescriptor.setTitle("Select SSH key file");
            VirtualFile chooseFile = FileChooser.chooseFile(fileChooserDescriptor, null, null);
            if (chooseFile != null) {
                String path = chooseFile.getPath();
                sshPasswordUseKeyFileTextField.setText(path);
            }
        }
    });

    sshPasswordButtonGroup = new ButtonGroup();
    sshPasswordButtonGroup.add(sshPasswordUsePasswordRadioButton);
    sshPasswordButtonGroup.add(sshPasswordUseKeyFileRadioButton);

    sshPasswordUsePasswordRadioButton.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                sshPasswordUsePasswordField.setEnabled(true);
                sshPasswordUseKeyFileTextField.setEnabled(false);
            }
        }
    });

    sshPasswordUseKeyFileRadioButton.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                sshPasswordUsePasswordField.setEnabled(false);
                sshPasswordUseKeyFileTextField.setEnabled(true);
            }
        }
    });

    enableRemoteDebugCheckBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (enableRemoteDebugCheckBox.isSelected()) {
                sshUserNameTextField.setEnabled(true);
                sshUserNameLabel.setEnabled(true);
                sshAuthTypeLabel.setEnabled(true);

                sshPasswordUsePasswordRadioButton.setEnabled(true);
                sshPasswordUseKeyFileRadioButton.setEnabled(true);

                sshPasswordUsePasswordField.setEnabled(true);
                sshPasswordUseKeyFileTextField.setEnabled(true);

                ButtonModel currentSelection = sshPasswordButtonGroup.getSelection();
                sshPasswordUsePasswordRadioButton.setSelected(true);
                sshPasswordUseKeyFileRadioButton.setSelected(true);
                currentSelection.setSelected(true);
            } else {
                sshUserNameTextField.setEnabled(false);
                sshUserNameLabel.setEnabled(false);
                sshAuthTypeLabel.setEnabled(false);

                sshPasswordUsePasswordRadioButton.setEnabled(false);
                sshPasswordUseKeyFileRadioButton.setEnabled(false);

                sshPasswordUsePasswordField.setEnabled(false);
                sshPasswordUseKeyFileTextField.setEnabled(false);
            }
        }
    });

    add(sshAuthTypeLabel, new GridBagConstraints(0, ++displayLayoutCurrentRow, 0, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, margin), 0, 0));

    add(sshPasswordUsePasswordRadioButton,
            new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 0, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(margin / 3, margin * 3, 0, margin), 0, 0));

    add(sshPasswordUsePasswordField,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin / 3, margin, 0, margin), 0, 0));

    add(sshPasswordUseKeyFileRadioButton,
            new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 0, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(margin / 3, margin * 3, 0, margin), 0, 0));

    add(sshPasswordUseKeyFileTextField,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin / 3, margin, 0, margin), 0, 0));

    sshPasswordUsePasswordRadioButton.setSelected(true);
    enableRemoteDebugCheckBox.setSelected(false);
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

License:Open Source License

private void addSelectedArtifactLineItem() {
    final String tipInfo = "The Artifact you want to use.";
    JLabel artifactSelectLabel = new JLabel("Select an Artifact to submit");
    artifactSelectLabel.setToolTipText(tipInfo);

    selectedArtifactComboBox = new ComboBox();
    selectedArtifactComboBox.setToolTipText(tipInfo);

    errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()] = new JLabel(
            "Artifact should not be null!");
    errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()].setVisible(false);

    errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()] = new JLabel(
            "Could not find the local jar package for Artifact");
    errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()].setVisible(false);

    selectedArtifactTextField = new TextFieldWithBrowseButton();
    selectedArtifactTextField.setToolTipText("Artifact from local jar package.");
    selectedArtifactTextField.setEditable(true);
    selectedArtifactTextField.setEnabled(false);
    selectedArtifactTextField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        @Override/*from   w  w  w  .j a  v a  2s. co  m*/
        public void insertUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(2,
                    !SparkSubmitHelper.isLocalArtifactPath(selectedArtifactTextField.getText()));
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(2,
                    !SparkSubmitHelper.isLocalArtifactPath(selectedArtifactTextField.getText()));
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(2,
                    !SparkSubmitHelper.isLocalArtifactPath(selectedArtifactTextField.getText()));
        }
    });

    selectedArtifactTextField.getButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FileChooserDescriptor chooserDescriptor = new FileChooserDescriptor(false, false, true, false, true,
                    false);
            chooserDescriptor.setTitle("Select Local Artifact File");
            VirtualFile chooseFile = FileChooser.chooseFile(chooserDescriptor, null, null);
            if (chooseFile != null) {
                String path = chooseFile.getPath();
                if (path.endsWith("!/")) {
                    path = path.substring(0, path.length() - 2);
                }
                selectedArtifactTextField.setText(path);
            }
        }
    });

    intelliJArtifactRadioButton = new JRadioButton("Artifact from IntelliJ project:", true);
    localArtifactRadioButton = new JRadioButton("Artifact from local disk:", false);

    intelliJArtifactRadioButton.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectedArtifactComboBox.setEnabled(true);
                selectedArtifactTextField.setEnabled(false);
                mainClassTextField.setButtonEnabled(true);

                setVisibleForFixedErrorMessageLabel(2, false);

                if (selectedArtifactComboBox.getItemCount() == 0) {
                    setVisibleForFixedErrorMessageLabel(2, true);
                }
            }
        }
    });

    localArtifactRadioButton.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectedArtifactComboBox.setEnabled(false);
                selectedArtifactTextField.setEnabled(true);
                mainClassTextField.setButtonEnabled(false);

                setVisibleForFixedErrorMessageLabel(1, false);

                if (StringHelper.isNullOrWhiteSpace(selectedArtifactTextField.getText())) {
                    setVisibleForFixedErrorMessageLabel(2, true);
                }
            }
        }
    });

    ButtonGroup group = new ButtonGroup();
    group.add(intelliJArtifactRadioButton);
    group.add(localArtifactRadioButton);

    intelliJArtifactRadioButton.setSelected(true);

    add(artifactSelectLabel, new GridBagConstraints(0, ++displayLayoutCurrentRow, 0, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, margin), 0, 0));

    add(intelliJArtifactRadioButton,
            new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 0, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(margin / 3, margin * 3, 0, margin), 0, 0));

    add(selectedArtifactComboBox,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin / 3, margin, 0, margin), 0, 0));

    add(errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()],
            new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(0, margin, 0, 0), 0, 0));

    add(localArtifactRadioButton,
            new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 0, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(margin / 3, margin * 3, 0, margin), 0, 0));

    add(selectedArtifactTextField,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 0, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin / 3, margin, 0, margin), 0, 0));
    add(errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()],
            new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(0, margin, 0, 0), 0, 0));
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

License:Open Source License

private void addMainClassNameLineItem() {
    JLabel sparkMainClassLabel = new JLabel("Main class name");
    sparkMainClassLabel.setToolTipText("Application's java/spark main class");
    GridBagConstraints c31 = new GridBagConstraints();
    c31.gridx = 0;//  ww  w .j  a va  2 s  .c  om
    c31.gridy = 2;
    c31.insets = new Insets(margin, margin, margin, margin);
    add(sparkMainClassLabel, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    mainClassTextField = new TextFieldWithBrowseButton();
    mainClassTextField.setToolTipText("Application's java/spark main class");
    ManifestFileUtil.setupMainClassField(submitModel.getProject(), mainClassTextField);

    add(mainClassTextField,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));

    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()] = new JLabel(
            "Main Class Name should not be null");
    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()].setVisible(true);

    mainClassTextField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(3, e.getDocument().getLength() == 0);
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(3, e.getDocument().getLength() == 0);
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
        }
    });

    add(errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()],
            new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(0, margin, 0, margin), 0, 0));
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionExDialog.java

License:Open Source License

private void addSelectedArtifactLineItem() {
    final String tipInfo = "The Artifact you want to use.";
    JLabel artifactSelectLabel = new JLabel("Select an Artifact to submit");
    artifactSelectLabel.setToolTipText(tipInfo);

    selectedArtifactComboBox = new ComboBox();
    selectedArtifactComboBox.setToolTipText(tipInfo);

    errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()] = new JLabel(
            "Artifact should not be null!");
    errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()].setVisible(false);

    errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()] = new JLabel(
            "Could not find the local jar package for Artifact");
    errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()].setVisible(false);

    selectedArtifactTextField = new TextFieldWithBrowseButton();
    selectedArtifactTextField.setToolTipText("Artifact from local jar package.");
    selectedArtifactTextField.setEditable(true);
    selectedArtifactTextField.setEnabled(false);
    selectedArtifactTextField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        @Override//from  ww  w.j a v a2 s.  c om
        public void insertUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(2,
                    !SparkSubmitHelper.isLocalArtifactPath(selectedArtifactTextField.getText()));
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(2,
                    !SparkSubmitHelper.isLocalArtifactPath(selectedArtifactTextField.getText()));
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(2,
                    !SparkSubmitHelper.isLocalArtifactPath(selectedArtifactTextField.getText()));
        }
    });

    selectedArtifactTextField.getButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FileChooserDescriptor chooserDescriptor = new FileChooserDescriptor(false, false, true, false, true,
                    false);
            chooserDescriptor.setTitle("Select Local Artifact File");
            VirtualFile chooseFile = FileChooser.chooseFile(chooserDescriptor, null, null);
            if (chooseFile != null) {
                String path = chooseFile.getPath();
                if (path.endsWith("!/")) {
                    path = path.substring(0, path.length() - 2);
                }
                selectedArtifactTextField.setText(path);
            }
        }
    });

    intelliJArtifactRadioButton = new JRadioButton("Artifact from IntelliJ project:", true);
    localArtifactRadioButton = new JRadioButton("Artifact from hard disk:", false);

    intelliJArtifactRadioButton.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectedArtifactComboBox.setEnabled(true);
                selectedArtifactTextField.setEnabled(false);
                mainClassTextField.setButtonEnabled(true);

                setVisibleForFixedErrorMessageLabel(2, false);

                if (selectedArtifactComboBox.getItemCount() == 0) {
                    setVisibleForFixedErrorMessageLabel(2, true);
                }
            }
        }
    });

    localArtifactRadioButton.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectedArtifactComboBox.setEnabled(false);
                selectedArtifactTextField.setEnabled(true);
                mainClassTextField.setButtonEnabled(false);

                setVisibleForFixedErrorMessageLabel(1, false);

                if (StringHelper.isNullOrWhiteSpace(selectedArtifactTextField.getText())) {
                    setVisibleForFixedErrorMessageLabel(2, true);
                }
            }
        }
    });

    ButtonGroup group = new ButtonGroup();
    group.add(intelliJArtifactRadioButton);
    group.add(localArtifactRadioButton);

    intelliJArtifactRadioButton.setSelected(true);

    contentPane.add(artifactSelectLabel, new GridBagConstraints(0, ++row, 0, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(margin, margin, 0, margin), 0, 0));

    contentPane.add(intelliJArtifactRadioButton,
            new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                    new Insets(margin / 3, margin * 3, 0, margin), 0, 0));

    contentPane.add(selectedArtifactComboBox,
            new GridBagConstraints(1, row, 0, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                    new Insets(margin / 3, margin, 0, margin), 0, 0));

    contentPane.add(errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()],
            new GridBagConstraints(1, ++row, 0, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                    new Insets(0, margin, 0, 0), 0, 0));

    contentPane.add(localArtifactRadioButton,
            new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                    new Insets(margin / 3, margin * 3, 0, margin), 0, 0));

    contentPane.add(selectedArtifactTextField,
            new GridBagConstraints(1, row, 0, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                    new Insets(margin / 3, margin, 0, margin), 0, 0));
    contentPane.add(errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()],
            new GridBagConstraints(1, ++row, 0, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                    new Insets(0, margin, 0, 0), 0, 0));
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionExDialog.java

License:Open Source License

private void addMainClassNameLineItem() {
    JLabel sparkMainClassLabel = new JLabel("Main class name");
    sparkMainClassLabel.setToolTipText("Application's java/spark main class");
    GridBagConstraints c31 = new GridBagConstraints();
    c31.gridx = 0;/* w w w  .j a va2 s . co m*/
    c31.gridy = 2;
    c31.insets = new Insets(margin, margin, margin, margin);
    contentPane.add(sparkMainClassLabel, new GridBagConstraints(0, ++row, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    mainClassTextField = new TextFieldWithBrowseButton();
    mainClassTextField.setToolTipText("Application's java/spark main class");
    ManifestFileUtil.setupMainClassField(project, mainClassTextField);

    contentPane.add(mainClassTextField, new GridBagConstraints(1, row, 0, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));

    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()] = new JLabel(
            "Main Class Name should not be null");
    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()].setVisible(true);

    mainClassTextField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(3, e.getDocument().getLength() == 0);
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(3, e.getDocument().getLength() == 0);
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
        }
    });

    contentPane.add(errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()],
            new GridBagConstraints(1, ++row, 0, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                    new Insets(0, margin, 0, margin), 0, 0));
}