Search in sources :

Example 6 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project azure-tools-for-java by Microsoft.

the class FunctionsModuleInfoStep method _init.

@Override
public void _init() {
    panel = new JPanel(new BorderLayout());
    final String groupId = context.getUserData(AzureFunctionsConstants.WIZARD_GROUPID_KEY);
    final String artifactId = context.getUserData(AzureFunctionsConstants.WIZARD_ARTIFACTID_KEY);
    final String version = context.getUserData(AzureFunctionsConstants.WIZARD_VERSION_KEY);
    final String packageName = context.getUserData(AzureFunctionsConstants.WIZARD_PACKAGE_NAME_KEY);
    try {
        final FormBuilder formBuilder = new FormBuilder();
        final CollectionComboBoxModel<String> toolModel = new CollectionComboBoxModel<>(Arrays.asList(MAVEN_TOOL, GRADLE_TOOL));
        toolComboBox = new ComboBox<>(toolModel);
        formBuilder.addLabeledComponent("Tool:", toolComboBox);
        groupIdField = new JBTextField(getCurrentOrDefaultValue(groupId, "com.example"));
        formBuilder.addLabeledComponent("Group:", groupIdField);
        artifactIdField = new JBTextField(getCurrentOrDefaultValue(artifactId, "azure-function-examples"));
        formBuilder.addLabeledComponent("Artifact:", artifactIdField);
        versionField = new JBTextField(getCurrentOrDefaultValue(version, "1.0.0-SNAPSHOT"));
        formBuilder.addLabeledComponent("Version:", versionField);
        packageNameField = new JBTextField(getCurrentOrDefaultValue(packageName, "org.example.functions"));
        formBuilder.addLabeledComponent("Package name:", packageNameField);
        panel.add(ScrollPaneFactory.createScrollPane(formBuilder.getPanel(), true), "North");
    } catch (final RuntimeException e) {
        LOGGER.error(e.getLocalizedMessage(), e);
        throw e;
    }
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) CollectionComboBoxModel(com.intellij.ui.CollectionComboBoxModel) JBTextField(com.intellij.ui.components.JBTextField)

Example 7 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project intellij-community by JetBrains.

the class CopyFilesOrDirectoriesDialog method createNorthPanel.

@Override
protected JComponent createNorthPanel() {
    myInformationLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true);
    final FormBuilder formBuilder = FormBuilder.createFormBuilder().addComponent(myInformationLabel).addVerticalGap(UIUtil.LARGE_VGAP - UIUtil.DEFAULT_VGAP);
    DocumentListener documentListener = new DocumentAdapter() {

        @Override
        public void textChanged(DocumentEvent event) {
            validateOKButton();
        }
    };
    if (myShowNewNameField) {
        myNewNameField = new JBTextField();
        myNewNameField.getDocument().addDocumentListener(documentListener);
        formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.new.name.label"), myNewNameField);
    }
    if (myShowDirectoryField) {
        myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton();
        myTargetDirectoryField.setTextFieldPreferredWidth(MAX_PATH_LENGTH);
        final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS);
        if (recentEntries != null) {
            getTargetDirectoryComponent().setHistory(recentEntries);
        }
        final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
        myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"), RefactoringBundle.message("the.file.will.be.copied.to.this.directory"), myProject, descriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
        getTargetDirectoryComponent().addDocumentListener(new DocumentAdapter() {

            @Override
            protected void textChanged(DocumentEvent e) {
                validateOKButton();
            }
        });
        formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.to.directory.label"), myTargetDirectoryField);
        String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
        formBuilder.addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText));
    }
    final JPanel wrapper = new JPanel(new BorderLayout());
    wrapper.add(myOpenFilesInEditor, BorderLayout.EAST);
    formBuilder.addComponent(wrapper);
    return formBuilder.getPanel();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) DocumentListener(javax.swing.event.DocumentListener) TextFieldWithHistoryWithBrowseButton(com.intellij.ui.TextFieldWithHistoryWithBrowseButton) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) DocumentAdapter(com.intellij.ui.DocumentAdapter) JBTextField(com.intellij.ui.components.JBTextField) DocumentEvent(javax.swing.event.DocumentEvent)

Example 8 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project intellij-community by JetBrains.

the class GenericRepositoryEditor method createCustomPanel.

@Nullable
@Override
protected JComponent createCustomPanel() {
    myField2Variable = new IdentityHashMap<>();
    FormBuilder builder = FormBuilder.createFormBuilder();
    for (final TemplateVariable variable : myRepository.getTemplateVariables()) {
        if (variable.isShownOnFirstTab()) {
            JTextField field = variable.isHidden() ? new JPasswordField(variable.getValue()) : new JTextField(variable.getValue());
            myField2Variable.put(field, variable);
            installListener(field);
            JBLabel label = new JBLabel(prettifyVariableName(variable.getName()) + ":", SwingConstants.RIGHT);
            label.setAnchor(getAnchor());
            builder.addLabeledComponent(label, field);
        }
    }
    return builder.getPanel();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) JBLabel(com.intellij.ui.components.JBLabel) Nullable(org.jetbrains.annotations.Nullable)

Example 9 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project intellij-community by JetBrains.

the class RegExResponseHandler method getConfigurationComponent.

@NotNull
@Override
public JComponent getConfigurationComponent(@NotNull Project project) {
    FormBuilder builder = FormBuilder.createFormBuilder();
    final EditorTextField taskPatternText;
    taskPatternText = new LanguageTextField(RegExpLanguage.INSTANCE, project, myTaskRegex, false);
    taskPatternText.addDocumentListener(new DocumentAdapter() {

        @Override
        public void documentChanged(DocumentEvent e) {
            myTaskRegex = taskPatternText.getText();
        }
    });
    String tooltip = "<html>Task pattern should be a regexp with two matching groups: ({id}.+?) and ({summary}.+?)";
    builder.addLabeledComponent("Task Pattern:", new JBScrollPane(taskPatternText)).addTooltip(tooltip);
    return builder.getPanel();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) EditorTextField(com.intellij.ui.EditorTextField) DocumentAdapter(com.intellij.openapi.editor.event.DocumentAdapter) DocumentEvent(com.intellij.openapi.editor.event.DocumentEvent) JBScrollPane(com.intellij.ui.components.JBScrollPane) LanguageTextField(com.intellij.ui.LanguageTextField) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project intellij-community by JetBrains.

the class ParametersPerConstructorInspection method createOptionsPanel.

@Override
public JComponent createOptionsPanel() {
    final JFormattedTextField valueField = prepareNumberEditor("m_limit");
    final JComboBox comboBox = new ComboBox(new Object[] { Scope.NONE, Scope.PRIVATE, Scope.PACKAGE_LOCAL, Scope.PROTECTED });
    comboBox.setRenderer(new ListCellRendererWrapper() {

        @Override
        public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
            if (value instanceof Scope)
                setText(((Scope) value).getText());
        }
    });
    comboBox.setSelectedItem(ignoreScope);
    comboBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            ignoreScope = (Scope) comboBox.getSelectedItem();
        }
    });
    comboBox.setPrototypeDisplayValue(Scope.PROTECTED);
    final FormBuilder formBuilder = FormBuilder.createFormBuilder();
    formBuilder.addLabeledComponent(getConfigurationLabel(), valueField);
    formBuilder.addLabeledComponent(InspectionGadgetsBundle.message("constructor.visibility.option"), comboBox);
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(formBuilder.getPanel(), BorderLayout.NORTH);
    return panel;
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) ComboBox(com.intellij.openapi.ui.ComboBox) ActionEvent(java.awt.event.ActionEvent) ListCellRendererWrapper(com.intellij.ui.ListCellRendererWrapper) ActionListener(java.awt.event.ActionListener)

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