use of com.intellij.ui.CheckedTreeNode in project intellij-plugins by JetBrains.
the class StrutsFilesTree method updateFileSet.
public void updateFileSet(final StrutsFileSet fileSet) {
final Set<VirtualFile> configured = new HashSet<>();
TreeUtil.traverse((TreeNode) getModel().getRoot(), node -> {
final CheckedTreeNode checkedTreeNode = (CheckedTreeNode) node;
if (!checkedTreeNode.isChecked()) {
return true;
}
final Object object = checkedTreeNode.getUserObject();
VirtualFile virtualFile = null;
if (object instanceof XmlFile) {
virtualFile = ((XmlFile) object).getVirtualFile();
} else if (object instanceof VirtualFile) {
virtualFile = (VirtualFile) object;
}
if (virtualFile != null) {
if (!fileSet.hasFile(virtualFile)) {
fileSet.addFile(virtualFile);
}
configured.add(virtualFile);
}
return true;
});
for (Iterator<VirtualFilePointer> i = fileSet.getFiles().iterator(); i.hasNext(); ) {
final VirtualFilePointer pointer = i.next();
final VirtualFile file = pointer.getFile();
if (file == null || !configured.contains(file)) {
i.remove();
}
}
}
Aggregations