JPanel () { if (TypeConversionUtil.isPrimitiveWrapper(myReturnType) && myNullability == Nullability.NULLABLE) { return null; } final TypeSelectorManagerImpl manager = new TypeSelectorManagerImpl(myProject, myReturnType, findOccurrences(), areTypesDirected()) { @Override public PsiType[] getTypesForAll(boolean direct) { final PsiType[] types = super.getTypesForAll(direct); return !isVoidReturn() ? types : ArrayUtil.prepend(PsiTypes.voidType(), types); } }; mySelector = manager.getTypeSelector(); final JComponent component = mySelector.getComponent(); if (component instanceof ComboBox) { if (isVoidReturn()) { mySelector.selectType(PsiTypes.voidType()); } final JPanel returnTypePanel = new JPanel(new BorderLayout(2, 0)); final JLabel label = new JLabel(RefactoringBundle.message("changeSignature.return.type.prompt")); returnTypePanel.add(label, BorderLayout.NORTH); returnTypePanel.add(component, BorderLayout.SOUTH); DialogUtil.registerMnemonic(label, component); ((JComboBox<?>)component).addActionListener(e -> { final PsiType selectedType = mySelector.getSelectedType(); if (myGenerateAnnotations != null) { final boolean enabled = PsiUtil.resolveClassInType(selectedType) != null; if (!enabled) { myGenerateAnnotations.setSelected(false); } myGenerateAnnotations.setEnabled(enabled); } resizeReturnCombo(component, selectedType); returnTypePanel.revalidate(); returnTypePanel.repaint(); updateSignature(); }); resizeReturnCombo(component, mySelector.getSelectedType()); return returnTypePanel; } return null; }