本文整理汇总了Java中com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java PsiDirectoryNode.getValue方法的具体用法?Java PsiDirectoryNode.getValue怎么用?Java PsiDirectoryNode.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode
的用法示例。
在下文中一共展示了PsiDirectoryNode.getValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorate
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof PsiDirectoryNode)) {
return;
}
final PsiDirectoryNode psiDirectoryNode = (PsiDirectoryNode)node;
PsiDirectory psiDirectory = psiDirectoryNode.getValue();
Project project = psiDirectory.getProject();
if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
return;
}
VirtualFile folder = psiDirectory.getVirtualFile();
Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(folder);
if (module != null && ModuleUtilCore.isModuleDir(module, folder)) {
data.setIcon(GradleUtil.getModuleIcon(module));
}
}
示例2: isForMe
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@Override
public boolean isForMe(ProjectViewNode node) {
if (node instanceof PsiDirectoryNode) {
PsiDirectoryNode dirNode = (PsiDirectoryNode) node;
final Project project = dirNode.getProject();
final PsiDirectory psiDirectory = dirNode.getValue();
final VirtualFile directoryFile = psiDirectory.getVirtualFile();
return ProjectRootsUtil.isInSource(directoryFile, project) ||
ProjectRootsUtil.isInTestSource(directoryFile, project);
}
return false;
}
示例3: isForMe
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@Override
public boolean isForMe(ProjectViewNode node) {
if (node instanceof PsiDirectoryNode) {
PsiDirectoryNode dirNode = (PsiDirectoryNode) node;
final PsiDirectory psiDirectory = dirNode.getValue();
if (psiDirectory != null) {
final Project project = dirNode.getProject();
final VirtualFile directoryFile = psiDirectory.getVirtualFile();
return ProjectRootsUtil.isModuleContentRoot(directoryFile, project)
|| ProjectRootsUtil.isInSource(directoryFile, project);
}
}
return false;
}
示例4: getSelectedDirectories
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@NotNull
public PsiDirectory[] getSelectedDirectories() {
List<PsiDirectory> directories = ContainerUtil.newArrayList();
for (PsiDirectoryNode node : getSelectedNodes(PsiDirectoryNode.class)) {
PsiDirectory directory = node.getValue();
if (directory != null) {
directories.add(directory);
Object parentValue = node.getParent().getValue();
if (parentValue instanceof PsiDirectory && Registry.is("projectView.choose.directory.on.compacted.middle.packages")) {
while (true) {
directory = directory.getParentDirectory();
if (directory == null || directory.equals(parentValue)) {
break;
}
directories.add(directory);
}
}
}
}
if (!directories.isEmpty()) {
return directories.toArray(new PsiDirectory[directories.size()]);
}
final PsiElement[] elements = getSelectedPSIElements();
if (elements.length == 1) {
final PsiElement element = elements[0];
if (element instanceof PsiDirectory) {
return new PsiDirectory[]{(PsiDirectory)element};
}
else if (element instanceof PsiDirectoryContainer) {
return ((PsiDirectoryContainer)element).getDirectories();
}
else {
final PsiFile containingFile = element.getContainingFile();
if (containingFile != null) {
final PsiDirectory psiDirectory = containingFile.getContainingDirectory();
if (psiDirectory != null) {
return new PsiDirectory[]{psiDirectory};
}
final VirtualFile file = containingFile.getVirtualFile();
if (file instanceof VirtualFileWindow) {
final VirtualFile delegate = ((VirtualFileWindow)file).getDelegate();
final PsiFile delegatePsiFile = containingFile.getManager().findFile(delegate);
if (delegatePsiFile != null && delegatePsiFile.getContainingDirectory() != null) {
return new PsiDirectory[] { delegatePsiFile.getContainingDirectory() };
}
}
return PsiDirectory.EMPTY_ARRAY;
}
}
}
else {
final DefaultMutableTreeNode selectedNode = getSelectedNode();
if (selectedNode != null) {
return getSelectedDirectoriesInAmbiguousCase(selectedNode);
}
}
return PsiDirectory.EMPTY_ARRAY;
}
示例5: ResourceDirectoryNode
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
protected ResourceDirectoryNode(Project project,
PsiDirectoryNode directory,
ViewSettings viewSettings) {
super(project, directory.getValue(), viewSettings);
myBaseNode = directory;
}
示例6: decorate
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof PsiDirectoryNode)) {
return;
}
final PsiDirectoryNode psiDirectoryNode = (PsiDirectoryNode)node;
PsiDirectory directory = psiDirectoryNode.getValue();
if (directory == null || !directory.isValid()) {
return;
}
final Project project = directory.getProject();
if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
return;
}
// If the build dir is inside the module's content root, ProjectRootsUtil.isModuleContentRoot will return false. The reason is that when
// we set up the project during a sync, we don't create additional content roots if the build dir is inside the module.
final VirtualFile folder = directory.getVirtualFile();
if (!ProjectRootsUtil.isModuleContentRoot(folder, project)) {
return;
}
Object parentValue = psiDirectoryNode.getParent().getValue();
if (!(parentValue instanceof Module)) {
return;
}
Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(folder);
if (module == null) {
return;
}
AndroidProject androidProject = GradleUtil.getAndroidProject(module);
if (androidProject == null) {
return;
}
File buildFolderPath = androidProject.getBuildFolder();
File folderPath = VfsUtilCore.virtualToIoFile(folder);
if (FileUtil.filesEqual(buildFolderPath, folderPath)) {
data.clearText();
data.addText(folder.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
示例7: getSelectedDirectories
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入方法依赖的package包/类
@Nonnull
public PsiDirectory[] getSelectedDirectories() {
List<PsiDirectory> directories = ContainerUtil.newArrayList();
for (PsiDirectoryNode node : getSelectedNodes(PsiDirectoryNode.class)) {
PsiDirectory directory = node.getValue();
if (directory != null) {
directories.add(directory);
Object parentValue = node.getParent().getValue();
if (parentValue instanceof PsiDirectory && Registry.is("projectView.choose.directory.on.compacted.middle.packages")) {
while (true) {
directory = directory.getParentDirectory();
if (directory == null || directory.equals(parentValue)) {
break;
}
directories.add(directory);
}
}
}
}
if (!directories.isEmpty()) {
return directories.toArray(new PsiDirectory[directories.size()]);
}
final PsiElement[] elements = getSelectedPSIElements();
if (elements.length == 1) {
final PsiElement element = elements[0];
if (element instanceof PsiDirectory) {
return new PsiDirectory[]{(PsiDirectory)element};
}
else if (element instanceof PsiDirectoryContainer) {
return ((PsiDirectoryContainer)element).getDirectories();
}
else {
final PsiFile containingFile = element.getContainingFile();
if (containingFile != null) {
final PsiDirectory psiDirectory = containingFile.getContainingDirectory();
if (psiDirectory != null) {
return new PsiDirectory[]{psiDirectory};
}
final VirtualFile file = containingFile.getVirtualFile();
if (file instanceof VirtualFileWindow) {
final VirtualFile delegate = ((VirtualFileWindow)file).getDelegate();
final PsiFile delegatePsiFile = containingFile.getManager().findFile(delegate);
if (delegatePsiFile != null && delegatePsiFile.getContainingDirectory() != null) {
return new PsiDirectory[]{delegatePsiFile.getContainingDirectory()};
}
}
return PsiDirectory.EMPTY_ARRAY;
}
}
}
else {
final DefaultMutableTreeNode selectedNode = getSelectedNode();
if (selectedNode != null) {
return getSelectedDirectoriesInAmbiguousCase(selectedNode);
}
}
return PsiDirectory.EMPTY_ARRAY;
}