Example usage for com.intellij.openapi.ui TextFieldWithBrowseButton TextFieldWithBrowseButton

List of usage examples for com.intellij.openapi.ui TextFieldWithBrowseButton TextFieldWithBrowseButton

Introduction

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

Prototype

public TextFieldWithBrowseButton(ActionListener browseActionListener) 

Source Link

Usage

From source file:org.twodividedbyzero.idea.findbugs.gui.export.ExportBugCollectionDialog.java

License:Open Source License

@Nullable
@Override/*  w  w w . ja  v a 2s .co  m*/
protected JComponent createCenterPanel() {

    final FileTextField field = FileChooserFactory.getInstance()
            .createFileTextField(FileChooserDescriptorFactory.createSingleFolderDescriptor(), myDisposable);
    targetDirectoryField = new TextFieldWithBrowseButton(field.getField());
    targetDirectoryField.addBrowseFolderListener(
            StringUtil.capitalizeWords(ResourcesLoader.getString("export.directory.choose.title"), true),
            ResourcesLoader.getString("export.directory.choose.text"), project,
            FileChooserDescriptorFactory.createSingleFolderDescriptor());

    final LabeledComponent<TextFieldWithBrowseButton> targetDirectoryLabeled = new LabeledComponent<TextFieldWithBrowseButton>();
    targetDirectoryLabeled.setText(ResourcesLoader.getString("export.directory.label"));
    targetDirectoryLabeled.setComponent(targetDirectoryField);

    final ActionListener updateControlsAction = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateControls();
        }
    };

    htmlCheckbox = new JBCheckBox(ResourcesLoader.getString("export.options.html"));
    htmlCheckbox.addActionListener(updateControlsAction);

    xmlCheckbox = new JBCheckBox(ResourcesLoader.getString("export.options.xml"));
    xmlCheckbox.addActionListener(updateControlsAction);

    createSubDirectoryCheckbox = new JBCheckBox(ResourcesLoader.getString("export.options.createSubDir"));
    createSubDirectoryCheckbox.addActionListener(updateControlsAction);

    openInBrowserCheckbox = new JBCheckBox(ResourcesLoader.getString("export.options.openInBrowser"));
    openInBrowserCheckbox.addActionListener(updateControlsAction);

    final OptionGroup optionGroup = new OptionGroup(ResourcesLoader.getString("export.options.title"));
    optionGroup.add(htmlCheckbox);
    optionGroup.add(xmlCheckbox);
    optionGroup.add(createSubDirectoryCheckbox);
    optionGroup.add(openInBrowserCheckbox);

    final JPanel pane = new JPanel(new BorderLayout());
    pane.add(targetDirectoryLabeled, BorderLayout.NORTH);
    pane.add(optionGroup.createPanel());
    pane.setPreferredSize(new JBDimension(400, 0));
    return pane;
}

From source file:org.twodividedbyzero.idea.findbugs.gui.settings.ShareTab.java

License:Open Source License

ShareTab(@NotNull final Project project, @Nullable final Module module) {
    super(new VerticalFlowLayout(HAlignment.Left, VAlignment.Top, 0, 0, true, false));
    this.project = project;
    importFilePathKey = module != null ? module.getName() : WorkspaceSettings.PROJECT_IMPORT_FILE_PATH_KEY;

    description = new JLabel("<html>" + ResourcesLoader.getString("share.description"));
    description.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
    description.setIcon(MessageType.INFO.getDefaultIcon());
    description.setDisabledIcon(MessageType.INFO.getDefaultIcon());

    final String url = ResourcesLoader.getString("share.url");
    link = new HyperlinkLabel(); // LATER: HotspotPainter (Search) does not work with HyperlinkLabel
    link.setHyperlinkText(url);//from  w  w  w.  java  2 s  . c o m
    link.setHyperlinkTarget(url);

    final JPanel linkPane = new JPanel(
            new FlowLayout(FlowLayout.LEFT, MessageType.INFO.getDefaultIcon().getIconWidth() + 5, 0));
    linkPane.add(link);

    final FileChooserDescriptor descriptor = FileChooserDescriptorFactory
            .createSingleFileDescriptor(XmlFileType.INSTANCE);
    final FileTextField field = FileChooserFactory.getInstance().createFileTextField(descriptor, this);
    final TextFieldWithBrowseButton importPath = new TextFieldWithBrowseButton(field.getField());
    importPath.addBrowseFolderListener(ResourcesLoader.getString("settings.choose.title"),
            ResourcesLoader.getString("settings.choose.description"), null, descriptor);
    importPathLabel = new LabeledComponent<TextFieldWithBrowseButton>();
    importPathLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    importPathLabel.setComponent(importPath);
    importPathLabel.setLabelLocation(BorderLayout.WEST);
    importPathLabel.setText(ResourcesLoader.getString("share.file.title"));

    add(description);
    add(linkPane);
    add(importPathLabel);
}