• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VfsRootAccess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: registerAllowedRoots

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
public void registerAllowedRoots(List<String> roots, @NotNull Disposable disposable) {
  final List<String> newRoots = new ArrayList<String>(roots);
  newRoots.removeAll(myAllowedRoots);

  final String[] newRootsArray = ArrayUtil.toStringArray(newRoots);
  VfsRootAccess.allowRootAccess(newRootsArray);
  myAllowedRoots.addAll(newRoots);

  Disposer.register(disposable, new Disposable() {
    @Override
    public void dispose() {
      VfsRootAccess.disallowRootAccess(newRootsArray);
      myAllowedRoots.removeAll(newRoots);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ExternalSystemTestCase.java


示例2: setUp

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  // Fixes https://youtrack.jetbrains.com/issue/IDEA-129297. Only occurs in Jenkins.
  VfsRootAccess.allowRootAccess(System.getProperty("user.dir"));
  final TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder =
      JavaTestFixtureFactory.createFixtureBuilder(getName());
  myModuleBuilder = fixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
  myProjectFixture = fixtureBuilder.getFixture();
  myCodeInsightFixture = createCodeInsightFixture(getBaseDirectoryPath());
  new WriteAction() {
    @Override
    protected void run(@NotNull final Result result) {
      addAppEngineSupport(myProjectFixture.getModule());
    }
  }.execute();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:18,代码来源:AppEngineCodeInsightTestCase.java


示例3: allowRootAccess

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
private void allowRootAccess(final String filePath) {
  VfsRootAccess.allowRootAccess(filePath);
  Disposer.register(myTestRootDisposable, new Disposable() {
    @Override
    public void dispose() {
      VfsRootAccess.disallowRootAccess(filePath);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CodeInsightTestCase.java


示例4: testWindowsHiddenDirectory

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
public void testWindowsHiddenDirectory() throws Exception {
  if (!SystemInfo.isWindows) {
    System.err.println(getName() + " skipped: " + SystemInfo.OS_NAME);
    return;
  }

  File file = new File("C:\\Documents and Settings\\desktop.ini");
  if (!file.exists()) {
    System.err.println(getName() + " skipped: missing " + file);
    return;
  }

  String parent = FileUtil.toSystemIndependentName(file.getParent());
  VfsRootAccess.allowRootAccess(parent);
  try {
    VirtualFile virtualFile = myFS.refreshAndFindFileByIoFile(file);
    assertNotNull(virtualFile);

    NewVirtualFileSystem fs = (NewVirtualFileSystem)virtualFile.getFileSystem();
    FileAttributes attributes = fs.getAttributes(virtualFile);
    assertNotNull(attributes);
    assertEquals(FileAttributes.Type.FILE, attributes.type);
    assertEquals(FileAttributes.HIDDEN, attributes.flags);
  }
  finally {
    VfsRootAccess.disallowRootAccess(parent);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:LocalFileSystemTest.java


示例5: AndroidTestBase

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
protected AndroidTestBase() {
  IdeaTestCase.initPlatformPrefix();

  // IDEA14 seems to be stricter regarding validating accesses against known roots. By default, it contains the entire idea folder,
  // but it doesn't seem to include our custom structure tools/idea/../adt/idea where the android plugin is placed.
  // The following line explicitly adds that folder as an allowed root.
  VfsRootAccess.allowRootAccess(FileUtil.toCanonicalPath(getAndroidPluginHome()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AndroidTestBase.java


示例6: testImportData

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
public void testImportData() {
  String jdkPath = Jdks.getJdkHomePath(LanguageLevel.JDK_1_6);

  if (jdkPath != null) {
    VfsRootAccess.allowRootAccess(jdkPath);
  }
  List<DataNode<IdeaAndroidProject>> nodes = Lists.newArrayList();
  Key<IdeaAndroidProject> key = AndroidProjectKeys.IDE_ANDROID_PROJECT;
  nodes.add(new DataNode<IdeaAndroidProject>(key, myIdeaAndroidProject, null));

  assertEquals(key, service.getTargetDataKey());

  final IdeModifiableModelsProviderImpl modelsProvider = new IdeModifiableModelsProviderImpl(myProject);
  // ModuleCustomizers should be called.
  //noinspection ConstantConditions
  myCustomizer1.customizeModule(eq(myProject), eq(myModule), eq(modelsProvider), eq(myIdeaAndroidProject));
  expectLastCall();

  //noinspection ConstantConditions
  myCustomizer2.customizeModule(eq(myProject), eq(myModule), eq(modelsProvider), eq(myIdeaAndroidProject));
  expectLastCall();

  replay(myCustomizer1, myCustomizer2);

  service.importData(nodes, null, myProject, modelsProvider);
  modelsProvider.commit();

  verify(myCustomizer1, myCustomizer2);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:AndroidProjectDataServiceTest.java


示例7: setUp

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  VfsRootAccess.allowRootAccess(PathManager.getConfigPath());
  super.setUp();
  myGlobalSettingsFile =
    MavenWorkspaceSettingsComponent.getInstance(myProject).getSettings().generalSettings.getEffectiveGlobalSettingsIoFile();
  if (myGlobalSettingsFile != null) {
    VfsRootAccess.allowRootAccess(myGlobalSettingsFile.getAbsolutePath());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:MavenImportingTestCase.java


示例8: tearDown

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@Override
protected void tearDown() throws Exception {
  try {
    if (myGlobalSettingsFile != null) {
      VfsRootAccess.disallowRootAccess(myGlobalSettingsFile.getAbsolutePath());
    }
    VfsRootAccess.disallowRootAccess(PathManager.getConfigPath());
    Messages.setTestDialog(TestDialog.DEFAULT);
    removeFromLocalRepository("test");
    FileUtil.delete(BuildManager.getInstance().getBuildSystemDirectory());
  }
  finally {
    super.tearDown();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MavenImportingTestCase.java


示例9: configureSystemProperties

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
/** Sets up the necessary system properties for running IntelliJ tests via blaze/bazel. */
private static void configureSystemProperties() throws IOException {
  File sandbox = new File(getTmpDirFile(), "_intellij_test_sandbox");

  setSandboxPath("idea.home.path", new File(sandbox, "home"));
  setSandboxPath("idea.config.path", new File(sandbox, "config"));
  setSandboxPath("idea.system.path", new File(sandbox, "system"));
  setIfEmpty(PlatformUtils.PLATFORM_PREFIX_KEY, "Idea");
  setIfEmpty("idea.classpath.index.enabled", "false");

  // Some plugins have a since-build and until-build restriction, so we need
  // to update the build number here
  PluginManagerCore.BUILD_NUMBER = readApiVersionNumber();

  // Tests fail if they access files outside of the project roots and other system directories.
  // Ensure runfiles and platform api are whitelisted.
  VfsRootAccess.allowRootAccess(RUNFILES_PATH);
  String platformApi = getPlatformApiPath();
  if (platformApi != null) {
    VfsRootAccess.allowRootAccess(platformApi);
  }

  List<String> pluginJars = Lists.newArrayList();
  try {
    Enumeration<URL> urls =
        BlazeTestSystemPropertiesRule.class.getClassLoader().getResources("META-INF/plugin.xml");
    while (urls.hasMoreElements()) {
      URL url = urls.nextElement();
      addArchiveFile(url, pluginJars);
    }
  } catch (IOException e) {
    System.err.println("Cannot find plugin.xml resources");
    e.printStackTrace();
  }

  setIfEmpty("idea.plugins.path", Joiner.on(File.pathSeparator).join(pluginJars));
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:38,代码来源:BlazeTestSystemPropertiesRule.java


示例10: setUp

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  // Fixes https://youtrack.jetbrains.com/issue/IDEA-129297. Only occurs in Jenkins.
  VfsRootAccess.allowRootAccess(System.getProperty("user.dir"));
  appEngineProjectService = new DefaultAppEngineProjectService();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:8,代码来源:DefaultAppEngineProjectServiceTest.java


示例11: setUp

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
  cleanProjectIdeaDir();
  super.setUp();
  VfsRootAccess.allowRootAccess("/");
  for (String pluginId : getRequiredPluginIds()) {
    final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(pluginId));
    assertNotNull(pluginId + " plugin should be in classpath for integration tests!", plugin);
    assertTrue(pluginId + " is not enabled!", plugin.isEnabled());
  }

  myProjectSettings = new PantsProjectSettings();
  myCompilerTester = null;
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:15,代码来源:PantsIntegrationTestCase.java


示例12: setUp

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
  VfsRootAccess.allowRootAccess(new File(getTestDataPath(), getBasePath()).getCanonicalPath(),
    new File(LOMBOK_SRC_PATH).getCanonicalPath(), new File(HRISEY_SRC_PATH).getCanonicalPath());

  super.setUp();
  loadFilesFrom(LOMBOK_SRC_PATH);
  loadFilesFrom(HRISEY_SRC_PATH);
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:10,代码来源:AbstractLombokLightCodeInsightTestCase.java


示例13: setUp

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
  super.setUp();
  final String lombokLibPath = PathUtil.toSystemIndependentName(new File(TEST_DATA_INSPECTION_DIRECTORY, "lib").getAbsolutePath());
  VfsRootAccess.allowRootAccess(lombokLibPath);

  TestUtil.addLibrary(myFixture, getModule(), "Lombok", lombokLibPath, "lombok.jar");
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:9,代码来源:LombokInspectionTest.java


示例14: addLibraryAt

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
private void addLibraryAt(String path) {
    VfsRootAccess.allowRootAccess(path.split("/")[0]);
    PsiTestUtil.addLibrary(myModule, path);
}
 
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:5,代码来源:LibraryTestUtil.java


示例15: copyFileToProject

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@NotNull
@Override
public VirtualFile copyFileToProject(@NotNull @NonNls final String sourceFilePath, @NotNull @NonNls final String targetPath) {
  final String testDataPath = getTestDataPath();

  File fromFile = new File(testDataPath + "/" + sourceFilePath);
  if (!fromFile.exists()) {
    fromFile = new File(sourceFilePath);
  }

  VirtualFile result;
  final String path = fromFile.getAbsolutePath();
  if (myTempDirFixture instanceof LightTempDirTestFixtureImpl) {
    VfsRootAccess.allowRootAccess(path);
    Disposer.register(getTestRootDisposable(), new Disposable() {
      @Override
      public void dispose() {
        VfsRootAccess.disallowRootAccess(path);
      }
    });
    VirtualFile fromVFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(fromFile);
    if (fromVFile == null) {
      fromVFile = myTempDirFixture.getFile(sourceFilePath);
    }
    Assert.assertNotNull("can't find test data file " + sourceFilePath + " (" + testDataPath + ")", fromVFile);
    result = myTempDirFixture.copyFile(fromVFile, targetPath);
  }
  else {

    final File targetFile = new File(getTempDirPath() + "/" + targetPath);
    if (!targetFile.exists()) {
      if (fromFile.isDirectory()) {
        Assert.assertTrue(targetFile.toString(), targetFile.mkdirs());
      }
      else {
        if (!fromFile.exists()) {
          Assert.fail("Cannot find source file: '" + sourceFilePath + "'. getTestDataPath()='" + testDataPath + "'. ");
        }
        try {
          FileUtil.copy(fromFile, targetFile);
        }
        catch (IOException e) {
          throw new RuntimeException("Cannot copy " + fromFile + " to " + targetFile, e);
        }
      }
    }

    final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetFile);
    Assert.assertNotNull(targetFile.toString(), file);
    result = file;
  }
  result.putUserData(VfsTestUtil.TEST_DATA_FILE_PATH, path);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:55,代码来源:CodeInsightTestFixtureImpl.java


示例16: testSubst

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
public void testSubst() throws Exception {
  if (!SystemInfo.isWindows) {
    System.err.println("Ignored: Windows required");
    return;
  }

  File targetDir = createTestDir(myTempDirectory, "top");
  File subDir = createTestDir(targetDir, "sub");
  File file = createTestFile(subDir, "test.txt");
  File rootFile = createSubst(targetDir.getPath());
  VfsRootAccess.allowRootAccess(rootFile.getPath());
  VirtualFile vfsRoot = myFileSystem.findFileByIoFile(rootFile);

  try {
    assertNotNull(rootFile.getPath(), vfsRoot);
    File substDir = new File(rootFile, subDir.getName());
    File substFile = new File(substDir, file.getName());
    refresh(targetDir);
    refresh(substDir);

    LocalFileSystem.WatchRequest request = watch(substDir);
    try {
      myAccept = true;
      FileUtil.writeToFile(file, "new content");
      assertEvent(VFileContentChangeEvent.class, substFile.getPath());

      LocalFileSystem.WatchRequest request2 = watch(targetDir);
      try {
        myAccept = true;
        FileUtil.delete(file);
        assertEvent(VFileDeleteEvent.class, file.getPath(), substFile.getPath());
      }
      finally {
        unwatch(request2);
      }

      myAccept = true;
      FileUtil.writeToFile(file, "re-creation");
      assertEvent(VFileCreateEvent.class, substFile.getPath());
    }
    finally {
      unwatch(request);
    }
  }
  finally {
    delete(targetDir);
    deleteSubst(rootFile.getPath());
    if (vfsRoot != null) {
      ((NewVirtualFile)vfsRoot).markDirty();
      myFileSystem.refresh(false);
    }
    VfsRootAccess.disallowRootAccess(rootFile.getPath());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:55,代码来源:FileWatcherTest.java


示例17: setUp

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
  super.setUp();
  // todo: Remove if possible. Now the test fails with VfsRootAccess to python interpreter in /opt
  VfsRootAccess.allowRootAccess("/");
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:7,代码来源:OSSPantsPythonIntegrationTest.java


示例18: setUp

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  VfsRootAccess.allowRootAccess(new File(getTestDataPath(), "lib").getCanonicalPath());
  super.setUp();
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:6,代码来源:InspectionTest.java


示例19: testSubst

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; //导入依赖的package包/类
public void testSubst() throws Exception {
  if (!SystemInfo.isWindows) {
    System.err.println("Ignored: Windows required");
    return;
  }

  File targetDir = createTestDir("top");
  File subDir = createTestDir(targetDir, "sub");
  File file = createTestFile(subDir, "test.txt");
  File rootFile = createSubst(targetDir.getPath());
  VfsRootAccess.allowRootAccess(rootFile.getPath());
  VirtualFile vfsRoot = myFileSystem.findFileByIoFile(rootFile);

  try {
    assertNotNull(rootFile.getPath(), vfsRoot);
    File substDir = new File(rootFile, subDir.getName());
    File substFile = new File(substDir, file.getName());
    refresh(targetDir);
    refresh(substDir);
    myAcceptedDirectories.add(substDir.getPath());

    LocalFileSystem.WatchRequest request = watch(substDir);
    try {
      myAccept = true;
      FileUtil.writeToFile(file, "new content");
      assertEvent(VFileContentChangeEvent.class, substFile.getPath());

      LocalFileSystem.WatchRequest request2 = watch(targetDir);
      try {
        myAccept = true;
        FileUtil.delete(file);
        assertEvent(VFileDeleteEvent.class, file.getPath(), substFile.getPath());
      }
      finally {
        unwatch(request2);
      }

      myAccept = true;
      FileUtil.writeToFile(file, "re-creation");
      assertEvent(VFileCreateEvent.class, substFile.getPath());
    }
    finally {
      unwatch(request);
    }
  }
  finally {
    delete(targetDir);
    deleteSubst(rootFile.getPath());
    if (vfsRoot != null) {
      ((NewVirtualFile)vfsRoot).markDirty();
      myFileSystem.refresh(false);
    }
    VfsRootAccess.disallowRootAccess(rootFile.getPath());
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:56,代码来源:FileWatcherTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Purchase类代码示例发布时间:2022-05-22
下一篇:
Java UIUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap