Example usage for com.intellij.openapi.ui TextComponentAccessor TEXT_FIELD_WHOLE_TEXT

List of usage examples for com.intellij.openapi.ui TextComponentAccessor TEXT_FIELD_WHOLE_TEXT

Introduction

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

Prototype

TextComponentAccessor TEXT_FIELD_WHOLE_TEXT

To view the source code for com.intellij.openapi.ui TextComponentAccessor TEXT_FIELD_WHOLE_TEXT.

Click Source Link

Document

The accessor that gets and changes whole text

Usage

From source file:com.android.tools.idea.gradle.actions.LinkExternalCppProjectDialog.java

License:Apache License

public LinkExternalCppProjectDialog(@NotNull Module module) {
    super(false);

    myModule = module;/*w w w  .  ja  v a2  s  . c  om*/

    init();

    setTitle("Link C++ Project with Gradle");

    myBuildSystemCombo.addItem(BuildSystem.CMAKE);
    myBuildSystemCombo.addItem(BuildSystem.NDK_BUILD);

    myBuildSystemCombo.setSelectedItem(BuildSystem.CMAKE);
    myProjectPathDescriptionLabel.setText(CMAKE_PATH_DESCRIPTION);

    myBuildSystemCombo.addItemListener(e -> {
        if (myBuildSystemCombo.getSelectedItem() == BuildSystem.CMAKE) {
            myProjectPathDescriptionLabel.setText(CMAKE_PATH_DESCRIPTION);
        } else {
            myProjectPathDescriptionLabel.setText(NDK_BUILD_PATH_DESCRIPTION);
        }
    });

    getOKAction().setEnabled(false);

    myProjectPathTextField.setTextFieldPreferredWidth(50);
    FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
        @Override
        public void validateSelectedFiles(VirtualFile[] files) throws Exception {
            for (VirtualFile virtualFile : files) {
                String errorMessage = validateProjectFilePath(virtualToIoFile(virtualFile));
                if (errorMessage != null) {
                    throw new IllegalArgumentException(errorMessage);
                }
            }
        }
    };

    descriptor.setTitle("Choose C++ Project Location");

    myProjectPathTextField.addActionListener(
            new ComponentWithBrowseButton.BrowseFolderActionListener<>("Select C++ Project Location", null,
                    myProjectPathTextField, null, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT));

    myProjectPathResultLabel.setVisible(false);
}

From source file:com.android.tools.idea.gradle.project.ChooseGradleHomeDialog.java

License:Apache License

public ChooseGradleHomeDialog(@NotNull String title, @Nullable String minimumGradleVersion) {
    super(null);/*from   w w w  . j  a  v  a  2  s.  c  o  m*/
    myMinimumGradleVersion = minimumGradleVersion;
    myInstallationManager = ServiceManager.getService(GradleInstallationManager.class);
    init();
    initValidation();
    setTitle(title);

    FileChooserDescriptor fileChooserDescriptor = getGradleHomeFileChooserDescriptor();
    myGradleHomePathField.addBrowseFolderListener("", GradleBundle.message("gradle.settings.text.home.path"),
            null, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);

    myGradleHomeLabel.setLabelFor(myGradleHomePathField.getTextField());
    // This prevents the weird sizing in Linux.
    getPeer().getWindow().pack();

    myGradleHomePathField.setText(getLastUsedGradleHome());
    myGradleHomePathField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            initValidation();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            initValidation();
        }

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

From source file:com.android.tools.idea.sdk.SelectNdkDialog.java

License:Apache License

private void configureNdkTextField() {
    myNdkTextFieldWithButton.setTextFieldPreferredWidth(50);

    FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) {
        @Override/*  w  ww.j  a v  a 2s  . c o  m*/
        public void validateSelectedFiles(VirtualFile[] files) throws Exception {
            for (VirtualFile virtualFile : files) {
                File file = virtualToIoFile(virtualFile);
                ValidationResult validationResult = validateAndroidNdk(file, false);
                if (!validationResult.success) {
                    String msg = validationResult.message;
                    if (isEmpty(msg)) {
                        msg = "Please choose a valid Android NDK directory.";
                    }
                    throw new IllegalArgumentException(msg);
                }
            }
        }
    };

    if (SystemInfo.isMac) {
        descriptor.withShowHiddenFiles(true);
    }
    descriptor.setTitle("Choose Android NDK Location");

    myNdkTextFieldWithButton.addActionListener(
            new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>("Select Android NDK Home",
                    null, myNdkTextFieldWithButton, null, descriptor,
                    TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT));
}

From source file:com.facebook.buck.intellij.ideabuck.ui.BuckSettingsUI.java

License:Apache License

private void init() {
    setLayout(new BorderLayout());
    JPanel container = this;

    buckPathField = new TextFieldWithBrowseButton();
    FileChooserDescriptor buckFileChooserDescriptor = new FileChooserDescriptor(true, false, false, false,
            false, false);//from   w w  w.  j av a 2 s  . c o  m
    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);
}

From source file:com.facebook.buck.intellij.plugin.ui.BuckSettingsUI.java

License:Apache License

private void init() {
    setLayout(new BorderLayout());
    JPanel container = this;

    buckPathField = new TextFieldWithBrowseButton();
    FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false,
            false);/*  w  w  w . j  ava2s . c om*/
    buckPathField.addBrowseFolderListener("", "Buck Executable Path", null, fileChooserDescriptor,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
    customizedInstallSettingField = new JBTextField();
    customizedInstallSettingField.getEmptyText().setText(CUSTOMIZED_INSTALL_FLAGS_HINT);
    customizedInstallSettingField.setEnabled(false);

    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);

    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);
}

From source file:com.google.cloud.tools.intellij.vcs.CloneCloudRepositoryDialog.java

License:Apache License

private void initComponents() {
    FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    fcd.setShowFileSystemRoots(true);/*from w  w  w.  j  av  a 2 s  .  c o  m*/
    fcd.setTitle(GctBundle.message("clonefromgcp.destination.directory.title"));
    fcd.setDescription(GctBundle.message("clonefromgcp.destination.directory.description"));
    fcd.setHideIgnored(false);
    parentDirectory.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            fcd.getTitle(), fcd.getDescription(), parentDirectory, project, fcd,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
        @Override
        protected VirtualFile getInitialFile() {
            String text = getComponentText();
            if (text.length() == 0) {
                VirtualFile file = project.getBaseDir();
                if (file != null) {
                    return file;
                }
            }
            return super.getInitialFile();
        }
    });

    final DocumentListener updateOkButtonListener = new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent event) {
            updateButtons();
        }
    };
    parentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
    parentDirectory.setText(ProjectUtil.getBaseDir());
    directoryName.getDocument().addDocumentListener(updateOkButtonListener);

    setOKActionEnabled(false);
}

From source file:com.google.gct.idea.git.CloneGcpDialog.java

License:Apache License

private void initComponents() {
    FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    fcd.setShowFileSystemRoots(true);// w w  w  .  j a v  a 2 s  .co  m
    fcd.setTitle(GctBundle.message("clonefromgcp.destination.directory.title"));
    fcd.setDescription(GctBundle.message("clonefromgcp.destination.directory.description"));
    fcd.setHideIgnored(false);
    myParentDirectory.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            fcd.getTitle(), fcd.getDescription(), myParentDirectory, myProject, fcd,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
        @Override
        protected VirtualFile getInitialFile() {
            String text = getComponentText();
            if (text.length() == 0) {
                VirtualFile file = myProject.getBaseDir();
                if (file != null) {
                    return file;
                }
            }
            return super.getInitialFile();
        }
    });

    final DocumentListener updateOkButtonListener = new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            updateButtons();
        }
    };
    myParentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
    myParentDirectory.setText(ProjectUtil.getBaseDir());
    myDirectoryName.getDocument().addDocumentListener(updateOkButtonListener);

    setOKActionEnabled(false);
}

From source file:com.google.idea.blaze.base.wizard.BlazeProjectSettingsControl.java

License:Open Source License

private void fillUi(@NotNull JPanel canvas, int indentLevel) {
    JLabel projectDataDirLabel = new JBLabel("Project data directory:");

    Dimension minSize = ProjectViewUi.getMinimumSize();
    // Add 120 pixels so we have room for our extra fields
    minSize.setSize(minSize.width, minSize.height + 120);
    canvas.setMinimumSize(minSize);//ww  w  .j  av  a2  s .c o m
    canvas.setPreferredSize(minSize);

    projectDataDirField = new TextFieldWithBrowseButton();
    projectDataDirField.addBrowseFolderListener("", "Blaze Android Studio project data directory", null,
            STUDIO_PROJECT_FOLDER_DESCRIPTOR, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
    final String dataDirToolTipText = "Directory in which to store the project's metadata. Choose a directory outside of"
            + " the Piper/CitC client directories or Git5 directory.";
    projectDataDirField.setToolTipText(dataDirToolTipText);
    projectDataDirLabel.setToolTipText(dataDirToolTipText);

    canvas.add(projectDataDirLabel, UiUtil.getLabelConstraints(indentLevel));
    canvas.add(projectDataDirField, UiUtil.getFillLineConstraints(0));

    JLabel projectNameLabel = new JLabel("Project name:");
    projectNameField = new JTextField();
    final String projectNameToolTipText = "Project display name.";
    projectNameField.setToolTipText(projectNameToolTipText);
    projectNameLabel.setToolTipText(projectNameToolTipText);
    canvas.add(projectNameLabel, UiUtil.getLabelConstraints(indentLevel));
    canvas.add(projectNameField, UiUtil.getFillLineConstraints(0));

    projectViewUi.fillUi(canvas, indentLevel);
}

From source file:com.google.idea.blaze.base.wizard2.ui.BlazeEditProjectViewControl.java

License:Open Source License

private void fillUi(JPanel canvas, int indentLevel) {
    JLabel projectDataDirLabel = new JBLabel("Project data directory:");

    Dimension minSize = ProjectViewUi.getMinimumSize();
    // Add 120 pixels so we have room for our extra fields
    minSize.setSize(minSize.width, minSize.height + 120);
    canvas.setMinimumSize(minSize);//from  w  w w  . ja  v  a 2 s  . c o m
    canvas.setPreferredSize(minSize);

    projectDataDirField = new TextFieldWithBrowseButton();
    projectDataDirField.addBrowseFolderListener("", buildSystemName + " project data directory", null,
            PROJECT_FOLDER_DESCRIPTOR, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
    final String dataDirToolTipText = "Directory in which to store the project's metadata. "
            + "Choose a directory outside of your workspace.";
    projectDataDirField.setToolTipText(dataDirToolTipText);
    projectDataDirLabel.setToolTipText(dataDirToolTipText);

    canvas.add(projectDataDirLabel, UiUtil.getLabelConstraints(indentLevel));
    canvas.add(projectDataDirField, UiUtil.getFillLineConstraints(0));

    JLabel projectNameLabel = new JLabel("Project name:");
    projectNameField = new JTextField();
    final String projectNameToolTipText = "Project display name.";
    projectNameField.setToolTipText(projectNameToolTipText);
    projectNameLabel.setToolTipText(projectNameToolTipText);
    canvas.add(projectNameLabel, UiUtil.getLabelConstraints(indentLevel));
    canvas.add(projectNameField, UiUtil.getFillLineConstraints(0));

    projectViewUi.fillUi(canvas, indentLevel);
}

From source file:com.intellij.coldFusion.mxunit.CfmlUnitRunConfigurationForm.java

License:Apache License

public CfmlUnitRunConfigurationForm(Project project) {
    myProject = project;/*w  w w .ja v  a2 s.  c  om*/

    myMethodPanel.setVisible(false);

    myFileChooser = new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(null, null,
            myDirectoryOrFileField, project, FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor(),
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);

    myDirectoryChooser = new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(null, null,
            myDirectoryOrFileField, project, FileChooserDescriptorFactory.createSingleFolderDescriptor(),
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
    myMethodRadioButton.addChangeListener(myScopeChangeListener);
    myDirectoryRadioButton.addChangeListener(myScopeChangeListener);
    myComponentRadioButton.addChangeListener(myScopeChangeListener);
}