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