use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.
the class CustomizableActionsPanel method createBrowseField.
private static TextFieldWithBrowseButton createBrowseField() {
TextFieldWithBrowseButton textField = new TextFieldWithBrowseButton();
textField.setPreferredSize(new Dimension(200, textField.getPreferredSize().height));
textField.setMinimumSize(new Dimension(200, textField.getPreferredSize().height));
final FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileSelectable(VirtualFile file) {
//noinspection HardCodedStringLiteral
return file.getName().endsWith(".png");
}
};
textField.addBrowseFolderListener(IdeBundle.message("title.browse.icon"), IdeBundle.message("prompt.browse.icon.for.selected.action"), null, fileChooserDescriptor);
InsertPathAction.addTo(textField.getTextField(), fileChooserDescriptor);
return textField;
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.
the class CreatePatchConfigurationPanel method initMainPanel.
private void initMainPanel() {
myFileNameField = new TextFieldWithBrowseButton();
myBasePathField = new TextFieldWithBrowseButton();
myReversePatchCheckbox = new JCheckBox(VcsBundle.message("create.patch.reverse.checkbox"));
myEncoding = new ComboBox<>();
myWarningLabel = new JLabel();
myMainPanel = FormBuilder.createFormBuilder().addLabeledComponent(VcsBundle.message("create.patch.file.path"), myFileNameField).addLabeledComponent("&Base path:", myBasePathField).addComponent(myReversePatchCheckbox).addLabeledComponent(VcsBundle.message("create.patch.encoding"), myEncoding).addComponent(myWarningLabel).getPanel();
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.
the class JarApplicationConfigurable method createUIComponents.
private void createUIComponents() {
myJarPathComponent = new LabeledComponent<>();
TextFieldWithBrowseButton textFieldWithBrowseButton = new TextFieldWithBrowseButton();
textFieldWithBrowseButton.addBrowseFolderListener("Choose JAR File", null, myProject, new FileChooserDescriptor(false, false, true, true, false, false));
myJarPathComponent.setComponent(textFieldWithBrowseButton);
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project android by JetBrains.
the class ChooseGradleHomeDialogFixture method requireValidationError.
@NotNull
public ChooseGradleHomeDialogFixture requireValidationError(@NotNull final String errorText) {
Wait.seconds(1).expecting(String.format("error message '%1$s' to appear", errorText)).until(() -> {
ComponentFinder finder = robot().finder();
Collection<JPanel> errorTextPanels = finder.findAll(target(), new GenericTypeMatcher<JPanel>(JPanel.class) {
@Override
protected boolean isMatching(@NotNull JPanel panel) {
// ErrorText is a private inner class
return panel.isShowing() && panel.getClass().getSimpleName().endsWith("ErrorText");
}
});
if (errorTextPanels.size() != 1) {
return false;
}
JPanel errorTextPanel = getFirstItem(errorTextPanels);
Collection<JLabel> labels = finder.findAll(errorTextPanel, JLabelMatcher.withText(Pattern.compile(".*" + errorText + ".*")));
return labels.size() == 1;
});
// The label with the error message above also has HTML formatting, which makes the check for error not 100% reliable.
// To ensure that the shown error message is what we expect, we store the message as a client property in the dialog's
// TextFieldWithBrowseButton component.
TextFieldWithBrowseButton field = robot().finder().findByType(target(), TextFieldWithBrowseButton.class);
Object actual = field.getClientProperty(VALIDATION_MESSAGE_CLIENT_PROPERTY);
assertEquals("Error message", errorText, actual);
return this;
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-plugins by JetBrains.
the class AddAdapterSupportDialog method createSelectDirectoryPanel.
@NotNull
private JPanel createSelectDirectoryPanel(@NotNull Project project, @NotNull JTextField directoryTextField) {
FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
String adapterName = getAssertFrameworkAdapterName();
String title = "Select a directory for " + adapterName + " files";
String description = adapterName + " source files will be copied to the selected directory";
TextFieldWithBrowseButton directoryTextFieldWithBrowseButton = new TextFieldWithBrowseButton(directoryTextField);
directoryTextFieldWithBrowseButton.addBrowseFolderListener(title, description, project, fileChooserDescriptor);
Dimension oldDimension = directoryTextFieldWithBrowseButton.getPreferredSize();
directoryTextFieldWithBrowseButton.setMaximumSize(oldDimension);
JPanel panel = new JPanel(new BorderLayout(0, 2));
panel.add(new JLabel("Copy these files to directory:"), BorderLayout.NORTH);
panel.add(directoryTextFieldWithBrowseButton, BorderLayout.CENTER);
return SwingHelper.wrapWithHorizontalStretch(panel);
}
Aggregations