com.intellij.ui.TextFieldWithHistory Java Examples
The following examples show how to use
com.intellij.ui.TextFieldWithHistory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SassLintSettingsPage.java From sass-lint-plugin with MIT License | 5 votes |
private void configConfigFileField() { TextFieldWithHistory textFieldWithHistory = configWithDefaults(sassLintConfigFile); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { return SassLintFinder.searchForConfigFiles(getProjectPath()); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, sassLintConfigFile, "Select Sass Lint Config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #2
Source File: ESLintSettingsPage.java From eslint-plugin with MIT License | 5 votes |
private void configNodeField() { TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters(); return FileUtils.toAbsolutePath(newFiles); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #3
Source File: ESLintSettingsPage.java From eslint-plugin with MIT License | 5 votes |
private void configESLintRcField() { TextFieldWithHistory textFieldWithHistory = configWithDefaults(eslintrcFile); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { return ESLintFinder.searchForESLintRCFiles(getProjectPath()); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, eslintrcFile, "Select ESLint Config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #4
Source File: ESLintSettingsPage.java From eslint-plugin with MIT License | 5 votes |
private void configESLintRulesField() { TextFieldWithHistory textFieldWithHistory = rulesPathField.getChildComponent(); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { return ESLintFinder.tryFindRulesAsString(getProjectPath()); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, rulesPathField, "Select Built in Rules", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #5
Source File: GuiUtil.java From intellij-haskforce with Apache License 2.0 | 5 votes |
/** * Creates a label and text field input and adds them to the configuration * window. * * @param settings Panel to add components to. * @param labelText Which text to show to the left of the field. * @return The TextFieldWithBrowseButton created. */ public static TextFieldWithHistory createTextfield(JPanel settings, String labelText, Object constraints) { // Create UI elements. TextFieldWithHistory tf = new TextFieldWithHistory(); // Add elements to Panel. JPanel subPanel = new JPanel(new GridBagLayout()); subPanel.add(new JLabel(labelText + ':')); subPanel.add(tf, ExternalSystemUiUtil.getFillLineConstraints(0)); settings.add(subPanel, constraints); return tf; }
Example #6
Source File: RTSettingsPage.java From react-templates-plugin with MIT License | 5 votes |
private void configNodeField() { TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters(); return FileUtils.toAbsolutePath(newFiles); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #7
Source File: JscsSettingsPage.java From jscs-plugin with MIT License | 5 votes |
private void configNodeField() { TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters(); return FileUtils.toAbsolutePath(newFiles); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #8
Source File: JscsSettingsPage.java From jscs-plugin with MIT License | 5 votes |
private void configJscsRcField() { TextFieldWithHistory textFieldWithHistory = configWithDefaults(jscsrcFile); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { return JscsFinder.searchForJscsRCFiles(getProjectPath()); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, jscsrcFile, "Select JSCS config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #9
Source File: VueSettingsPage.java From vue-for-idea with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void configNodeField() { TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters(); return FileUtils.toAbsolutePath(newFiles); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #10
Source File: RTSettingsPage.java From react-templates-plugin with MIT License | 5 votes |
private void configNodeField() { TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters(); return FileUtils.toAbsolutePath(newFiles); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #11
Source File: UseExistingBazelWorkspaceOption.java From intellij with Apache License 2.0 | 5 votes |
public UseExistingBazelWorkspaceOption(BlazeNewProjectBuilder builder) { directoryField = new TextFieldWithHistory(); directoryField.setName("workspace-directory-field"); directoryField.setHistory(builder.getWorkspaceHistory(BuildSystem.Bazel)); directoryField.setHistorySize(BlazeNewProjectBuilder.HISTORY_SIZE); directoryField.setText(builder.getLastImportedWorkspace(BuildSystem.Bazel)); directoryField.setMinimumAndPreferredWidth(MINIMUM_FIELD_WIDTH); JButton button = new JButton("..."); button.addActionListener(action -> this.chooseDirectory()); int buttonSize = this.directoryField.getPreferredSize().height; button.setPreferredSize(new Dimension(buttonSize, buttonSize)); JPanel canvas = new JPanel(new VerticalLayout(4)); canvas.setPreferredSize(ProjectViewUi.getContainerSize()); canvas.add(new JLabel("Select an existing Bazel workspace")); canvas.add(new JSeparator()); // Explicitly specify alignment, so preferred widths of children are honored. JPanel content = new JPanel(new VerticalLayout(/* gap= */ 12, /* alignment= */ SwingConstants.LEFT)); content.setBorder(Borders.empty(20, 20, 0, 0)); JComponent box = UiUtil.createHorizontalBox( BlazeWizardOption.HORIZONTAL_LAYOUT_GAP, getIconComponent(), new JLabel("Workspace:"), this.directoryField, button); UiUtil.setPreferredWidth(box, BlazeWizardOption.PREFERRED_COMPONENT_WIDTH); content.add(box); canvas.add(content); this.component = canvas; }
Example #12
Source File: SassLintSettingsPage.java From sass-lint-plugin with MIT License | 5 votes |
private void configNodeField() { TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField); SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() { @NotNull public List<String> produce() { List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters(); return FileUtils.toAbsolutePath(newFiles); } }); SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); }
Example #13
Source File: AlternativeJREPanel.java From intellij-xquery with Apache License 2.0 | 4 votes |
public AlternativeJREPanel() { myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox")); myFieldWithHistory = new TextFieldWithHistory(); myFieldWithHistory.setHistorySize(-1); final List<String> foundJDKs = new ArrayList<>(); final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks(); String javaHomeOfCurrentProcess = System.getProperty("java.home"); if (javaHomeOfCurrentProcess != null && !javaHomeOfCurrentProcess.isEmpty()) { foundJDKs.add(javaHomeOfCurrentProcess); } for (Sdk sdk : allJDKs) { String name = sdk.getName(); if (!foundJDKs.contains(name)) { foundJDKs.add(name); } } for (Sdk jdk : allJDKs) { String homePath = jdk.getHomePath(); if (!SystemInfo.isMac) { final File jre = new File(jdk.getHomePath(), "jre"); if (jre.isDirectory()) { homePath = jre.getPath(); } } if (!foundJDKs.contains(homePath)) { foundJDKs.add(homePath); } } myFieldWithHistory.setHistory(foundJDKs); myPathField = new ComponentWithBrowseButton<>(myFieldWithHistory, null); myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"), ExecutionBundle.message("run.configuration.select.jre.dir.label"), null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT); setLayout(new MigLayout("ins 0, gap 10, fill, flowx")); add(myCbEnabled, "shrinkx"); add(myPathField, "growx, pushx"); InsertPathAction.addTo(myFieldWithHistory.getTextEditor()); myCbEnabled.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { enabledChanged(); } }); enabledChanged(); setAnchor(myCbEnabled); updateUI(); }
Example #14
Source File: TextComponentAccessor.java From consulo with Apache License 2.0 | 4 votes |
public String getText(TextFieldWithHistory textField) { return textField.getText(); }
Example #15
Source File: GuiUtil.java From intellij-haskforce with Apache License 2.0 | 4 votes |
public static TextFieldWithHistory createTextfield(JPanel settings, String labelText) { return createTextfield(settings, labelText, ExternalSystemUiUtil.getFillLineConstraints(0)); }
Example #16
Source File: SassLintSettingsPage.java From sass-lint-plugin with MIT License | 4 votes |
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) { TextFieldWithHistory textFieldWithHistory = field.getChildComponent(); textFieldWithHistory.setHistorySize(-1); textFieldWithHistory.setMinimumAndPreferredWidth(0); return textFieldWithHistory; }
Example #17
Source File: TextComponentAccessor.java From consulo with Apache License 2.0 | 4 votes |
public void setText(TextFieldWithHistory textField, String text) { textField.setText(text); }
Example #18
Source File: ESLintSettingsPage.java From eslint-plugin with MIT License | 4 votes |
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) { TextFieldWithHistory textFieldWithHistory = field.getChildComponent(); textFieldWithHistory.setHistorySize(-1); textFieldWithHistory.setMinimumAndPreferredWidth(0); return textFieldWithHistory; }
Example #19
Source File: RTSettingsPage.java From react-templates-plugin with MIT License | 4 votes |
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) { TextFieldWithHistory textFieldWithHistory = field.getChildComponent(); textFieldWithHistory.setHistorySize(-1); textFieldWithHistory.setMinimumAndPreferredWidth(0); return textFieldWithHistory; }
Example #20
Source File: JscsSettingsPage.java From jscs-plugin with MIT License | 4 votes |
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) { TextFieldWithHistory textFieldWithHistory = field.getChildComponent(); textFieldWithHistory.setHistorySize(-1); textFieldWithHistory.setMinimumAndPreferredWidth(0); return textFieldWithHistory; }
Example #21
Source File: VueSettingsPage.java From vue-for-idea with BSD 3-Clause "New" or "Revised" License | 4 votes |
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) { TextFieldWithHistory textFieldWithHistory = field.getChildComponent(); textFieldWithHistory.setHistorySize(-1); textFieldWithHistory.setMinimumAndPreferredWidth(0); return textFieldWithHistory; }
Example #22
Source File: RTSettingsPage.java From react-templates-plugin with MIT License | 4 votes |
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) { TextFieldWithHistory textFieldWithHistory = field.getChildComponent(); textFieldWithHistory.setHistorySize(-1); textFieldWithHistory.setMinimumAndPreferredWidth(0); return textFieldWithHistory; }