Example usage for com.intellij.openapi.ui ComponentWithBrowseButton addBrowseFolderListener

List of usage examples for com.intellij.openapi.ui ComponentWithBrowseButton addBrowseFolderListener

Introduction

In this page you can find the example usage for com.intellij.openapi.ui ComponentWithBrowseButton addBrowseFolderListener.

Prototype

@Deprecated
public void addBrowseFolderListener(@Nullable Project project,
        final BrowseFolderActionListener<Comp> actionListener) 

Source Link

Usage

From source file:com.goide.runconfig.GoRunUtil.java

License:Apache License

public static void installFileChooser(@Nonnull Project project, @Nonnull 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 {/*from w  w  w. jav a  2 s .c o m*/
        //noinspection unchecked
        field.addBrowseFolderListener(project,
                new ComponentWithBrowseButton.BrowseFolderActionListener(null, null, field, project,
                        chooseDirectoryDescriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT));
    }
}

From source file:io.ballerina.plugins.idea.runconfig.BallerinaRunUtil.java

License:Open Source License

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 {/*from w  w  w.  jav a2 s  .  c  o m*/
        //noinspection unchecked
        field.addBrowseFolderListener(project,
                new ComponentWithBrowseButton.BrowseFolderActionListener(null, null, field, project,
                        chooseDirectoryDescriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT));
    }
}

From source file:io.ballerina.plugins.idea.runconfig.BallerinaRunUtil.java

License:Open Source License

private static void installWorkingDirectoryChooser(@NotNull Project project,
        @NotNull ComponentWithBrowseButton field) {
    FileChooserDescriptor chooseDirectoryDescriptor = FileChooserDescriptorFactory
            .createSingleFolderDescriptor();
    chooseDirectoryDescriptor.setShowFileSystemRoots(true);
    chooseDirectoryDescriptor.withShowHiddenFiles(false);
    if (field instanceof TextFieldWithBrowseButton) {
        ((TextFieldWithBrowseButton) field)
                .addBrowseFolderListener(new TextBrowseFolderListener(chooseDirectoryDescriptor, project));
    } else {//from w w w.ja  v a2 s .c  o m
        //noinspection unchecked
        field.addBrowseFolderListener(project,
                new ComponentWithBrowseButton.BrowseFolderActionListener(null, null, field, project,
                        chooseDirectoryDescriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT));
    }
}