Search in sources :

Example 11 with FormBuilder

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();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) NonFocusableCheckBox(com.intellij.ui.NonFocusableCheckBox) NameSuggestionsField(com.intellij.refactoring.ui.NameSuggestionsField)

Example 12 with FormBuilder

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();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder)

Example 13 with FormBuilder

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;
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) JBCheckBox(com.intellij.ui.components.JBCheckBox) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with FormBuilder

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;
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) JBList(com.intellij.ui.components.JBList) Nullable(org.jetbrains.annotations.Nullable)

Example 15 with FormBuilder

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;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) JBEmptyBorder(com.intellij.util.ui.JBEmptyBorder) PerlVersion(com.perl5.lang.perl.internals.PerlVersion) FormBuilder(com.intellij.util.ui.FormBuilder) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) JBList(com.intellij.ui.components.JBList) JBScrollPane(com.intellij.ui.components.JBScrollPane) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FormBuilder (com.intellij.util.ui.FormBuilder)19 Nullable (org.jetbrains.annotations.Nullable)10 VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)4 JBLabel (com.intellij.ui.components.JBLabel)3 JBList (com.intellij.ui.components.JBList)3 NotNull (org.jetbrains.annotations.NotNull)3 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)2 Project (com.intellij.openapi.project.Project)2 ComboBox (com.intellij.openapi.ui.ComboBox)2 Messages (com.intellij.openapi.ui.Messages)2 StringUtil (com.intellij.openapi.util.text.StringUtil)2 TableUtil (com.intellij.ui.TableUtil)2 ToolbarDecorator (com.intellij.ui.ToolbarDecorator)2 JBScrollPane (com.intellij.ui.components.JBScrollPane)2 JBTextField (com.intellij.ui.components.JBTextField)2 JBTable (com.intellij.ui.table.JBTable)2 ColumnInfo (com.intellij.util.ui.ColumnInfo)2 JBUI (com.intellij.util.ui.JBUI)2 ListTableModel (com.intellij.util.ui.ListTableModel)2 VariableDescription (com.perl5.lang.mason2.idea.configuration.VariableDescription)2