Search in sources :

Example 1 with TextFieldWithHistory

use of com.intellij.ui.TextFieldWithHistory in project scss-lint-plugin by idok.

the class ScssLintSettingsPage method configESLintBinField.

private void configESLintBinField() {
    TextFieldWithHistory textFieldWithHistory = scssLintExeField.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {

        @NotNull
        public List<String> produce() {
            //                File projectRoot = new File(project.getBaseDir().getPath());
            //searchForESLintBin(projectRoot);
            List<File> newFiles = ScssLintFinder.findAllScssLintExe();
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, scssLintExeField, "Select SCSS Lint Exe", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
Also used : TextFieldWithHistory(com.intellij.ui.TextFieldWithHistory) List(java.util.List) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with TextFieldWithHistory

use of com.intellij.ui.TextFieldWithHistory in project jscs-plugin by idok.

the class JscsSettingsPage method configJscsRcField.

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());
}
Also used : TextFieldWithHistory(com.intellij.ui.TextFieldWithHistory) ArrayList(java.util.ArrayList) List(java.util.List) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with TextFieldWithHistory

use of com.intellij.ui.TextFieldWithHistory in project intellij-community by JetBrains.

the class UnscrambleDialog method createLogFileChooser.

private void createLogFileChooser() {
    myLogFile = new TextFieldWithHistory();
    JPanel panel = GuiUtils.constructFieldWithBrowseButton(myLogFile, new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
            FileChooser.chooseFiles(descriptor, myProject, null, files -> myLogFile.setText(FileUtil.toSystemDependentName(files.get(files.size() - 1).getPath())));
        }
    });
    myLogFileChooserPanel.setLayout(new BorderLayout());
    myLogFileChooserPanel.add(panel, BorderLayout.CENTER);
}
Also used : FileChooserDescriptorFactory(com.intellij.openapi.fileChooser.FileChooserDescriptorFactory) AllIcons(com.intellij.icons.AllIcons) ArrayUtil(com.intellij.util.ArrayUtil) ActionListener(java.awt.event.ActionListener) ProjectLevelVcsManager(com.intellij.openapi.vcs.ProjectLevelVcsManager) NonNls(org.jetbrains.annotations.NonNls) ContainerUtil(com.intellij.util.containers.ContainerUtil) ArrayList(java.util.ArrayList) TextFieldWithHistory(com.intellij.ui.TextFieldWithHistory) Comparing(com.intellij.openapi.util.Comparing) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Project(com.intellij.openapi.project.Project) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) FileUtil(com.intellij.openapi.util.io.FileUtil) VcsContentAnnotationConfigurable(com.intellij.openapi.vcs.configurable.VcsContentAnnotationConfigurable) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) DumbService(com.intellij.openapi.project.DumbService) ContainerUtil.ar(com.intellij.util.containers.ContainerUtil.ar) StringUtil(com.intellij.openapi.util.text.StringUtil) IOException(java.io.IOException) ListCellRendererWrapper(com.intellij.ui.ListCellRendererWrapper) GuiUtils(com.intellij.ui.GuiUtils) ActionEvent(java.awt.event.ActionEvent) java.awt(java.awt) IdeBundle(com.intellij.ide.IdeBundle) HelpManager(com.intellij.openapi.help.HelpManager) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) StringReader(java.io.StringReader) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) Registry(com.intellij.openapi.util.registry.Registry) BufferedReader(java.io.BufferedReader) ConfigurationException(com.intellij.openapi.options.ConfigurationException) NotNull(org.jetbrains.annotations.NotNull) FileChooser(com.intellij.openapi.fileChooser.FileChooser) CharArrayUtil(com.intellij.util.text.CharArrayUtil) Condition(com.intellij.openapi.util.Condition) javax.swing(javax.swing) ActionListener(java.awt.event.ActionListener) TextFieldWithHistory(com.intellij.ui.TextFieldWithHistory) ActionEvent(java.awt.event.ActionEvent) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor)

Example 4 with TextFieldWithHistory

use of com.intellij.ui.TextFieldWithHistory in project intellij-plugins by JetBrains.

the class KarmaRunConfigurationEditor method createConfigurationFileTextField.

@NotNull
private static TextFieldWithHistoryWithBrowseButton createConfigurationFileTextField(@NotNull final Project project) {
    TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton = new TextFieldWithHistoryWithBrowseButton();
    final TextFieldWithHistory textFieldWithHistory = textFieldWithHistoryWithBrowseButton.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, () -> {
        List<VirtualFile> newFiles = KarmaUtil.listPossibleConfigFilesInProject(project);
        List<String> newFilePaths = ContainerUtil.map(newFiles, file -> FileUtil.toSystemDependentName(file.getPath()));
        Collections.sort(newFilePaths);
        return newFilePaths;
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, textFieldWithHistoryWithBrowseButton, KarmaBundle.message("runConfiguration.config_file.browse_dialog.title"), FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
    return textFieldWithHistoryWithBrowseButton;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) TextFieldWithHistoryWithBrowseButton(com.intellij.ui.TextFieldWithHistoryWithBrowseButton) TextFieldWithHistory(com.intellij.ui.TextFieldWithHistory) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with TextFieldWithHistory

use of com.intellij.ui.TextFieldWithHistory in project jscs-plugin by idok.

the class JscsSettingsPage method configNodeField.

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());
}
Also used : TextFieldWithHistory(com.intellij.ui.TextFieldWithHistory) ArrayList(java.util.ArrayList) List(java.util.List) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

TextFieldWithHistory (com.intellij.ui.TextFieldWithHistory)8 NotNull (org.jetbrains.annotations.NotNull)6 List (java.util.List)5 ArrayList (java.util.ArrayList)4 File (java.io.File)2 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)1 AllIcons (com.intellij.icons.AllIcons)1 IdeBundle (com.intellij.ide.IdeBundle)1 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 FileChooser (com.intellij.openapi.fileChooser.FileChooser)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 FileChooserDescriptorFactory (com.intellij.openapi.fileChooser.FileChooserDescriptorFactory)1 HelpManager (com.intellij.openapi.help.HelpManager)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 DumbService (com.intellij.openapi.project.DumbService)1 Project (com.intellij.openapi.project.Project)1 ComponentWithBrowseButton (com.intellij.openapi.ui.ComponentWithBrowseButton)1 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 Comparing (com.intellij.openapi.util.Comparing)1 Condition (com.intellij.openapi.util.Condition)1