void () { myHavePackages = false; for (PsiElement psiElement : myElementsToMove) { if (!(psiElement instanceof PsiClass)) { myHavePackages = true; break; } } CardLayout cardLayout = (CardLayout)myCardPanel.getLayout(); cardLayout.show(myCardPanel, myHavePackages ? "Package" : "Class"); }