Search in sources :

Example 26 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij by bazelbuild.

the class BlazeEditProjectViewControl method fillUi.

private void fillUi(JPanel canvas) {
    JLabel projectDataDirLabel = new JBLabel("Project data directory:");
    canvas.setPreferredSize(ProjectViewUi.getContainerSize());
    projectDataDirField = new TextFieldWithBrowseButton();
    projectDataDirField.setName("project-data-dir-field");
    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.";
    projectDataDirField.setToolTipText(dataDirToolTipText);
    projectDataDirLabel.setToolTipText(dataDirToolTipText);
    canvas.add(projectDataDirLabel, UiUtil.getLabelConstraints(0));
    canvas.add(projectDataDirField, UiUtil.getFillLineConstraints(0));
    JLabel projectNameLabel = new JLabel("Project name:");
    projectNameField = new JTextField();
    final String projectNameToolTipText = "Project display name.";
    projectNameField.setToolTipText(projectNameToolTipText);
    projectNameField.setName("project-name-field");
    projectNameLabel.setToolTipText(projectNameToolTipText);
    canvas.add(projectNameLabel, UiUtil.getLabelConstraints(0));
    canvas.add(projectNameField, UiUtil.getFillLineConstraints(0));
    JLabel defaultNameLabel = new JLabel("Infer name from:");
    workspaceDefaultNameOption = new JRadioButton("Workspace");
    branchDefaultNameOption = new JRadioButton("Branch");
    importDirectoryDefaultNameOption = new JRadioButton("Import Directory");
    workspaceDefaultNameOption.setToolTipText("Infer default name from the workspace name");
    branchDefaultNameOption.setToolTipText("Infer default name from the current branch of your workspace");
    importDirectoryDefaultNameOption.setToolTipText("Infer default name from the directory used to import your project view");
    workspaceDefaultNameOption.addItemListener(e -> inferDefaultNameModeSelectionChanged());
    branchDefaultNameOption.addItemListener(e -> inferDefaultNameModeSelectionChanged());
    importDirectoryDefaultNameOption.addItemListener(e -> inferDefaultNameModeSelectionChanged());
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(workspaceDefaultNameOption);
    buttonGroup.add(branchDefaultNameOption);
    buttonGroup.add(importDirectoryDefaultNameOption);
    canvas.add(defaultNameLabel, UiUtil.getLabelConstraints(0));
    canvas.add(workspaceDefaultNameOption, UiUtil.getLabelConstraints(0));
    canvas.add(branchDefaultNameOption, UiUtil.getLabelConstraints(0));
    canvas.add(importDirectoryDefaultNameOption, UiUtil.getLabelConstraints(0));
    canvas.add(new JPanel(), UiUtil.getFillLineConstraints(0));
    projectViewUi.fillUi(canvas);
}
Also used : JPanel(javax.swing.JPanel) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) JRadioButton(javax.swing.JRadioButton) JBLabel(com.intellij.ui.components.JBLabel) ButtonGroup(javax.swing.ButtonGroup) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField)

Example 27 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project ballerina by ballerina-lang.

the class BallerinaRunUtil method installFileChooser.

private static void installFileChooser(@NotNull Project project, @NotNull ComponentWithBrowseButton field, @Nullable Condition<VirtualFile> fileFilter) {
    FileChooserDescriptor chooseDirectoryDescriptor = FileChooserDescriptorFactory.createSingleFileDescriptor(BallerinaFileType.INSTANCE);
    chooseDirectoryDescriptor.setRoots(project.getBaseDir());
    chooseDirectoryDescriptor.setShowFileSystemRoots(false);
    chooseDirectoryDescriptor.withShowHiddenFiles(false);
    chooseDirectoryDescriptor.withFileFilter(fileFilter);
    if (field instanceof TextFieldWithBrowseButton) {
        ((TextFieldWithBrowseButton) field).addBrowseFolderListener(new TextBrowseFolderListener(chooseDirectoryDescriptor, project));
    } else {
        // noinspection unchecked
        field.addBrowseFolderListener(project, new ComponentWithBrowseButton.BrowseFolderActionListener(null, null, field, project, chooseDirectoryDescriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT));
    }
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) ComponentWithBrowseButton(com.intellij.openapi.ui.ComponentWithBrowseButton) TextBrowseFolderListener(com.intellij.openapi.ui.TextBrowseFolderListener)

Example 28 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project ballerina by ballerina-lang.

the class BallerinaRemoteSettingsEditor method createUIComponents.

private void createUIComponents() {
    myWorkingDirectoryField = new LabeledComponent<>();
    myWorkingDirectoryField.setComponent(new TextFieldWithBrowseButton());
    myParamsField = new LabeledComponent<>();
    myParamsField.setComponent(new RawCommandLineEditor());
    myModulesComboBox = new LabeledComponent<>();
    myModulesComboBox.setComponent(new ModulesComboBox());
    myHost = new LabeledComponent<>();
    myHostField = new EditorTextField();
    myHostField.setPreferredWidth(300);
    myHost.setComponent(myHostField);
    myPort = new LabeledComponent<>();
    myPortField = new EditorTextField();
    myPortField.setPreferredWidth(100);
    myPort.setComponent(myPortField);
}
Also used : ModulesComboBox(com.intellij.application.options.ModulesComboBox) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) EditorTextField(com.intellij.ui.EditorTextField) RawCommandLineEditor(com.intellij.ui.RawCommandLineEditor)

Example 29 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunUtil method installFileChooser.

public static void installFileChooser(@NotNull Project project, @NotNull ComponentWithBrowseButton field, boolean directory, boolean showFileSystemRoots, @Nullable Condition<VirtualFile> fileFilter) {
    FileChooserDescriptor chooseDirectoryDescriptor = directory ? FileChooserDescriptorFactory.createSingleFolderDescriptor() : FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
    chooseDirectoryDescriptor.setRoots(project.getBaseDir());
    chooseDirectoryDescriptor.setShowFileSystemRoots(showFileSystemRoots);
    chooseDirectoryDescriptor.withFileFilter(fileFilter);
    if (field instanceof TextFieldWithBrowseButton) {
        ((TextFieldWithBrowseButton) field).addBrowseFolderListener(new TextBrowseFolderListener(chooseDirectoryDescriptor, project));
    } else {
        // noinspection unchecked
        field.addBrowseFolderListener(project, new ComponentWithBrowseButton.BrowseFolderActionListener(null, null, field, project, chooseDirectoryDescriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT));
    }
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) ComponentWithBrowseButton(com.intellij.openapi.ui.ComponentWithBrowseButton) TextBrowseFolderListener(com.intellij.openapi.ui.TextBrowseFolderListener)

Example 30 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-leiningen-plugin by derkork.

the class LeiningenRunConfigurationSettings method createEditor.

@NotNull
protected JComponent createEditor() {
    JPanel configurationPanel = new JPanel(new FormLayout("fill:50dlu:grow", "p,p,5dlu,p,p,fill:50dlu:grow"));
    CellConstraints c = new CellConstraints();
    configurationPanel.add(new JLabel("Working directory"), c.xy(1, 1));
    this.wdSelector = new TextFieldWithBrowseButton();
    this.wdSelector.addBrowseFolderListener("Select working directory", "This directory must contain a project.clj file. ", null, new FileChooserDescriptor(false, true, false, false, false, false));
    configurationPanel.add(this.wdSelector, c.xy(1, 2));
    configurationPanel.add(new JLabel("Goals to run (separate with space)"), c.xy(1, 4));
    this.goals = new TextFieldWithAutoCompletion<String>(myProject, new TextFieldWithAutoCompletion.StringsCompletionProvider(Arrays.asList(LeiningenConstants.GOALS), null), true, null);
    configurationPanel.add(this.goals, c.xy(1, 5));
    return configurationPanel;
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) CellConstraints(com.jgoodies.forms.layout.CellConstraints) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)59 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)22 NotNull (org.jetbrains.annotations.NotNull)12 VirtualFile (com.intellij.openapi.vfs.VirtualFile)9 ActionEvent (java.awt.event.ActionEvent)9 ActionListener (java.awt.event.ActionListener)8 JBLabel (com.intellij.ui.components.JBLabel)6 JBTextField (com.intellij.ui.components.JBTextField)6 DocumentEvent (javax.swing.event.DocumentEvent)6 File (java.io.File)5 Nullable (org.jetbrains.annotations.Nullable)5 FileTextField (com.intellij.openapi.fileChooser.FileTextField)4 ComboBox (com.intellij.openapi.ui.ComboBox)4 TextBrowseFolderListener (com.intellij.openapi.ui.TextBrowseFolderListener)4 DocumentListener (javax.swing.event.DocumentListener)4 AndroidTargetHash.getAddonHashString (com.android.sdklib.AndroidTargetHash.getAddonHashString)3 BuildFileKey (com.android.tools.idea.gradle.parser.BuildFileKey)3 ComponentWithBrowseButton (com.intellij.openapi.ui.ComponentWithBrowseButton)3 RawCommandLineEditor (com.intellij.ui.RawCommandLineEditor)3 JBCheckBox (com.intellij.ui.components.JBCheckBox)3