Search in sources :

Example 1 with FileTextField

use of com.intellij.openapi.fileChooser.FileTextField in project intellij-community by JetBrains.

the class ExportToHTMLDialog method createNorthPanel.

@Override
protected JComponent createNorthPanel() {
    OptionGroup optionGroup = new OptionGroup();
    myRbCurrentFile = new JRadioButton(CodeEditorBundle.message("export.to.html.file.name.radio", (myFileName != null ? myFileName : "")));
    optionGroup.add(myRbCurrentFile);
    myRbSelectedText = new JRadioButton(CodeEditorBundle.message("export.to.html.selected.text.radio"));
    optionGroup.add(myRbSelectedText);
    myRbCurrentPackage = new JRadioButton(CodeEditorBundle.message("export.to.html.all.files.in.directory.radio", (myDirectoryName != null ? myDirectoryName : "")));
    optionGroup.add(myRbCurrentPackage);
    myCbIncludeSubpackages = new JCheckBox(CodeEditorBundle.message("export.to.html.include.subdirectories.checkbox"));
    optionGroup.add(myCbIncludeSubpackages, true);
    FileTextField field = FileChooserFactory.getInstance().createFileTextField(FileChooserDescriptorFactory.createSingleFolderDescriptor(), myDisposable);
    myTargetDirectoryField = new TextFieldWithBrowseButton(field.getField());
    LabeledComponent<TextFieldWithBrowseButton> labeledComponent = assignLabel(myTargetDirectoryField, myProject);
    optionGroup.add(labeledComponent);
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(myRbCurrentFile);
    buttonGroup.add(myRbSelectedText);
    buttonGroup.add(myRbCurrentPackage);
    ActionListener actionListener = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            myCbIncludeSubpackages.setEnabled(myRbCurrentPackage.isSelected());
        }
    };
    myRbCurrentFile.addActionListener(actionListener);
    myRbSelectedText.addActionListener(actionListener);
    myRbCurrentPackage.addActionListener(actionListener);
    return optionGroup.createPanel();
}
Also used : OptionGroup(com.intellij.ui.OptionGroup) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) FileTextField(com.intellij.openapi.fileChooser.FileTextField)

Example 2 with FileTextField

use of com.intellij.openapi.fileChooser.FileTextField in project intellij-community by JetBrains.

the class ShowUpdateInfoDialogAction method getUserText.

@NotNull
private static Pair<String, VirtualFile> getUserText(@NotNull Project project, @NotNull String title) {
    JTextArea textArea = new JTextArea(10, 50);
    UIUtil.addUndoRedoActions(textArea);
    textArea.setWrapStyleWord(true);
    textArea.setLineWrap(true);
    JPanel panel = new JPanel(new BorderLayout(0, 10));
    panel.add(ScrollPaneFactory.createScrollPane(textArea), BorderLayout.CENTER);
    Disposable disposable = Disposer.newDisposable();
    FileTextField fileField = FileChooserFactory.getInstance().createFileTextField(BrowseFilesListener.SINGLE_FILE_DESCRIPTOR, disposable);
    TextFieldWithBrowseButton fileCompo = new TextFieldWithBrowseButton(fileField.getField());
    FileChooserDescriptor fileDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
    fileCompo.addBrowseFolderListener("Patch File", "Patch file", project, fileDescriptor);
    panel.add(LabeledComponent.create(fileCompo, "Patch file:"), BorderLayout.SOUTH);
    DialogBuilder builder = new DialogBuilder(project);
    builder.addDisposable(disposable);
    builder.setCenterPanel(panel);
    builder.setPreferredFocusComponent(textArea);
    builder.setTitle(title);
    builder.addOkAction();
    builder.addCancelAction();
    return builder.showAndGet() ? Pair.create(textArea.getText(), fileField.getSelectedFile()) : Pair.empty();
}
Also used : Disposable(com.intellij.openapi.Disposable) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) FileTextField(com.intellij.openapi.fileChooser.FileTextField) DialogBuilder(com.intellij.openapi.ui.DialogBuilder) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with FileTextField

use of com.intellij.openapi.fileChooser.FileTextField in project kotlin by JetBrains.

the class ChoosePathDialog method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setGap(3);
    JPanel panel = new JPanel(verticalLayout);
    if (description != null) {
        panel.add(new JLabel(description));
    }
    FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    FileTextField field = FileChooserFactory.getInstance().createFileTextField(descriptor, myDisposable);
    field.getField().setColumns(25);
    myPathField = new TextFieldWithBrowseButton(field.getField());
    myPathField.addBrowseFolderListener("Choose Destination Folder", "Choose folder", myProject, descriptor);
    myPathField.setText(defaultPath);
    panel.add(myPathField);
    return panel;
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) VerticalLayout(org.jdesktop.swingx.VerticalLayout) FileTextField(com.intellij.openapi.fileChooser.FileTextField)

Example 4 with FileTextField

use of com.intellij.openapi.fileChooser.FileTextField in project intellij-community by JetBrains.

the class MapExternalResourceDialog method createUIComponents.

private void createUIComponents() {
    FileTextField field = FileChooserFactory.getInstance().createFileTextField(FILE_CHOOSER_DESCRIPTOR, getDisposable());
    myFileTextField = new TextFieldWithBrowseButton(field.getField());
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) FileTextField(com.intellij.openapi.fileChooser.FileTextField)

Aggregations

FileTextField (com.intellij.openapi.fileChooser.FileTextField)4 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)4 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)2 Disposable (com.intellij.openapi.Disposable)1 DialogBuilder (com.intellij.openapi.ui.DialogBuilder)1 OptionGroup (com.intellij.ui.OptionGroup)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 VerticalLayout (org.jdesktop.swingx.VerticalLayout)1 NotNull (org.jetbrains.annotations.NotNull)1