use of com.intellij.openapi.fileChooser.FileElement in project Perl5-IDEA by Camelcade.
the class PerlContentEntriesTreeEditor method getSelectedFiles.
@NotNull
VirtualFile[] getSelectedFiles() {
final TreePath[] selectionPaths = myTree.getSelectionPaths();
if (selectionPaths == null) {
return VirtualFile.EMPTY_ARRAY;
}
final List<VirtualFile> selected = new ArrayList<>();
for (TreePath treePath : selectionPaths) {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent();
final Object nodeDescriptor = node.getUserObject();
if (!(nodeDescriptor instanceof FileNodeDescriptor)) {
return VirtualFile.EMPTY_ARRAY;
}
final FileElement fileElement = ((FileNodeDescriptor) nodeDescriptor).getElement();
final VirtualFile file = fileElement.getFile();
if (file != null) {
selected.add(file);
}
}
return selected.toArray(new VirtualFile[selected.size()]);
}
Aggregations