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;
}
}
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();
}
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();
}
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();
}
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;
}
Aggregations