void () { super.init(); ExtractableCodeDescriptor extractableCodeDescriptor = originalDescriptor.getDescriptor(); functionNameField = new NameSuggestionsField( ArrayUtil.toStringArray(extractableCodeDescriptor.getSuggestedNames()), project, KotlinFileType.INSTANCE ); functionNameField.addDataChangedListener(() -> update()); functionNamePanel.add(functionNameField, BorderLayout.CENTER); functionNameLabel.setLabelFor(functionNameField); List<KotlinType> possibleReturnTypes = ExtractableCodeDescriptorKt.getPossibleReturnTypes(extractableCodeDescriptor.getControlFlow()); if (possibleReturnTypes.size() > 1) { DefaultComboBoxModel<KotlinType> returnTypeBoxModel = new DefaultComboBoxModel<>(possibleReturnTypes.toArray(new KotlinType[0])); returnTypeBox.setModel(returnTypeBoxModel); returnTypeBox.setRenderer( new DefaultListCellRenderer() { @NotNull @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus ) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); @NlsSafe String text = IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.renderType((KotlinType) value); setText(text); return this; } } ); returnTypeBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(@NotNull ItemEvent e) { update(); } } ); } else { returnTypePanel.getParent().remove(returnTypePanel); } visibilityBox.setModel(new DefaultComboBoxModel(KtTokens.VISIBILITY_MODIFIERS.getTypes())); boolean enableVisibility = isVisibilitySectionAvailable(); visibilityBox.setEnabled(enableVisibility); if (enableVisibility) { KtModifierKeywordToken defaultVisibility = extractableCodeDescriptor.getVisibility(); visibilityBox.setSelectedItem(defaultVisibility); } visibilityBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(@NotNull ItemEvent e) { update(); } } ); parameterTablePanel = new ExtractFunctionParameterTablePanel() { @Override protected void updateSignature() { KotlinExtractFunctionDialog.this.update(); } @Override protected void onEnterAction() { doOKAction(); } @Override protected void onCancelAction() { doCancelAction(); } }; parameterTablePanel.init(extractableCodeDescriptor.getReceiverParameter(), extractableCodeDescriptor.getParameters()); inputParametersPanel.setText(KotlinBundle.message("text.parameters")); inputParametersPanel.setLabelFor(parameterTablePanel.getTable()); inputParametersPanel.add(parameterTablePanel); }