void (TreeSelectionEvent e) { final TreePath path = myTree.getSelectionPath(); if (path != null) { Object node = path.getLastPathComponent(); if (node instanceof MyModuleNode) { node = ((MyModuleNode)node).getParent(); } if (node instanceof ProfileNode) { final ProcessorConfigProfile nodeProfile = ((ProfileNode)node).myProfile; final ProcessorConfigProfile selectedProfile = mySelectedProfile; if (nodeProfile != selectedProfile) { if (selectedProfile != null) { myProfilePanel.saveTo(selectedProfile); } mySelectedProfile = nodeProfile; myProfilePanel.setProfile(nodeProfile); } } } }