void () { JPanel panel = new JPanel(new GridBagLayout()); GridBag gb = new GridBag().setDefaultInsets(4, 4, 4, 4).setDefaultWeightY(1).setDefaultFill(GridBagConstraints.BOTH); JPanel editorPanel = new JPanel(new BorderLayout(4, 4)); editorPanel.setPreferredSize(JBUI.size(250, 100)); editorPanel.setMinimumSize(editorPanel.getPreferredSize()); editorPanel.add(myTemplateEditor.getComponent(), BorderLayout.CENTER); JLabel templateTextLabel = new JLabel(CodeInsightBundle.message("dialog.edit.template.template.text.title")); templateTextLabel.setLabelFor(myTemplateEditor.getContentComponent()); editorPanel.add(templateTextLabel, BorderLayout.NORTH); editorPanel.setFocusable(false); panel.add(editorPanel, gb.nextLine().next().weighty(1).weightx(1).coverColumn(2)); myEditVariablesButton = new JButton(CodeInsightBundle.message("dialog.edit.template.button.edit.variables")); myEditVariablesButton.setDefaultCapable(false); myEditVariablesButton.setMaximumSize(myEditVariablesButton.getPreferredSize()); panel.add(myEditVariablesButton, gb.next().weighty(0)); myTemplateOptionsPanel = new JPanel(new BorderLayout()); myTemplateOptionsPanel.add(createTemplateOptionsPanel()); panel.add(myTemplateOptionsPanel, gb.nextLine().next().next().coverColumn(2).weighty(1)); panel.add(createShortContextPanel(), gb.nextLine().next().weighty(0).fillCellNone().anchor(GridBagConstraints.WEST)); myTemplateEditor.getDocument().addDocumentListener(new DocumentListener() { @Override public void documentChanged(@NotNull DocumentEvent e) { validateEditVariablesButton(); myTemplate.setString(myTemplateEditor.getDocument().getText()); applyVariables(updateVariablesByTemplateText()); myNodeChanged.run(); } }); myEditVariablesButton.addActionListener( new ActionListener(){ @Override public void actionPerformed(@NotNull ActionEvent e) { editVariables(); } } ); add(createNorthPanel(), BorderLayout.NORTH); add(panel, BorderLayout.CENTER); }