当前位置: 首页>>代码示例>>Java>>正文


Java VirtualFile.isDirectory方法代码示例

本文整理汇总了Java中com.intellij.openapi.vfs.VirtualFile.isDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualFile.isDirectory方法的具体用法?Java VirtualFile.isDirectory怎么用?Java VirtualFile.isDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vfs.VirtualFile的用法示例。


在下文中一共展示了VirtualFile.isDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIndexer

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@NotNull
@Override
public DataIndexer<String, String, FileContent> getIndexer() {
    return virtualFile -> {
        final Map<String, String> items = new THashMap<>();

        VirtualFile file = virtualFile.getFile();
        VirtualFile parentDirectory = file.getParent();
        if (parentDirectory != null) {
            VirtualFile ancestorDirectory = parentDirectory.getParent();
            if (ancestorDirectory != null && ancestorDirectory.isDirectory()) {
                String ancestorDirectoryName = ancestorDirectory.getName();
                if (ancestorDirectoryName.equals("sysext") || ancestorDirectoryName.equals("ext")) {
                    String path = file.getPath();
                    items.put(parentDirectory.getName(), path);
                }

                // handle the case where the extension name can *not* be inferred from the directory name
            }
        }

        return items;
    };
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:25,代码来源:ExtensionNameStubIndex.java

示例2: processFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public boolean processFile(final VirtualFile file) {
    final String fileName = file.getName();
    final String filePath = file.getPath();
    boolean isTarget = false;
    if(fileContent.isPython()){
        isTarget = !file.isDirectory() && !fileContent.contains(filePath);
    }else{
        isTarget = !file.isDirectory() && fileContent.contains(filePath);
    }

    if (isTarget && !this.fileContent.hasFile(fileName)) {
        fileContent.get().put(fileName, filePath);
        //System.out.println("include: " + fileName);
    }

    return true;
}
 
开发者ID:chakki-works,项目名称:watchMe,代码行数:19,代码来源:ProjectFileIterator.java

示例3: getSourceCodeRoot

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Nullable
private VirtualFile getSourceCodeRoot(final @NotNull HybrisModuleDescriptor moduleDescriptor) {
    final VirtualFile sourceCodeRoot;
    final File sourceCodeFile = moduleDescriptor.getRootProjectDescriptor().getSourceCodeFile();

    if (null != sourceCodeFile) {
        final VirtualFile sourceVFile = VfsUtil.findFileByIoFile(sourceCodeFile, true);
        if (null == sourceVFile) {
            sourceCodeRoot = null;
        } else if (sourceVFile.isDirectory()) {
            sourceCodeRoot = sourceVFile;
        } else {
            sourceCodeRoot = JarFileSystem.getInstance().getJarRootForLocalFile(sourceVFile);
        }
    } else {
        sourceCodeRoot = null;
    }

    return sourceCodeRoot;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:DefaultLibRootsConfigurator.java

示例4: getTaskDir

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Nullable
public static VirtualFile getTaskDir(@NotNull VirtualFile taskFile) {
  VirtualFile parent = taskFile.getParent();

  while (parent != null) {
    String name = parent.getName();

    if (name.contains(EduNames.TASK) && parent.isDirectory()) {
      return parent;
    }
    if (EduNames.SRC.equals(name)) {
      return parent.getParent();
    }

    parent = parent.getParent();
  }
  return null;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:19,代码来源:StudyUtils.java

示例5: getJavaFileTree

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public static List<VirtualFile> getJavaFileTree(Project project, VirtualFile file, boolean recursive) {
    List<VirtualFile> list = new ArrayList<VirtualFile>();
    if (!file.isDirectory()) {
        PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
        if (psiFile instanceof PsiJavaFile || file.getFileType().equals(StdFileTypes.JAVA)) {
            list.add(file);
        }
    } else if (recursive) {
        VirtualFile[] vfs = file.getChildren();
        if (vfs != null) {
            for (VirtualFile vf : vfs) {
                list.addAll(Utils.getJavaFileTree(project, vf, recursive));
            }
        }
    }
    return list;
}
 
开发者ID:Jamling,项目名称:Android-ORM-ASPlugin,代码行数:18,代码来源:Utils.java

示例6: listDirs

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public List<? extends IDirectory> listDirs()
{
  List<IDirectory> result = new ArrayList<>();
  if( _virtualFile != null && _virtualFile.isValid() )
  {
    for( VirtualFile child : _virtualFile.getChildren() )
    {
      if( child.isDirectory() )
      {
        result.add( new IjDirectory( getFileSystem(), child ) );
      }
    }
  }
  return result;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:17,代码来源:IjDirectory.java

示例7: update

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent event) {
	//在Action显示之前,根据选中文件扩展名判定是否显示此Action
	VirtualFile file = DataKeys.VIRTUAL_FILE.getData(event.getDataContext());
	boolean show = file.isDirectory() || isYamlFile(file.getExtension());
	this.getTemplatePresentation().setEnabled(show);
	this.getTemplatePresentation().setVisible(show);
}
 
开发者ID:xusida,项目名称:yaml-format,代码行数:9,代码来源:FormatYamlAction.java

示例8: findVfUp

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public static VirtualFile findVfUp(VirtualFile item, String searchItemName)
{
    if (item.getParent() != null) {
        VirtualFile vf = VfsUtilCore.findRelativeFile(searchItemName, item.getParent());
        if (vf != null && !vf.isDirectory()) {
            return vf;
        }
    }
    return findVfUp(item.getParent(), searchItemName);
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:11,代码来源:VfsUtil.java

示例9: getPropertyValue

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public static String getPropertyValue(String key, boolean isOptional) {
    if (key == null) {
        return "";
    }
    VirtualFile baseDir = ProjectManager.getInstance().getOpenProjects()[0].getBaseDir();
    if (baseDir == null || !baseDir.isDirectory()) {
        System.out.println("Base dir not exist");
        return "";
    }
    Properties properties = new Properties();
    String value = null;
    try {
        VirtualFile crowdinProperties = baseDir.findChild(PROPERTIES_FILE);
        if (crowdinProperties == null) {
            showInformationMessage("File '" + PROPERTIES_FILE + "' with Crowdin plugin configuration doesn't exist in project root directory");
            LOGGER.info("File '" + PROPERTIES_FILE + "' with Crowdin plugin configuration doesn't exist in project root directory");
            return "";
        }
        InputStream in = new FileInputStream(crowdinProperties.getCanonicalPath());
        properties.load(in);
        in.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (properties != null && properties.get(key) != null) {
        value = properties.get(key).toString();
    } else if (!isOptional) {
        showInformationMessage("Check does property '" + key + "' exist in your configuration file '" + PROPERTIES_FILE + "'");
        LOGGER.info("Check does property '" + key + "' exist in your configuration file '" + PROPERTIES_FILE + "'");
    }
    return value;
}
 
开发者ID:crowdin,项目名称:android-studio-plugin,代码行数:33,代码来源:Utils.java

示例10: chosenFileToResultingText

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@NotNull
@Override
protected String chosenFileToResultingText(@NotNull final VirtualFile chosenFile) {
    if (chosenFile.isDirectory()) {
        final String hybrisApiVersion = getHybrisApiVersion(hybrisDistributionDirectoryFilesInChooser.getText());
        final File sourceZip = findSourceZip(chosenFile.getPath(), hybrisApiVersion);

        if (sourceZip != null) {
            return sourceZip.getAbsolutePath();
        }
    }
    return super.chosenFileToResultingText(chosenFile);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:14,代码来源:HybrisWorkspaceRootStep.java

示例11: format

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
private void format(VirtualFile file) {
	if (file.isDirectory()) {
		for (int i = 0; i < file.getChildren().length; i++)
			format(file.getChildren()[i]);
	} else {
		if (isYamlFile(file.getExtension())) {
			log("format : " + file.getPath());
			try {
				formatYaml(file);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
 
开发者ID:xusida,项目名称:yaml-format,代码行数:16,代码来源:FormatYamlAction.java

示例12: actionPerformed

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
  Project project = e.getProject();
  if (project == null) {
    return;
  }
  final VirtualFile[] virtualFiles = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(e.getDataContext());
  if (virtualFiles == null) {
    return;
  }

  for (VirtualFile file : virtualFiles) {
    if (!isAvailable(project, file)) continue;
    VirtualFile taskVF = StudyUtils.getTaskDir(file);
    if (taskVF == null) {
      return;
    }
    Task task = StudyUtils.getTask(project, taskVF);
    if (task == null) {
      return;
    }
    Course course = StudyTaskManager.getInstance(project).getCourse();
    if (file.isDirectory()) {
      final List<VirtualFile> children = VfsUtil.collectChildrenRecursively(file);
      for (VirtualFile child : children) {
        performAction(child, task, course, project);
      }
    }
    else {
      performAction(file, task, course, project);
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:34,代码来源:CCTaskFileActionBase.java

示例13: getSubDir

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public static PsiDirectory getSubDir(Project project, VirtualFile vf) {
    if (vf.isDirectory()) {
        return PsiManager.getInstance(project).findDirectory(vf);
    } else {
        return getSubDir(project, vf.getParent());
    }
}
 
开发者ID:Jamling,项目名称:Android-ORM-ASPlugin,代码行数:8,代码来源:Utils.java

示例14: actionPerformed

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent event) {
    VirtualFile file = DataKeys.VIRTUAL_FILE.getData(event.getDataContext());
    Project project = event.getProject();
    if (file == null || project == null) return;
    VirtualFile folder = file.isDirectory() ? file : file.getParent();

    WriteCommandAction.runWriteCommandAction(project, () -> {
        createData(folder);
        createDomain(folder);
        createPresentation(folder);
    });
}
 
开发者ID:edgarmiro,项目名称:clean-plugin,代码行数:14,代码来源:CreateCleanStructure.java

示例15: toIResource

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public static IjResource toIResource( Project ijProject, VirtualFile file )
{
  if( file.isDirectory() )
  {
    return toIDirectory( ijProject, file );
  }
  else
  {
    return toIFile( ijProject, file );
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:12,代码来源:FileUtil.java


注:本文中的com.intellij.openapi.vfs.VirtualFile.isDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。