JComponent () { final JCheckBox exprTypeCheckbox = new NonFocusableCheckBox( KotlinBundle.message("checkbox.text.specify.type.explicitly")); exprTypeCheckbox.setSelected(false); exprTypeCheckbox.addActionListener(new ActionListener() { @Override public void actionPerformed(@NotNull ActionEvent e) { runWriteActionAndRestartRefactoring( () -> { if (exprTypeCheckbox.isSelected()) { String renderedType = IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.renderType(myExprType); myDeclaration.setTypeReference(new KtPsiFactory(myProject).createType(renderedType)); } else { myDeclaration.setTypeReference(null); } } ); } }); return exprTypeCheckbox; }