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


Java FileUtil.delete方法代码示例

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


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

示例1: findAntResult

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void findAntResult(final Map<Project, AntGenResult> resultMap) {
    for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        final HybrisProjectSettings hybrisProjectSettings =
            HybrisProjectSettingsComponent.getInstance(project).getState();

        if (!hybrisProjectSettings.isHybrisProject()) {
            continue;
        }

        final File file = new File(project.getBasePath() + "/" + hybrisProjectSettings.getHybrisDirectory() + "/temp/ant.ser");
        if (file.exists()) {
            AntGenResult result = null;
            try (
                final FileInputStream fileIn = new FileInputStream(file);
                final ObjectInputStream in = new ObjectInputStream(fileIn)
            ) {
                result = (AntGenResult) in.readObject();
            } catch (IOException | ClassNotFoundException e) {
                e.printStackTrace();
            }
            FileUtil.delete(file);
            resultMap.put(project, result);
            return;
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:HybrisAntBuildListener.java

示例2: removeAllFiles

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
public void removeAllFiles(@NotNull final Collection<File> files) throws IOException {
    Validate.notNull(files);

    if (files.isEmpty()) {
        return;
    }

    final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();

    for (File file : files) {
        final VirtualFile virtualFile = localFileSystem.findFileByIoFile(file);

        if (null != virtualFile) {
            ApplicationManager.getApplication().runWriteAction(new RemoveFileComputable(virtualFile));
        } else {
            FileUtil.delete(file);
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:DefaultVirtualFileSystemService.java

示例3: testCreationAndDeletionOfFileUnderUnversionedDir

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testCreationAndDeletionOfFileUnderUnversionedDir() throws IOException {
  addExcludedDir(myRoot.getPath() + "/dir");

  Module m = createModule("foo");
  addContentRoot(m, myRoot.getPath() + "/dir/subDir");

  createFileExternally("dir/subDir/file.txt");
  LocalFileSystem.getInstance().refresh(false);

  FileUtil.delete(new File(myRoot.getPath() + "/dir/subDir"));
  LocalFileSystem.getInstance().refresh(false);

  createFileExternally("dir/subDir/file.txt");
  LocalFileSystem.getInstance().refresh(false);

  List<Revision> revs = getRevisionsFor(myRoot);
  assertEquals(4, revs.size());
  assertNotNull(revs.get(0).findEntry().findEntry("dir/subDir/file.txt"));
  assertNull(revs.get(1).findEntry().findEntry("dir/subDir"));
  assertNotNull(revs.get(2).findEntry().findEntry("dir/subDir/file.txt"));
  assertNull(revs.get(3).findEntry().findEntry("dir/subDir"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:FileListeningTest.java

示例4: cleanTargetStorages

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void cleanTargetStorages(BuildTarget<?> target) throws IOException {
  try {
    AtomicNotNullLazyValue<BuildTargetStorages> storages = myTargetStorages.remove(target);
    if (storages != null) {
      storages.getValue().close();
    }
  }
  finally {
    // delete all data except src-out mapping which is cleaned in a special way
    final File[] targetData = myDataPaths.getTargetDataRoot(target).listFiles();
    if (targetData != null) {
      final File srcOutputMapRoot = getSourceToOutputMapRoot(target);
      for (File dataFile : targetData) {
        if (!FileUtil.filesEqual(dataFile, srcOutputMapRoot)) {
          FileUtil.delete(dataFile);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BuildDataManager.java

示例5: tearDown

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@After
@Override
public void tearDown() throws Exception {
  try {
    if (myTempDir != null) {
      FileUtil.delete(myTempDir);
    }
  }
  finally {
    EdtTestUtil.runInEdtAndWait(new ThrowableRunnable() {
        @Override
        public void run() throws Throwable {
          GitRepositoryReaderTest.super.tearDown();
        }
      });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GitRepositoryReaderTest.java

示例6: tearDown

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
public void tearDown() throws Exception {
  if (myJdkHome == null) {
    //super.setUp() wasn't called
    return;
  }

  try {
    new WriteAction() {
      @Override
      protected void run(@NotNull Result result) throws Throwable {
        Sdk old = ProjectJdkTable.getInstance().findJdk(GRADLE_JDK_NAME);
        if (old != null) {
          SdkConfigurationUtil.removeSdk(old);
        }
      }
    }.execute();
    Messages.setTestDialog(TestDialog.DEFAULT);
    FileUtil.delete(BuildManager.getInstance().getBuildSystemDirectory());
  }
  finally {
    super.tearDown();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GradleImportingTestCase.java

示例7: rollbackGroupForWc

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void rollbackGroupForWc(@NotNull List<Change> changes,
                                @NotNull List<VcsException> exceptions,
                                @NotNull RollbackProgressListener listener) {
  final UnversionedAndNotTouchedFilesGroupCollector collector = new UnversionedAndNotTouchedFilesGroupCollector();
  final ChangesChecker checker = new ChangesChecker(mySvnVcs, collector);

  checker.gather(changes);
  exceptions.addAll(checker.getExceptions());

  final Reverter reverter = new Reverter(mySvnVcs, listener, exceptions);
  reverter.moveRenamesToTmp(collector);
  reverter.revert(checker.getForAdds(), true);
  reverter.revert(checker.getForDeletes(), true);
  reverter.revert(checker.getForEdits(), false);
  reverter.moveGroup();

  for (Couple<File> pair : collector.getToBeDeleted()) {
    if (pair.getFirst().exists()) {
      FileUtil.delete(pair.getSecond());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SvnRollbackEnvironment.java

示例8: PyStudyInitialConfigurator

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
/**
 * @noinspection UnusedParameters
 */
public PyStudyInitialConfigurator(MessageBus bus,
                                  CodeInsightSettings codeInsightSettings,
                                  final PropertiesComponent propertiesComponent,
                                  FileTypeManager fileTypeManager,
                                  final ProjectManagerEx projectManager) {
  if (!propertiesComponent.getBoolean(CONFIGURED_V40)) {
    final File courses = new File(PathManager.getConfigPath(), "courses");
    FileUtil.delete(courses);
    propertiesComponent.setValue(CONFIGURED_V40, "true");
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:15,代码来源:PyStudyInitialConfigurator.java

示例9: thingsWentWrongLetsReinitialize

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void thingsWentWrongLetsReinitialize(@Nullable Holder holder, Throwable throwable) throws IOException {
  LOG.error("Unexpected problem", throwable);
  if (holder != null) holder.dispose();
  String path = TestDiscoveryExtension.baseTestDiscoveryPathForProject(myProject);
  final File versionFile = getVersionFile(path);
  FileUtil.delete(versionFile);

  myHolder = null;
  if (throwable instanceof IOException) throw (IOException) throwable;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:TestDiscoveryIndex.java

示例10: setUp

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
  super.setUp();
  myOlderDir = getDataDir();
  myNewerDir = getTempFile("newDir");
  FileUtil.copyDir(myOlderDir, myNewerDir);

  FileUtil.delete(new File(myNewerDir, "bin/idea.bat"));
  FileUtil.writeToFile(new File(myNewerDir, "Readme.txt"), "hello".getBytes());
  File newFile = new File(myNewerDir, "newDir/newFile.txt");
  newFile.getParentFile().mkdirs();
  newFile.createNewFile();
  FileUtil.writeToFile(newFile, "hello".getBytes());

  FileUtil.delete(new File(myOlderDir, "lib/annotations_changed.jar"));
  FileUtil.delete(new File(myNewerDir, "lib/annotations.jar"));
  FileUtil.rename(new File(myNewerDir, "lib/annotations_changed.jar"),
                  new File(myNewerDir, "lib/annotations.jar"));

  FileUtil.delete(new File(myOlderDir, "lib/bootstrap_deleted.jar"));
  FileUtil.delete(new File(myNewerDir, "lib/bootstrap.jar"));
  FileUtil.rename(new File(myNewerDir, "lib/bootstrap_deleted.jar"),
                  new File(myNewerDir, "lib/bootstrap.jar"));

  FileUtil.delete(new File(myOlderDir, "lib/boot2_changed_with_unchanged_content.jar"));
  FileUtil.delete(new File(myNewerDir, "lib/boot2.jar"));
  FileUtil.rename(new File(myNewerDir, "lib/boot2_changed_with_unchanged_content.jar"),
                  new File(myNewerDir, "lib/boot2.jar"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:PatchTestCase.java

示例11: updateData

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void updateData(MavenProgressIndicator progress, File newDataDir, boolean fullUpdate) throws MavenIndexException {

    IndexData newData = new IndexData(newDataDir);
    try {
      doUpdateIndexData(newData, progress);
      newData.flush();
    }
    catch (Throwable e) {
      newData.close(true);
      FileUtil.delete(newDataDir);

      if (e instanceof MavenServerIndexerException) throw new MavenIndexException(e);
      if (e instanceof IOException) throw new MavenIndexException(e);
      throw new RuntimeException(e);
    }

    synchronized (this) {
      IndexData oldData = myData;

      myData = newData;
      myDataDirName = newDataDir.getName();

      if (fullUpdate) {
        myUpdateTimestamp = System.currentTimeMillis();
      }

      oldData.close(true);

      for (File each : FileUtil.notNullize(myDir.listFiles())) {
        if (each.getName().startsWith(DATA_DIR_PREFIX) && !each.getName().equals(myDataDirName)) {
          FileUtil.delete(each);
        }
      }
    }
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:MavenIndex.java

示例12: close

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void close() {
  final TimestampStorage timestamps = myTimestamps;
  if (timestamps != null) {
    try {
      timestamps.close();
    }
    catch (IOException e) {
      LOG.error(e);
      FileUtil.delete(myTimestampsRoot);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ProjectTimestamps.java

示例13: ensureTempDirCreated

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void ensureTempDirCreated() throws IOException {
  if (ourTempDir != null) return;

  ourTempDir = new File(FileUtil.getTempDirectory(), getTestsTempDir());
  FileUtil.delete(ourTempDir);
  FileUtil.ensureExists(ourTempDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ExternalSystemTestCase.java

示例14: dropUnregisteredIndices

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void dropUnregisteredIndices() {
  final Set<String> indicesToDrop = new HashSet<String>(myPreviouslyRegistered != null? myPreviouslyRegistered.registeredIndices : Collections.<String>emptyList());
  for (ID<?, ?> key : myIndices.keySet()) {
    indicesToDrop.remove(key.toString());
  }

  for (String s : indicesToDrop) {
    FileUtil.delete(IndexInfrastructure.getIndexRootDir(ID.create(s)));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:StubIndexImpl.java

示例15: delete

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void delete(File file) throws IOException {
  VirtualFile vFile = myFileSystem.findFileByIoFile(file);
  if (vFile != null) {
    AccessToken token = ApplicationManager.getApplication().acquireWriteActionLock(getClass());
    try {
      vFile.delete(this);
    }
    finally {
      token.finish();
    }
  }
  if (file.exists()) {
    FileUtil.delete(file);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:FileWatcherTest.java


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