use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project buck by facebook.
the class BuckSettingsUI method init.
private void init() {
setLayout(new BorderLayout());
JPanel container = this;
buckPathField = new TextFieldWithBrowseButton();
FileChooserDescriptor buckFileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
buckPathField.addBrowseFolderListener("", "Buck Executable Path", null, buckFileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
adbPathField = new TextFieldWithBrowseButton();
FileChooserDescriptor adbFileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
adbPathField.addBrowseFolderListener("", "Adb Executable Path", null, adbFileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
customizedInstallSettingField = new JBTextField();
customizedInstallSettingField.getEmptyText().setText(CUSTOMIZED_INSTALL_FLAGS_HINT);
customizedInstallSettingField.setEnabled(false);
showDebug = new JCheckBox("Show debug in tool window");
enableAutoDeps = new JCheckBox("Enable auto dependencies");
runAfterInstall = new JCheckBox("Run after install (-r)");
multiInstallMode = new JCheckBox("Multi-install mode (-x)");
uninstallBeforeInstall = new JCheckBox("Uninstall before installing (-u)");
customizedInstallSetting = new JCheckBox("Use customized install setting: ");
initCustomizedInstallCommandListener();
JPanel buckSettings = new JPanel(new GridBagLayout());
buckSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Settings", true));
container.add(container = new JPanel(new BorderLayout()), BorderLayout.NORTH);
container.add(buckSettings, BorderLayout.NORTH);
final GridBagConstraints constraints = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
buckSettings.add(new JLabel("Buck Executable Path:"), constraints);
constraints.gridx = 1;
constraints.weightx = 1;
constraints.fill = GridBagConstraints.HORIZONTAL;
buckSettings.add(buckPathField, constraints);
constraints.gridx = 0;
constraints.gridy = 1;
constraints.weightx = 1;
buckSettings.add(new JLabel("Adb Executable Path:"), constraints);
constraints.gridx = 1;
constraints.gridy = 1;
constraints.weightx = 1;
constraints.fill = GridBagConstraints.HORIZONTAL;
buckSettings.add(adbPathField, constraints);
constraints.gridx = 0;
constraints.gridy = 2;
buckSettings.add(showDebug, constraints);
constraints.gridx = 0;
constraints.gridy = 3;
buckSettings.add(enableAutoDeps, constraints);
JPanel installSettings = new JPanel(new BorderLayout());
installSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Install Settings", true));
container.add(container = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
container.add(installSettings, BorderLayout.NORTH);
installSettings.add(runAfterInstall, BorderLayout.NORTH);
installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
installSettings.add(multiInstallMode, BorderLayout.NORTH);
installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
installSettings.add(uninstallBeforeInstall, BorderLayout.NORTH);
installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
final GridBagConstraints customConstraints = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
JPanel customizedInstallSetting = new JPanel(new GridBagLayout());
customizedInstallSetting.add(this.customizedInstallSetting, customConstraints);
customConstraints.gridx = 1;
customConstraints.weightx = 1;
customConstraints.fill = GridBagConstraints.HORIZONTAL;
customizedInstallSetting.add(customizedInstallSettingField, customConstraints);
installSettings.add(customizedInstallSetting, BorderLayout.NORTH);
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project kotlin by JetBrains.
the class KotlinStandaloneScriptRunConfigurationEditor method createUIComponents.
private void createUIComponents() {
chooseScriptFileComponent = new LabeledComponent<TextFieldWithBrowseButton>();
chooseScriptFileTextField = new TextFieldWithBrowseButton();
chooseScriptFileComponent.setComponent(chooseScriptFileTextField);
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.
the class SdkHomeConfigurable method createComponent.
@Override
public JComponent createComponent() {
myPanel = new JPanel(new BorderLayout(10, 5));
final JPanel contentPanel = new JPanel(new BorderLayout(4, 0));
myPanel.add(contentPanel, BorderLayout.NORTH);
contentPanel.add(new JLabel(myFrameworkName + " home:"), BorderLayout.WEST);
myPathField = new TextFieldWithBrowseButton();
contentPanel.add(myPathField);
myPathField.addBrowseFolderListener("Select " + myFrameworkName + " home", "", myProject, new FileChooserDescriptor(false, true, false, false, false, false) {
@Override
public boolean isFileSelectable(VirtualFile file) {
return isSdkHome(file);
}
});
return myPanel;
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.
the class SSHCredentialsDialog method createCenterPanel.
protected JComponent createCenterPanel() {
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
GridBagConstraints gb = new GridBagConstraints();
// top label.
gb.insets = JBUI.insets(2);
gb.weightx = 1;
gb.weighty = 0;
gb.gridwidth = 3;
gb.gridheight = 1;
gb.gridx = 0;
gb.gridy = 0;
gb.anchor = GridBagConstraints.WEST;
gb.fill = GridBagConstraints.HORIZONTAL;
JLabel label = new JLabel(SvnBundle.message("label.ssh.authentication.realm", myRealm));
panel.add(label, gb);
// user name
gb.gridy += 1;
gb.gridwidth = 1;
gb.weightx = 0;
gb.fill = GridBagConstraints.NONE;
label = new JLabel(SvnBundle.message("label.ssh.user.name"));
panel.add(label, gb);
// user name field
gb.gridx = 1;
gb.gridwidth = 2;
gb.weightx = 1;
gb.fill = GridBagConstraints.HORIZONTAL;
myUserNameText = new JTextField();
panel.add(myUserNameText, gb);
label.setLabelFor(myUserNameText);
if (myUserName != null) {
myUserNameText.setText(myUserName);
}
myUserNameText.selectAll();
myUserNameText.getDocument().addDocumentListener(this);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 3;
// ssh agent type
mySshAgentButton = new JBRadioButton(SvnBundle.message("radio.ssh.authentication.with.agent"));
panel.add(mySshAgentButton, gb);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 3;
// password type
myPasswordButton = new JRadioButton(SvnBundle.message("radio.ssh.authentication.with.password"));
panel.add(myPasswordButton, gb);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.gridwidth = 1;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 1;
myPasswordLabel = new JLabel(SvnBundle.message("label.ssh.password"));
panel.add(myPasswordLabel, gb);
// passworde field
gb.gridx = 1;
gb.weightx = 1;
gb.gridwidth = 2;
gb.fill = GridBagConstraints.HORIZONTAL;
myPasswordText = new JPasswordField();
panel.add(myPasswordText, gb);
myPasswordLabel.setLabelFor(myPasswordText);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 3;
myKeyButton = new JRadioButton(SvnBundle.message("radio.ssh.authentication.private.key"));
panel.add(myKeyButton, gb);
// key file.
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.gridwidth = 1;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 1;
myKeyFileLabel = new JLabel(SvnBundle.message("label.ssh.key.file"));
panel.add(myKeyFileLabel, gb);
// key field
gb.gridx = 1;
gb.weightx = 1;
gb.gridwidth = 2;
gb.fill = GridBagConstraints.HORIZONTAL;
myKeyFileText = new TextFieldWithBrowseButton(this);
myKeyFileText.setEditable(false);
panel.add(myKeyFileText, gb);
myKeyFileLabel.setLabelFor(myKeyFileText);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.gridwidth = 1;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 1;
myPassphraseLabel = new JLabel(SvnBundle.message("label.ssh.passphrase"));
panel.add(myPassphraseLabel, gb);
// key field
gb.gridx = 1;
gb.weightx = 1;
gb.gridwidth = 2;
gb.fill = GridBagConstraints.HORIZONTAL;
myPassphraseText = new JPasswordField(30);
panel.add(myPassphraseText, gb);
myPassphraseText.getDocument().addDocumentListener(this);
myPassphraseText.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
checkKeyFile();
updateOKButton();
}
});
myPassphraseLabel.setLabelFor(myPassphraseText);
// key file.
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.gridwidth = 1;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 1;
myPortLabel = new JLabel(SvnBundle.message("label.ssh.port"));
panel.add(myPortLabel, gb);
// key field
gb.gridx = 1;
gb.weightx = 0;
gb.gridwidth = 2;
gb.fill = GridBagConstraints.NONE;
myPortField = new JTextField();
myPortField.setColumns(6);
panel.add(myPortField, gb);
myPortLabel.setLabelFor(myPortField);
myPortField.setText("22");
myPortField.setMinimumSize(myPortField.getPreferredSize());
myPortField.getDocument().addDocumentListener(this);
ButtonGroup group = new ButtonGroup();
group.add(mySshAgentButton);
group.add(myPasswordButton);
group.add(myKeyButton);
mySshAgentButton.setEnabled(myIsAgentAllowed);
group.setSelected((myIsAgentAllowed ? mySshAgentButton : myPasswordButton).getModel(), true);
gb.gridy += 1;
gb.gridx = 0;
gb.gridwidth = 3;
gb.weightx = 1;
gb.anchor = GridBagConstraints.WEST;
gb.fill = GridBagConstraints.HORIZONTAL;
myAllowSaveCheckBox = new JCheckBox(SvnBundle.message("checkbox.ssh.keep.for.current.session"));
panel.add(myAllowSaveCheckBox, gb);
if (!myAllowSave) {
gb.gridy += 1;
final JLabel cannotSaveLabel = new JLabel(SvnBundle.message("svn.cannot.save.credentials.store-auth-creds"));
cannotSaveLabel.setForeground(UIUtil.getInactiveTextColor());
panel.add(cannotSaveLabel, gb);
}
gb.gridy += 1;
panel.add(new JSeparator(), gb);
gb.gridy += 1;
gb.weighty = 1;
panel.add(new JLabel(), gb);
myAllowSaveCheckBox.setSelected(false);
myAllowSaveCheckBox.setEnabled(myAllowSave);
mySshAgentButton.addActionListener(this);
myKeyButton.addActionListener(this);
myPasswordButton.addActionListener(this);
updateFields();
updateOKButton();
return panel;
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.
the class SSLCredentialsDialog method initUI.
private void initUI(final String authRealm, final boolean authSaveAllowed) {
myPanel = new JPanel(new GridBagLayout());
final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insets(1), 0, 0);
gb.fill = GridBagConstraints.HORIZONTAL;
gb.gridwidth = 2;
gb.weightx = 0;
JLabel label = new JLabel(SvnBundle.message("label.auth.authentication.realm", authRealm));
myPanel.add(label, gb);
++gb.gridy;
gb.gridwidth = 1;
gb.weightx = 0;
final JLabel certificatePath = new JLabel(SvnBundle.message("label.ssl.certificate.path"));
myPanel.add(certificatePath, gb);
myCertificatePath = new TextFieldWithBrowseButton();
myCertificatePath.addBrowseFolderListener(SvnBundle.message("dialog.edit.http.proxies.settings.dialog.select.ssl.client.certificate.path.title"), null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
gb.weightx = 1;
++gb.gridx;
myPanel.add(myCertificatePath, gb);
gb.gridx = 0;
gb.weightx = 0;
++gb.gridy;
final JLabel certificatePassword = new JLabel(SvnBundle.message("label.ssl.certificate.password"));
myPanel.add(certificatePassword, gb);
++gb.gridx;
gb.weightx = 1;
myCertificatePassword = new JPasswordField();
myPanel.add(myCertificatePassword, gb);
gb.gridx = 0;
++gb.gridy;
gb.weightx = 0;
mySaveAuth = new JCheckBox(SvnBundle.message("checkbox.ssl.keep.for.current.session"), authSaveAllowed);
mySaveAuth.setEnabled(authSaveAllowed);
myPanel.add(mySaveAuth, gb);
if (!authSaveAllowed) {
++gb.gridy;
gb.gridwidth = 2;
final JLabel cannotSaveLabel = new JLabel(SvnBundle.message("svn.cannot.save.credentials.store-auth-creds"));
cannotSaveLabel.setForeground(UIUtil.getInactiveTextColor());
myPanel.add(cannotSaveLabel, gb);
}
}
Aggregations