Java Code Examples for com.intellij.ide.projectView.ProjectViewNode#getVirtualFile()
The following examples show how to use
com.intellij.ide.projectView.ProjectViewNode#getVirtualFile() .
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: TreeFileChooserDialog.java From consulo with Apache License 2.0 | 6 votes |
private PsiFile calcSelectedClass() { if (myTabbedPane.getSelectedIndex() == 1) { return (PsiFile)myGotoByNamePanel.getChosenElement(); } else { final TreePath path = myTree.getSelectionPath(); if (path == null) return null; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); final Object userObject = node.getUserObject(); if (!(userObject instanceof ProjectViewNode)) return null; ProjectViewNode pvNode = (ProjectViewNode) userObject; VirtualFile vFile = pvNode.getVirtualFile(); if (vFile != null && !vFile.isDirectory()) { return PsiManager.getInstance(myProject).findFile(vFile); } return null; } }
Example 2
Source File: TreeDirectoryChooserDialog.java From js-graphql-intellij-plugin with MIT License | 5 votes |
private VirtualFile calcSelectedClass() { final TreePath path = myTree.getSelectionPath(); if (path == null) return null; final DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); final Object userObject = node.getUserObject(); if (!(userObject instanceof ProjectViewNode)) return null; ProjectViewNode pvNode = (ProjectViewNode) userObject; return pvNode.getVirtualFile(); }
Example 3
Source File: Unity3dProjectViewNodeDecorator.java From consulo-unity3d with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void decorate(ProjectViewNode node, PresentationData data) { Project project = node.getProject(); if(project == null) { return; } VirtualFile virtualFile = node.getVirtualFile(); if(virtualFile == null || virtualFile.getFileType() != Unity3dMetaFileType.INSTANCE) { return; } Unity3dRootModuleExtension rootModuleExtension = Unity3dModuleExtensionUtil.getRootModuleExtension(project); if(rootModuleExtension == null) { return; } if(Unity3dMetaFileProjectViewProvider.haveOwnerFile(virtualFile)) { return; } data.clearText(); data.addText(virtualFile.getName(), SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES); String nameWithoutExtension = virtualFile.getNameWithoutExtension(); data.setTooltip("File(directory) '" + nameWithoutExtension + "' is not exists, meta file can be deleted."); }
Example 4
Source File: IgnoreViewNodeDecorator.java From idea-gitignore with MIT License | 5 votes |
/** * Modifies the presentation of a project view node. * * @param node the node to modify (use {@link ProjectViewNode#getValue()} to get the object represented by the * node). * @param data the current presentation of the node, which you can modify as necessary. */ @Override public void decorate(ProjectViewNode node, PresentationData data) { final VirtualFile file = node.getVirtualFile(); if (file == null) { return; } if (manager.isFileTracked(file) && manager.isFileIgnored(file)) { Utils.addColoredText( data, IgnoreBundle.message("projectView.tracked"), GRAYED_SMALL_ATTRIBUTES ); } else if (ignoreSettings.isHideIgnoredFiles() && file.isDirectory()) { int count = ContainerUtil.filter( file.getChildren(), child -> manager.isFileIgnored(child) && !manager.isFileTracked(child) ).size(); if (count > 0) { Utils.addColoredText( data, IgnoreBundle.message("projectView.containsHidden", count), GRAYED_SMALL_ATTRIBUTES ); } } }
Example 5
Source File: PackageDecoration.java From SVNToolBox with Apache License 2.0 | 4 votes |
@Override protected VirtualFile getVirtualFile(ProjectViewNode node) { return node.getVirtualFile(); }
Example 6
Source File: ModuleDecoration.java From SVNToolBox with Apache License 2.0 | 4 votes |
@Override protected VirtualFile getVirtualFile(ProjectViewNode node) { return node.getVirtualFile(); }
Example 7
Source File: ContentRootDecoration.java From SVNToolBox with Apache License 2.0 | 4 votes |
@Override protected VirtualFile getVirtualFile(ProjectViewNode node) { return node.getVirtualFile(); }