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


Java VfsRootAccess.disallowRootAccess方法代码示例

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


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

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

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

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

示例4: 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.disallowRootAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。