List<SourceItemNode> () { final List<SourceItemNode> nodes = new ArrayList<>(); for (DefaultMutableTreeNode treeNode : getSelectedTreeNodes()) { final Object userObject = treeNode.getUserObject(); if (userObject instanceof SourceItemNode) { nodes.add((SourceItemNode)userObject); } } return nodes; }