use of com.intellij.util.ui.FormBuilder in project intellij-community by JetBrains.
the class AnonymousToInnerDialog method createNorthPanel.
protected JComponent createNorthPanel() {
myNameField = new NameSuggestionsField(myProject);
FormBuilder formBuilder = FormBuilder.createFormBuilder().addLabeledComponent(RefactoringBundle.message("anonymousToInner.class.name.label.text"), myNameField);
if (!myShowCanBeStatic) {
myCbMakeStatic = new NonFocusableCheckBox(RefactoringBundle.message("anonymousToInner.make.class.static.checkbox.text"));
myCbMakeStatic.setSelected(true);
formBuilder.addComponent(myCbMakeStatic);
}
return formBuilder.getPanel();
}
use of com.intellij.util.ui.FormBuilder in project intellij-community by JetBrains.
the class LibraryEditorDialogBase method createNorthPanel.
@Override
protected JComponent createNorthPanel() {
String currentName = myLibraryRootsComponent.getLibraryEditor().getName();
myNameField = new JTextField(currentName);
myNameField.selectAll();
FormBuilder formBuilder = FormBuilder.createFormBuilder().addLabeledComponent("&Name:", myNameField);
addNorthComponents(formBuilder);
return formBuilder.addVerticalGap(10).getPanel();
}
use of com.intellij.util.ui.FormBuilder in project intellij-plugins by JetBrains.
the class TsLintView method createCenterComponent.
@NotNull
@Override
protected Component createCenterComponent() {
myRules = new TextFieldWithBrowseButton();
myAllowJs = new JBCheckBox();
SwingHelper.installFileCompletionAndBrowseDialog(myProject, myRules, "Select additional rules directory", FileChooserDescriptorFactory.createSingleFolderDescriptor());
final FormBuilder nodeFieldsWrapperBuilder = FormBuilder.createFormBuilder().setAlignLabelOnRight(true).setHorizontalGap(UIUtil.DEFAULT_HGAP).setVerticalGap(UIUtil.DEFAULT_VGAP).setFormLeftIndent(UIUtil.DEFAULT_HGAP).addLabeledComponent("&Node interpreter:", myNodeModuleConfigurationView.getNodeInterpreterField()).addLabeledComponent("TSLint package:", myNodeModuleConfigurationView.getPackageField());
JPanel panel = FormBuilder.createFormBuilder().setAlignLabelOnRight(true).setHorizontalGap(UIUtil.DEFAULT_HGAP).setVerticalGap(UIUtil.DEFAULT_VGAP).setFormLeftIndent(UIUtil.DEFAULT_HGAP).addComponent(nodeFieldsWrapperBuilder.getPanel()).addComponent(myConfigFileView.getComponent()).addSeparator(4).addVerticalGap(4).addLabeledComponent("Additional rules directory:", myRules).addLabeledComponent("Lint JavaScript files:", myAllowJs).getPanel();
final JPanel centerPanel = SwingHelper.wrapWithHorizontalStretch(panel);
centerPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return centerPanel;
}
use of com.intellij.util.ui.FormBuilder in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoAutoImportConfigurable method createComponent.
@Nullable
@Override
public JComponent createComponent() {
FormBuilder builder = FormBuilder.createFormBuilder();
myCbShowImportPopup = new JCheckBox(ApplicationBundle.message("checkbox.show.import.popup"));
myCbAddUnambiguousImports = new JCheckBox(ApplicationBundle.message("checkbox.add.unambiguous.imports.on.the.fly"));
builder.addComponent(myCbShowImportPopup);
builder.addComponent(myCbAddUnambiguousImports);
myExcludePackagesList = new JBList();
JComponent excludedPanel = new JPanel(new BorderLayout());
excludedPanel.add(ToolbarDecorator.createDecorator(myExcludePackagesList).setAddAction(new AddImportExclusionAction()).disableUpDownActions().createPanel(), BorderLayout.CENTER);
excludedPanel.setBorder(IdeBorderFactory.createTitledBorder(ApplicationBundle.message("exclude.from.completion.group"), true));
if (!myIsDefaultProject) {
builder.addComponent(excludedPanel);
}
JPanel result = new JPanel(new BorderLayout());
result.add(builder.getPanel(), BorderLayout.NORTH);
if (myIsDialog)
result.setPreferredSize(new Dimension(300, -1));
return result;
}
use of com.intellij.util.ui.FormBuilder in project Perl5-IDEA by Camelcade.
the class Perl5ProjectConfigurable method createComponent.
@Nullable
@Override
public JComponent createComponent() {
FormBuilder builder = FormBuilder.createFormBuilder();
builder.getPanel().setLayout(new VerticalFlowLayout());
builder.addComponent(myPerl5SdkConfigurable.createComponent());
FormBuilder versionBuilder = FormBuilder.createFormBuilder();
ComboBoxModel<PerlVersion> versionModel = new CollectionComboBoxModel<>(PerlVersion.ALL_VERSIONS);
myTargetPerlVersionComboBox = new ComboBox<>(versionModel);
myTargetPerlVersionComboBox.setRenderer(new ColoredListCellRenderer<PerlVersion>() {
@Override
protected void customizeCellRenderer(@NotNull JList<? extends PerlVersion> list, PerlVersion value, int index, boolean selected, boolean hasFocus) {
append(value.getStrictDottedVersion());
String versionDescription = PerlVersion.PERL_VERSION_DESCRIPTIONS.get(value);
if (StringUtil.isNotEmpty(versionDescription)) {
append(" (" + versionDescription + ")");
}
}
});
versionBuilder.addLabeledComponent(PerlBundle.message("perl.config.language.level"), myTargetPerlVersionComboBox);
builder.addComponent(versionBuilder.getPanel());
myLibsModel = new CollectionListModel<>();
myLibsList = new JBList<>(myLibsModel);
myLibsList.setVisibleRowCount(ourRowsCount);
myLibsList.setCellRenderer(new ColoredListCellRenderer<VirtualFile>() {
@Override
protected void customizeCellRenderer(@NotNull JList<? extends VirtualFile> list, VirtualFile value, int index, boolean selected, boolean hasFocus) {
setIcon(PerlIcons.PERL_LANGUAGE_ICON);
append(FileUtil.toSystemDependentName(value.getPath()));
}
});
builder.addLabeledComponent(PerlBundle.message("perl.settings.external.libs"), ToolbarDecorator.createDecorator(myLibsList).setAddAction(this::doAddExternalLibrary).createPanel());
simpleMainCheckbox = new JCheckBox(PerlBundle.message("perl.config.simple.main"));
builder.addComponent(simpleMainCheckbox);
autoInjectionCheckbox = new JCheckBox(PerlBundle.message("perl.config.heredoc.injections"));
builder.addComponent(autoInjectionCheckbox);
allowInjectionWithInterpolation = new JCheckBox(PerlBundle.message("perl.config.heredoc.injections.qq"));
builder.addComponent(allowInjectionWithInterpolation);
allowRegexpInjections = new JCheckBox(PerlBundle.message("perl.config.regex.injections"));
builder.addComponent(allowRegexpInjections);
allowRegexpInjections.setEnabled(false);
allowRegexpInjections.setVisible(false);
perlAnnotatorCheckBox = new JCheckBox(PerlBundle.message("perl.config.annotations.cw"));
// builder.addComponent(perlAnnotatorCheckBox);
perlCriticCheckBox = new JCheckBox(PerlBundle.message("perl.config.annotations.critic"));
builder.addComponent(perlCriticCheckBox);
enablePerlSwitchCheckbox = new JCheckBox(PerlBundle.message("perl.config.enable.switch"));
builder.addComponent(enablePerlSwitchCheckbox);
perlCriticPathInputField = new TextFieldWithBrowseButton();
perlCriticPathInputField.setEditable(false);
FileChooserDescriptor perlCriticDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || StringUtil.equals(file.getNameWithoutExtension(), PerlCriticAnnotator.PERL_CRITIC_LINUX_NAME));
}
};
// noinspection DialogTitleCapitalization
perlCriticPathInputField.addBrowseFolderListener(PerlBundle.message("perl.config.select.file.title"), PerlBundle.message("perl.config.select.critic"), // project
null, perlCriticDescriptor);
builder.addLabeledComponent(new JLabel(PerlBundle.message("perl.config.path.critic")), perlCriticPathInputField);
perlCriticArgsInputField = new RawCommandLineEditor();
builder.addComponent(copyDialogCaption(LabeledComponent.create(perlCriticArgsInputField, PerlBundle.message("perl.config.critic.cmd.arguments")), PerlBundle.message("perl.config.critic.cmd.arguments")));
perlTidyPathInputField = new TextFieldWithBrowseButton();
perlTidyPathInputField.setEditable(false);
FileChooserDescriptor perlTidyDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || StringUtil.equals(file.getNameWithoutExtension(), PerlFormatWithPerlTidyAction.PERL_TIDY_LINUX_NAME));
}
};
// noinspection DialogTitleCapitalization
perlTidyPathInputField.addBrowseFolderListener(PerlBundle.message("perl.config.select.file.title"), PerlBundle.message("perl.config.select.tidy"), // project
null, perlTidyDescriptor);
builder.addLabeledComponent(new JLabel(PerlBundle.message("perl.config.path.tidy")), perlTidyPathInputField);
perlTidyArgsInputField = new RawCommandLineEditor();
builder.addComponent(copyDialogCaption(LabeledComponent.create(perlTidyArgsInputField, PerlBundle.message("perl.config.tidy.options.label")), PerlBundle.message("perl.config.tidy.options.label.short")));
deparseArgumentsTextField = new JTextField();
builder.addLabeledComponent(PerlBundle.message("perl.config.deparse.options.label"), deparseArgumentsTextField);
selfNamesModel = new CollectionListModel<>();
JBList selfNamesList = new JBList<>(selfNamesModel);
selfNamesList.setVisibleRowCount(ourRowsCount);
builder.addLabeledComponent(new JLabel(PerlBundle.message("perl.config.self.names.label")), ToolbarDecorator.createDecorator(selfNamesList).setAddAction(anActionButton -> {
String variableName = Messages.showInputDialog(myProject, PerlBundle.message("perl.config.self.add.text"), PerlBundle.message("perl.config.self.add.title"), Messages.getQuestionIcon(), "", null);
if (StringUtil.isNotEmpty(variableName)) {
while (variableName.startsWith("$")) {
variableName = variableName.substring(1);
}
if (StringUtil.isNotEmpty(variableName) && !selfNamesModel.getItems().contains(variableName)) {
selfNamesModel.add(variableName);
}
}
}).createPanel());
JBScrollPane scrollPane = new JBScrollPane(builder.getPanel(), ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBorder(new JBEmptyBorder(JBUI.emptyInsets()));
return scrollPane;
}
Aggregations