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


Java VfsRootAccess.allowRootAccess方法代码示例

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


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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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