void () { final Insets insets = JBUI.insets(2, 4, 4, 2); if(myMustEnterName || Arrays.asList(myUnsetAttributes).contains(FileTemplate.ATTRIBUTE_NAME)){ final JLabel filenameLabel = new JLabel(IdeBundle.message("label.file.name")); myAttrPanel.add(filenameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, insets, 0, 0)); myFilenameField = new JTextField(20); // if default settings specified if (myAttributesDefaults != null) { final String fileName = myAttributesDefaults.getDefaultFileName(); // if default file name specified if (fileName != null) { // set predefined file name value myFilenameField.setText(fileName); final TextRange selectionRange; // select range from default attributes or select file name without extension if (myAttributesDefaults.getDefaultFileNameSelection() != null) { selectionRange = myAttributesDefaults.getDefaultFileNameSelection(); } else { final int dot = fileName.indexOf('.'); if (dot > 0) { selectionRange = new TextRange(0, dot); } else { selectionRange = null; } } // set selection in editor if (selectionRange != null) { setPredefinedSelectionFor(myFilenameField, selectionRange); } } } myAttrPanel.add(myFilenameField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); } Map<String, @Nls String> attributeVisibleNames = null; if (myAttributesDefaults != null) { attributeVisibleNames = myAttributesDefaults.getAttributeVisibleNames(); } int lastRow = 2; for (@NlsSafe String attribute : myUnsetAttributes) { if (attribute.equals(FileTemplate.ATTRIBUTE_NAME)) { // already asked above continue; } String visibleName = attribute.replace('_', ' '); if (attributeVisibleNames != null && attributeVisibleNames.containsKey(attribute)) { visibleName = attributeVisibleNames.get(attribute); } final JLabel label = new JLabel(visibleName + ":"); final JTextField field = new JTextField(); field.setColumns(30); if (myAttributesDefaults != null) { final String defaultValue = myAttributesDefaults.getDefaultValueFor(attribute); final TextRange selectionRange = myAttributesDefaults.getRangeFor(attribute); if (defaultValue != null) { field.setText(defaultValue); // set default selection if (selectionRange != null) { setPredefinedSelectionFor(field, selectionRange); } } } myAttributes.add(Pair.create(attribute, field)); myAttrPanel.add(label, new GridBagConstraints(0, lastRow, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, insets, 0, 0)); myAttrPanel.add(field, new GridBagConstraints(1, lastRow, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); lastRow++; } myAttrPanel.repaint(); myAttrPanel.revalidate(); myMainPanel.revalidate(); }