void () { myPanel.setVisible(myIsVisible); if (!myIsVisible) return; mySelectParent.setIcon(AllIcons.Nodes.Module); mySelectParent.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myParent = doSelectProject(myParent); myConsumer.accept(myParent); } }); if (myParent == null) { myParent = findPotentialParentProject(myProjectOrNull); } }