Java Code Examples for com.intellij.openapi.vfs.VirtualFile#EMPTY_ARRAY
The following examples show how to use
com.intellij.openapi.vfs.VirtualFile#EMPTY_ARRAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentEntryEditingAction.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull protected final VirtualFile[] getSelectedFiles() { final TreePath[] selectionPaths = myTree.getSelectionPaths(); if (selectionPaths == null) { return VirtualFile.EMPTY_ARRAY; } final List<VirtualFile> selected = new ArrayList<VirtualFile>(); 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()]); }
Example 2
Source File: FileChooserDialogImpl.java From consulo with Apache License 2.0 | 6 votes |
private VirtualFile[] getSelectedFilesInt() { if (myTreeIsUpdating || !myUiUpdater.isEmpty()) { if (isTextFieldActive() && !StringUtil.isEmpty(myPathTextField.getTextFieldText())) { LookupFile toFind = myPathTextField.getFile(); if (toFind instanceof LocalFsFinder.VfsFile && toFind.exists()) { VirtualFile file = ((LocalFsFinder.VfsFile)toFind).getFile(); if (file != null) { return new VirtualFile[]{file}; } } } return VirtualFile.EMPTY_ARRAY; } return myFileSystemTree.getSelectedFiles(); }
Example 3
Source File: LibraryGroupNode.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull static VirtualFile[] getLibraryRoots(@Nonnull LibraryOrderEntry orderEntry) { Library library = orderEntry.getLibrary(); if (library == null) return VirtualFile.EMPTY_ARRAY; OrderRootType[] rootTypes = LibraryType.getDefaultExternalRootTypes(); if (library instanceof LibraryEx) { if (((LibraryEx)library).isDisposed()) return VirtualFile.EMPTY_ARRAY; PersistentLibraryKind<?> libKind = ((LibraryEx)library).getKind(); if (libKind != null) { rootTypes = LibraryType.findByKind(libKind).getExternalRootTypes(); } } final ArrayList<VirtualFile> files = new ArrayList<VirtualFile>(); for (OrderRootType rootType : rootTypes) { files.addAll(Arrays.asList(library.getFiles(rootType))); } return VfsUtilCore.toVirtualFileArray(files); }
Example 4
Source File: BackgroundTaskByVfsChangeTaskImpl.java From consulo with Apache License 2.0 | 6 votes |
@RequiredReadAction @Nonnull @Override public VirtualFile[] getGeneratedFiles() { String[] generatedFilePaths = getGeneratedFilePaths(); if (generatedFilePaths.length == 0) { return VirtualFile.EMPTY_ARRAY; } List<VirtualFile> list = new ArrayList<>(); for (String generatedFilePath : generatedFilePaths) { VirtualFile fileByPath = LocalFileSystem.getInstance().findFileByPath(generatedFilePath); if (fileByPath != null) { list.add(fileByPath); } } return VfsUtilCore.toVirtualFileArray(list); }
Example 5
Source File: EditSourceInNewWindowAction.java From consulo with Apache License 2.0 | 5 votes |
protected VirtualFile[] getVirtualFiles(AnActionEvent e) { final VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY); if (files != null) return files; final VirtualFile file = e.getData(PlatformDataKeys.VIRTUAL_FILE); return file == null ? VirtualFile.EMPTY_ARRAY : new VirtualFile[]{file}; }
Example 6
Source File: HaxeLibraryRootsComponentDescriptor.java From intellij-haxe with Apache License 2.0 | 5 votes |
@Override public VirtualFile[] selectFiles(@NotNull JComponent parent, @Nullable VirtualFile initialSelection, @Nullable Module contextModule, @NotNull LibraryEditor libraryEditor) { final VirtualFile vFile = Util.showSpecifyJavadocUrlDialog(parent); if (vFile != null) { return new VirtualFile[]{vFile}; } return VirtualFile.EMPTY_ARRAY; }
Example 7
Source File: FileSystemTreeImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nonnull public VirtualFile[] getSelectedFiles() { final TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) return VirtualFile.EMPTY_ARRAY; final List<VirtualFile> files = new ArrayList<>(); for (TreePath path : paths) { VirtualFile file = getVirtualFile(path); if (file != null && file.isValid()) { files.add(file); } } return VfsUtilCore.toVirtualFileArray(files); }
Example 8
Source File: FileIncludeManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
private VirtualFile[] getFiles(@Nonnull VirtualFile file, boolean compileTimeOnly) { PsiFile psiFile = myPsiManager.findFile(file); if (psiFile == null) { return VirtualFile.EMPTY_ARRAY; } if (compileTimeOnly) { return CachedValuesManager.getManager(myProject).getParameterizedCachedValue(psiFile, COMPILE_TIME_KEY, COMPILE_TIME_PROVIDER, false, psiFile); } return CachedValuesManager.getManager(myProject).getParameterizedCachedValue(psiFile, RUNTIME_KEY, RUNTIME_PROVIDER, false, psiFile); }
Example 9
Source File: DefaultLibraryRootsComponentDescriptor.java From consulo with Apache License 2.0 | 5 votes |
@Override public VirtualFile[] selectFiles(@Nonnull JComponent parent, @Nullable VirtualFile initialSelection, @Nullable Module contextModule, @Nonnull LibraryEditor libraryEditor) { final VirtualFile vFile = Util.showSpecifyJavadocUrlDialog(parent); if (vFile != null) { return new VirtualFile[]{vFile}; } return VirtualFile.EMPTY_ARRAY; }
Example 10
Source File: LibraryPresentationManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static VirtualFile[] getLibraryFiles(@Nonnull Library library, @Nullable StructureConfigurableContext context) { if (((LibraryEx)library).isDisposed()) { return VirtualFile.EMPTY_ARRAY; } return context != null ? context.getLibraryFiles(library, BinariesOrderRootType.getInstance()) : library.getFiles(BinariesOrderRootType.getInstance()); }
Example 11
Source File: ModuleSourceOrderEntryImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nonnull public VirtualFile[] getFiles(OrderRootType type) { if (type == SourcesOrderRootType.getInstance()) { return myModuleRootLayer.getContentFolderFiles(ContentFolderScopes.productionAndTest()); } return VirtualFile.EMPTY_ARRAY; }
Example 12
Source File: ExcludeCompilerOutputPolicy.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public VirtualFile[] getExcludeRootsForProject() { VirtualFile outputPath = CompilerConfiguration.getInstance(myProject).getCompilerOutput(); if (outputPath != null) { return new VirtualFile[]{outputPath}; } return VirtualFile.EMPTY_ARRAY; }
Example 13
Source File: FileIncludeManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public VirtualFile[] getIncludedFiles(@Nonnull VirtualFile file, boolean compileTimeOnly, boolean recursively) { if (file instanceof VirtualFileWithId) { return myIncludedHolder.getAllFiles(file, compileTimeOnly, recursively); } else { return VirtualFile.EMPTY_ARRAY; } }
Example 14
Source File: DummyCompileContext.java From consulo with Apache License 2.0 | 4 votes |
@Override public VirtualFile[] getSourceRoots(Module module) { return VirtualFile.EMPTY_ARRAY; }
Example 15
Source File: DummyCompileContext.java From consulo with Apache License 2.0 | 4 votes |
@Override public VirtualFile[] getAllOutputDirectories() { return VirtualFile.EMPTY_ARRAY; }
Example 16
Source File: LibraryImpl.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public VirtualFile[] getExcludedRoots() { return myExcludedRoots != null ? myExcludedRoots.getFiles() : VirtualFile.EMPTY_ARRAY; }
Example 17
Source File: RecursionDlg.java From consulo with Apache License 2.0 | 4 votes |
private void setupControls() { setTitle("Update Copyright"); setOKButtonText("Run"); ButtonGroup group = new ButtonGroup(); group.add(rbFile); group.add(rbAll); rbFile.setMnemonic('F'); rbAll.setMnemonic('A'); cbSubdirs.setMnemonic('I'); if (file.isDirectory()) { rbFile.setText("File"); rbFile.setEnabled(false); rbAll.setText("All files in " + file.getPresentableUrl()); rbAll.setSelected(true); cbSubdirs.setSelected(true); cbSubdirs.setEnabled(true); } else { VirtualFile parent = file.getParent(); rbFile.setText("File '" + file.getPresentableUrl() + '\''); rbFile.setSelected(true); if (parent != null) { rbAll.setText("All files in " + parent.getPresentableUrl()); cbSubdirs.setSelected(true); cbSubdirs.setEnabled(false); } else { rbAll.setVisible(false); cbSubdirs.setVisible(false); } } VirtualFile check = file; if (!file.isDirectory()) { check = file.getParent(); } ProjectRootManager prm = ProjectRootManager.getInstance(project); ProjectFileIndex pfi = prm.getFileIndex(); VirtualFile[] children = check != null ? check.getChildren() : VirtualFile.EMPTY_ARRAY; boolean hasSubdirs = false; for (int i = 0; i < children.length && !hasSubdirs; i++) { if (children[i].isDirectory() && !pfi.isExcluded(children[i])) { hasSubdirs = true; } } cbSubdirs.setVisible(hasSubdirs); if (!hasSubdirs) { cbSubdirs.setEnabled(false); mainPanel.remove(cbSubdirs); } ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { if (cbSubdirs.isVisible()) { cbSubdirs.setEnabled(rbAll.isSelected()); } } }; rbFile.addActionListener(listener); rbAll.addActionListener(listener); }
Example 18
Source File: UnknownOrderEntryImpl.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public VirtualFile[] getFiles(OrderRootType type) { return VirtualFile.EMPTY_ARRAY; }
Example 19
Source File: FileTreeModel.java From consulo with Apache License 2.0 | 4 votes |
private VirtualFile[] getChildren(VirtualFile file) { if (file.isDirectory()) return file.getChildren(); if (!descriptor.isChooseJarContents() || !FileElement.isArchive(file)) return null; VirtualFile archiveRootForLocalFile = ArchiveVfsUtil.getArchiveRootForLocalFile(file); return archiveRootForLocalFile == null ? VirtualFile.EMPTY_ARRAY : archiveRootForLocalFile.getChildren(); }
Example 20
Source File: ModuleRootsProcessor.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Deprecated @DeprecationInfo(value = "Override #processFiles()") public VirtualFile[] getFiles(@Nonnull ModuleRootModel moduleRootModel, @Nonnull Predicate<ContentFolderTypeProvider> predicate) { return VirtualFile.EMPTY_ARRAY; }