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


Java VfsUtilCore类代码示例

本文整理汇总了Java中com.intellij.openapi.vfs.VfsUtilCore的典型用法代码示例。如果您正苦于以下问题:Java VfsUtilCore类的具体用法?Java VfsUtilCore怎么用?Java VfsUtilCore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: findApplicationFileRecursively

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
@Nullable
private File findApplicationFileRecursively(@NotNull final VirtualFile appDirectory,
                                            @NotNull final String applicationName) {
  final VirtualFileVisitor<VirtualFile> fileVisitor = new VirtualFileVisitor<VirtualFile>(VirtualFileVisitor
      .limit(APP_DEPTH_SEARCH), VirtualFileVisitor.SKIP_ROOT, VirtualFileVisitor.NO_FOLLOW_SYMLINKS) {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      if (ApplicationDictionary.SUPPORTED_APPLICATION_EXTENSIONS.contains(file.getExtension())) {
        if (applicationName.equals(file.getNameWithoutExtension())) {
          throw new MyStopVisitingException(file);
        }
        return false; //do not search inside application bundles
      }
      return true;
    }
  };
  try {
    VfsUtilCore.visitChildrenRecursively(appDirectory, fileVisitor, MyStopVisitingException.class);
  } catch (MyStopVisitingException e) {
    LOG.debug("Application file found for application " + applicationName + " : " + e.getResult());
    return new File(e.getResult().getPath());
  }
  return null;
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:25,代码来源:AppleScriptSystemDictionaryRegistryService.java

示例2: getAllSubFiles

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
public static Collection<VirtualFile> getAllSubFiles(VirtualFile virtualFile)
{
    Collection<VirtualFile> list = new ArrayList<>();

    VfsUtilCore.visitChildrenRecursively(virtualFile, new VirtualFileVisitor() {
        @Override
        public boolean visitFile(@NotNull VirtualFile file) {
            if (!file.isDirectory()) {
                list.add(file);
            }
            return super.visitFile(file);
        }
    });

    return list;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:17,代码来源:VfsUtil.java

示例3: saveCustomDirectoryLocation

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
private void saveCustomDirectoryLocation(final Project project) {
    final HybrisProjectSettings hybrisProjectSettings = HybrisProjectSettingsComponent.getInstance(project)
                                                                                      .getState();
    final File customDirectory = hybrisProjectDescriptor.getExternalExtensionsDirectory();
    final File hybrisDirectory = hybrisProjectDescriptor.getHybrisDistributionDirectory();
    final File baseDirectory = VfsUtilCore.virtualToIoFile(project.getBaseDir());
    final Path projectPath = Paths.get(baseDirectory.getAbsolutePath());
    final Path hybrisPath = Paths.get(hybrisDirectory.getAbsolutePath());
    final Path relativeHybrisPath = projectPath.relativize(hybrisPath);
    hybrisProjectSettings.setHybrisDirectory(relativeHybrisPath.toString());
    if (customDirectory != null) {
        final Path customPath = Paths.get(customDirectory.getAbsolutePath());
        final Path relativeCustomPath = hybrisPath.relativize(customPath);
        hybrisProjectSettings.setCustomDirectory(relativeCustomPath.toString());
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:ImportProjectProgressModalWindow.java

示例4: configure

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
@Override
public void configure(
    @NotNull final ModifiableRootModel modifiableRootModel,
    @NotNull final HybrisModuleDescriptor moduleDescriptor
) {
    Validate.notNull(modifiableRootModel);
    Validate.notNull(moduleDescriptor);

    final CompilerModuleExtension compilerModuleExtension = modifiableRootModel.getModuleExtension(
        CompilerModuleExtension.class
    );

    final File outputDirectory = new File(
        moduleDescriptor.getRootDirectory(),
        HybrisConstants.JAVA_COMPILER_FAKE_OUTPUT_PATH
    );

    compilerModuleExtension.setCompilerOutputPath(VfsUtilCore.pathToUrl(outputDirectory.getAbsolutePath()));
    compilerModuleExtension.setCompilerOutputPathForTests(VfsUtilCore.pathToUrl(outputDirectory.getAbsolutePath()));

    compilerModuleExtension.setExcludeOutput(true);
    compilerModuleExtension.inheritCompilerOutputPath(false);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:24,代码来源:DefaultCompilerOutputPathsConfigurator.java

示例5: getFilesWithBom

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
private static void getFilesWithBom(@NotNull VirtualFile root, @NotNull final List<VirtualFile> result, final boolean all) {
  VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor() {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      if (file.isDirectory()) {
        if (!all && !result.isEmpty()) {
          return false;
        }
      }
      else if (file.getBOM() != null) {
        result.add(file);
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RemoveBomAction.java

示例6: mergeCommit

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
public void mergeCommit(VirtualFile root) throws VcsException {
  GitSimpleHandler handler = new GitSimpleHandler(myProject, root, GitCommand.COMMIT);
  handler.setStdoutSuppressed(false);

  File gitDir = new File(VfsUtilCore.virtualToIoFile(root), GitUtil.DOT_GIT);
  File messageFile = new File(gitDir, GitRepositoryFiles.MERGE_MSG);
  if (!messageFile.exists()) {
    final GitBranch branch = GitBranchUtil.getCurrentBranch(myProject, root);
    final String branchName = branch != null ? branch.getName() : "";
    handler.addParameters("-m", "Merge branch '" + branchName + "' of " + root.getPresentableUrl() + " with conflicts.");
  } else {
    handler.addParameters("-F", messageFile.getAbsolutePath());
  }
  handler.endOptions();
  handler.run();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GitMerger.java

示例7: getJavaClassFolders

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
@NonNull
@Override
public List<File> getJavaClassFolders() {
  if (SUPPORT_CLASS_FILES) {
    if (mJavaClassFolders == null) {
      VirtualFile folder = AndroidDexCompiler.getOutputDirectoryForDex(myModule);
      if (folder != null) {
        mJavaClassFolders = Collections.singletonList(VfsUtilCore.virtualToIoFile(folder));
      } else {
        mJavaClassFolders = Collections.emptyList();
      }
    }

    return mJavaClassFolders;
  }

  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:IntellijLintProject.java

示例8: filterUniqueRoots

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
@Override
public <S> List<S> filterUniqueRoots(final List<S> in, final Convertor<S, VirtualFile> convertor) {
  Collections.sort(in, new ComparatorDelegate<S, VirtualFile>(convertor, FilePathComparator.getInstance()));

  for (int i = 1; i < in.size(); i++) {
    final S sChild = in.get(i);
    final VirtualFile child = convertor.convert(sChild);
    final VirtualFile childRoot = HgUtil.getHgRootOrNull(myProject, child);
    if (childRoot == null) {
      continue;
    }
    for (int j = i - 1; j >= 0; --j) {
      final S sParent = in.get(j);
      final VirtualFile parent = convertor.convert(sParent);
      // if the parent is an ancestor of the child and that they share common root, the child is removed
      if (VfsUtilCore.isAncestor(parent, child, false) && VfsUtilCore.isAncestor(childRoot, parent, false)) {
        in.remove(i);
        //noinspection AssignmentToForLoopParameter
        --i;
        break;
      }
    }
  }
  return in;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgVcs.java

示例9: getSelectedFiles

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
protected VirtualFile[] getSelectedFiles() {
  final Change[] changes = getSelectedChanges();
  Collection<VirtualFile> files = new HashSet<VirtualFile>();
  for (Change change : changes) {
    final ContentRevision afterRevision = change.getAfterRevision();
    if (afterRevision != null) {
      final VirtualFile file = afterRevision.getFile().getVirtualFile();
      if (file != null && file.isValid()) {
        files.add(file);
      }
    }
  }

  files.addAll(getSelectedVirtualFiles(null));

  return VfsUtilCore.toVirtualFileArray(files);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ChangesListView.java

示例10: updatePsi

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
@Override
protected void updatePsi(PsiTreeChangeEvent event) {
  boolean runState = myRunState;
  super.updatePsi(event);

  if (!runState && myResourceDepends != null && !myUpdateRenderer) {
    PsiFile psiFile = event.getFile();
    if (psiFile == null) {
      return;
    }
    VirtualFile file = psiFile.getVirtualFile();
    if (file == null) {
      return;
    }
    for (VirtualFile resourceDir : myResourceDepends) {
      if (VfsUtilCore.isAncestor(resourceDir, file, false)) {
        myUpdateRenderer = true;
        break;
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ExternalPSIChangeListener.java

示例11: formatRelativePath

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
@NotNull
private static CellAppearanceEx formatRelativePath(@NotNull final ContentFolder folder, @NotNull final Icon icon) {
  LightFilePointer folderFile = new LightFilePointer(folder.getUrl());
  VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(folder.getContentEntry().getUrl());
  if (file == null) return FileAppearanceService.getInstance().forInvalidUrl(folderFile.getPresentableUrl());

  String contentPath = file.getPath();
  String relativePath;
  SimpleTextAttributes textAttributes;
  VirtualFile folderFileFile = folderFile.getFile();
  if (folderFileFile == null) {
    String absolutePath = folderFile.getPresentableUrl();
    relativePath = absolutePath.startsWith(contentPath) ? absolutePath.substring(contentPath.length()) : absolutePath;
    textAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
  }
  else {
    relativePath = VfsUtilCore.getRelativePath(folderFileFile, file, File.separatorChar);
    textAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
  }

  relativePath = StringUtil.isEmpty(relativePath) ? "." + File.separatorChar : relativePath;
  return new SimpleTextCellAppearance(relativePath, icon, textAttributes);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:OrderEntryAppearanceServiceImpl.java

示例12: reset

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
@Override
public void reset() {
  myTypeCombo.setSelectedItem(myProperties.getSigningMode());

  final String keyStoreUrl = myProperties.getKeyStoreUrl();
  myKeyStorePathField.setText(keyStoreUrl != null ? FileUtil.toSystemDependentName(VfsUtilCore.urlToPath(keyStoreUrl)) : "");
  myKeyStorePasswordField.setText(myProperties.getPlainKeystorePassword());

  final String keyAlias = myProperties.getKeyAlias();
  myKeyAliasField.setText(keyAlias != null ? keyAlias : "");
  myKeyPasswordField.setText(myProperties.getPlainKeyPassword());

  myProGuardCheckBox.setSelected(myProperties.isRunProGuard());
  myProGuardConfigFilesPanel.setUrls(myProperties.getProGuardCfgFiles());

  UIUtil.setEnabled(myCertificatePanel, myProperties.getSigningMode() == AndroidArtifactSigningMode.RELEASE_SIGNED, true);
  UIUtil.setEnabled(myProGuardConfigPanel, myProperties.isRunProGuard(), true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AndroidArtifactPropertiesEditor.java

示例13: getRelativePath

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
@Nullable
String getRelativePath(final VirtualFile virtualFile, final Project project) {
  String url = virtualFile.getPresentableUrl();
  if (project == null) {
    return url;
  }
  VirtualFile root = ProjectFileIndex.SERVICE.getInstance(project).getContentRootForFile(virtualFile);
  if (root != null) {
    return root.getName() + File.separatorChar + VfsUtilCore.getRelativePath(virtualFile, root, File.separatorChar);
  }

  final VirtualFile baseDir = project.getBaseDir();
  if (baseDir != null) {
    //noinspection ConstantConditions
    final String projectHomeUrl = baseDir.getPresentableUrl();
    if (url.startsWith(projectHomeUrl)) {
      final String cont = url.substring(projectHomeUrl.length());
      if (cont.isEmpty()) return null;
      url = "..." + cont;
    }
  }
  return url;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SearchEverywherePsiRenderer.java

示例14: addOutputModuleRoots

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
private static void addOutputModuleRoots(@Nullable ExternalSourceSet externalSourceSet,
                                         @NotNull ExternalSystemSourceType sourceType,
                                         @NotNull Collection<String> result) {
  if (externalSourceSet == null) return;
  final ExternalSourceDirectorySet directorySet = externalSourceSet.getSources().get(sourceType);
  if (directorySet == null) return;

  if (directorySet.isCompilerOutputPathInherited()) return;
  final String path = directorySet.getOutputDir().getAbsolutePath();
  VirtualFile virtualFile = VirtualFileManager.getInstance().findFileByUrl(path);
  if (virtualFile == null) {
    if(!directorySet.getOutputDir().exists()){
      FileUtil.createDirectory(directorySet.getOutputDir());
    }
    ApplicationEx app = (ApplicationEx)ApplicationManager.getApplication();
    if (app.isDispatchThread() || !app.holdsReadLock()) {
      LocalFileSystem.getInstance().refreshAndFindFileByIoFile(directorySet.getOutputDir());
    }
  }
  result.add(VfsUtilCore.pathToUrl(path));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GradleOrderEnumeratorHandler.java

示例15: processFileFilter

import com.intellij.openapi.vfs.VfsUtilCore; //导入依赖的package包/类
/**
 * Checks whether we have a file filter (e.g. a set of specific files to check in the module rather than all files,
 * and if so, and if all the files have been found, returns true)
 */
private static boolean processFileFilter(@NonNull Module module, @Nullable List<VirtualFile> files, @NonNull LintModuleProject project) {
  if (files != null && !files.isEmpty()) {
    ListIterator<VirtualFile> iterator = files.listIterator();
    while (iterator.hasNext()) {
      VirtualFile file = iterator.next();
      if (module.getModuleContentScope().accept(file)) {
        project.addFile(VfsUtilCore.virtualToIoFile(file));
        iterator.remove();
      }
    }
    if (files.isEmpty()) {
      // We're only scanning a subset of files (typically the current file in the editor);
      // in that case, don't initialize all the libraries etc
      project.setDirectLibraries(Collections.<Project>emptyList());
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:IntellijLintProject.java


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