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); } } } }
public void testDirectoryOverlapping() throws Exception { File topDir = createTestDir("top"); File fileInTopDir = createTestFile(topDir, "file1.txt"); File subDir = createTestDir(topDir, "sub"); File fileInSubDir = createTestFile(subDir, "file2.txt"); File sideDir = createTestDir("side"); File fileInSideDir = createTestFile(sideDir, "file3.txt"); refresh(topDir); refresh(sideDir); LocalFileSystem.WatchRequest requestForSubDir = watch(subDir); LocalFileSystem.WatchRequest requestForSideDir = watch(sideDir); try { myAccept = true; FileUtil.writeToFile(fileInTopDir, "new content"); FileUtil.writeToFile(fileInSubDir, "new content"); FileUtil.writeToFile(fileInSideDir, "new content"); assertEvent( VFileContentChangeEvent.class, fileInSubDir.getAbsolutePath(), fileInSideDir.getAbsolutePath()); LocalFileSystem.WatchRequest requestForTopDir = watch(topDir); try { myAccept = true; FileUtil.writeToFile(fileInTopDir, "newer content"); FileUtil.writeToFile(fileInSubDir, "newer content"); FileUtil.writeToFile(fileInSideDir, "newer content"); assertEvent( VFileContentChangeEvent.class, fileInTopDir.getAbsolutePath(), fileInSubDir.getAbsolutePath(), fileInSideDir.getAbsolutePath()); } finally { unwatch(requestForTopDir); } myAccept = true; FileUtil.writeToFile(fileInTopDir, "newest content"); FileUtil.writeToFile(fileInSubDir, "newest content"); FileUtil.writeToFile(fileInSideDir, "newest content"); assertEvent( VFileContentChangeEvent.class, fileInSubDir.getAbsolutePath(), fileInSideDir.getAbsolutePath()); myAccept = true; FileUtil.delete(fileInTopDir); FileUtil.delete(fileInSubDir); FileUtil.delete(fileInSideDir); assertEvent( VFileDeleteEvent.class, fileInTopDir.getAbsolutePath(), fileInSubDir.getAbsolutePath(), fileInSideDir.getAbsolutePath()); } finally { unwatch(requestForSubDir, requestForSideDir); delete(topDir); } }
@Override protected void tearDown() throws Exception { try { Disposer.dispose(myTestRootDisposable); cleanupSwingDataStructures(); cleanupDeleteOnExitHookList(); } finally { if (shouldContainTempFiles()) { FileUtil.resetCanonicalTempPathCache(ORIGINAL_TEMP_DIR); if (ourPathToKeep != null && FileUtil.isAncestor(myTempDir, ourPathToKeep, false)) { File[] files = new File(myTempDir).listFiles(); if (files != null) { for (File file : files) { if (!FileUtil.pathsEqual(file.getPath(), ourPathToKeep)) { FileUtil.delete(file); } } } } else { FileUtil.delete(new File(myTempDir)); } } } UIUtil.removeLeakingAppleListeners(); super.tearDown(); }
public void clean() throws IOException { try { myArtifactsBuildData.clean(); } finally { try { synchronized (mySourceToOutputLock) { try { closeSourceToOutputStorages(); } finally { FileUtil.delete(getSourceToOutputsRoot()); } } } finally { try { wipeStorage(getSourceToFormsRoot(), mySrcToFormMap); } finally { final Mappings mappings = myMappings; if (mappings != null) { synchronized (mappings) { mappings.clean(); } } else { FileUtil.delete(getMappingsRoot()); } } } } }
private void prepareInnerCopy() throws Exception { final SubTree subTree = new SubTree(myWorkingCopyDir); checkin(); clManager.stopEveryThingIfInTestMode(); sleep(100); final File rootFile = new File(subTree.myRootDir.getPath()); FileUtil.delete(rootFile); FileUtil.delete(new File(myWorkingCopyDir.getPath() + File.separator + ".svn")); Assert.assertTrue(!rootFile.exists()); sleep(200); myWorkingCopyDir.refresh(false, true); verify(runSvn("co", myMainUrl)); final File sourceDir = new File(myWorkingCopyDir.getPath(), "source"); final File innerDir = new File(sourceDir, "inner1/inner2/inner"); verify(runSvn("co", myExternalURL, innerDir.getPath())); sleep(100); myWorkingCopyDir.refresh(false, true); // above is preparation // start change list manager again clManager.forceGoInTestMode(); myVcs.invokeRefreshSvnRoots(false); clManager.ensureUpToDate(false); clManager.ensureUpToDate(false); }
private static void processAvailableTraces(RunConfigurationBase configuration) { final String tracesDirectory = getTracesDirectory(configuration); final TestDiscoveryIndex coverageIndex = TestDiscoveryIndex.getInstance(configuration.getProject()); synchronized (ourTracesLock) { final File tracesDirectoryFile = new File(tracesDirectory); final File[] testMethodTraces = tracesDirectoryFile.listFiles( new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".tr"); } }); if (testMethodTraces != null) { for (File testMethodTrace : testMethodTraces) { try { coverageIndex.updateFromTestTrace(testMethodTrace); FileUtil.delete(testMethodTrace); } catch (IOException e) { LOG.error("Can not load " + testMethodTrace, e); } } final String[] filesInTracedDirectories = tracesDirectoryFile.list(); if (filesInTracedDirectories == null || filesInTracedDirectories.length == 0) { FileUtil.delete(tracesDirectoryFile); } } } }
private void initTimestampIndex(final boolean needReindex) { if (needReindex) { FileUtil.delete(IndexInfrastructure.getIndexRootDir(getFileTimestampsIndexId())); } for (int attempts = 0; attempts < 2; attempts++) { try { this.fileTimestampsIndex = new PersistentHashMap<Integer, Long>( IndexInfrastructure.getStorageFile(getFileTimestampsIndexId()), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<Long>() { @Override public void save(final DataOutput out, final Long value) throws IOException { out.writeLong(value); } @Override public Long read(final DataInput in) throws IOException { return in.readLong(); } }); } catch (IOException e) { FileUtil.delete(IndexInfrastructure.getIndexRootDir(getFileTimestampsIndexId())); } if (fileTimestampsIndex != null) { return; } } throw new RuntimeException("Timestamps index not initialized"); }
public void dispose() { if (myToDeleteActualFile) { FileUtil.delete(new File(myHyperlink.getActualFilePath())); } if (myToDeleteExpectedFile) { FileUtil.delete(new File(myHyperlink.getFilePath())); } }
public static boolean deleteFiles(String storageFilePath) { final File recordsFile = new File(storageFilePath + INDEX_EXTENSION); final File dataFile = new File(storageFilePath + DATA_EXTENSION); // ensure both files deleted final boolean deletedRecordsFile = FileUtil.delete(recordsFile); final boolean deletedDataFile = FileUtil.delete(dataFile); return deletedRecordsFile && deletedDataFile; }
private void compact(final String path) { synchronized (myLock) { LOG.info( "Space waste in " + path + " is " + myDataTable.getWaste() + " bytes. Compacting now."); long start = System.currentTimeMillis(); try { File newDataFile = new File(path + ".storageData.backup"); FileUtil.delete(newDataFile); FileUtil.createIfDoesntExist(newDataFile); File oldDataFile = new File(path + DATA_EXTENSION); DataTable newDataTable = new DataTable(newDataFile, myPool); final int count = myRecordsTable.getRecordsCount(); for (int i = 1; i <= count; i++) { final long addr = myRecordsTable.getAddress(i); final int size = myRecordsTable.getSize(i); if (size > 0) { assert addr > 0; final int capacity = myCapacityAllocationPolicy.calculateCapacity(size); final long newaddr = newDataTable.allocateSpace(capacity); final byte[] bytes = new byte[size]; myDataTable.readBytes(addr, bytes); newDataTable.writeBytes(newaddr, bytes); myRecordsTable.setAddress(i, newaddr); myRecordsTable.setCapacity(i, capacity); } } myDataTable.dispose(); newDataTable.dispose(); if (!FileUtil.delete(oldDataFile)) { throw new IOException("Can't delete file: " + oldDataFile); } newDataFile.renameTo(oldDataFile); myDataTable = new DataTable(oldDataFile, myPool); } catch (IOException e) { LOG.info("Compact failed: " + e.getMessage()); } long timedelta = System.currentTimeMillis() - start; LOG.info("Done compacting in " + timedelta + "msec."); } }
public void testDirectoryRecursive() throws Exception { File topDir = createTestDir("top"); refresh(topDir); LocalFileSystem.WatchRequest request = watch(topDir); try { myAccept = true; File subDir = createTestDir(topDir, "sub"); assertEvent(VFileCreateEvent.class, subDir.getAbsolutePath()); refresh(subDir); myAccept = true; File file = createTestFile(subDir, "test.txt"); assertEvent(VFileCreateEvent.class, file.getAbsolutePath()); myAccept = true; FileUtil.writeToFile(file, "new content"); assertEvent(VFileContentChangeEvent.class, file.getAbsolutePath()); myAccept = true; FileUtil.delete(file); assertEvent(VFileDeleteEvent.class, file.getAbsolutePath()); myAccept = true; FileUtil.writeToFile(file, "re-creation"); assertEvent(VFileCreateEvent.class, file.getAbsolutePath()); } finally { unwatch(request); delete(topDir); } }
public void testNonCanonicallyNamedFileRoot() throws Exception { if (SystemInfo.isFileSystemCaseSensitive) { System.err.println("Ignored: case-insensitive FS required"); return; } File file = createTestFile("test.txt"); refresh(file); String watchRoot = file.getAbsolutePath().toUpperCase(Locale.US); LocalFileSystem.WatchRequest request = watch(new File(watchRoot)); try { myAccept = true; FileUtil.writeToFile(file, "new content"); assertEvent(VFileContentChangeEvent.class, file.getAbsolutePath()); myAccept = true; FileUtil.delete(file); assertEvent(VFileDeleteEvent.class, file.getAbsolutePath()); myAccept = true; FileUtil.writeToFile(file, "re-creation"); assertEvent(VFileCreateEvent.class, file.getAbsolutePath()); } finally { unwatch(request); delete(file); } }
public void testSmokeWithCompilerOutput() throws IOException { File tempDir = FileUtil.createTempDirectory("compilerTest", "compilerTest"); try { File out = new File(tempDir, "out"); File stdlib = ForTestCompileRuntime.runtimeJarForTests(); File jdkAnnotations = ForTestPackJdkAnnotations.jdkAnnotationsForTests(); ExitCode exitCode = new K2JVMCompiler() .exec( System.out, "-src", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kt", "-output", out.getAbsolutePath(), "-noStdlib", "-classpath", stdlib.getAbsolutePath(), "-noJdkAnnotations", "-annotations", jdkAnnotations.getAbsolutePath()); Assert.assertEquals(ExitCode.OK, exitCode); assertEquals(1, out.listFiles().length); assertEquals(1, out.listFiles()[0].listFiles().length); } finally { FileUtil.delete(tempDir); } }
@Override protected void setUp() throws Exception { if (ourOutputRoot == null) { ourOutputRoot = FileUtil.createTempDirectory("ExecutionTestCase", null, true); } myModuleOutputDir = new File(ourOutputRoot, PathUtil.getFileName(getTestAppPath())); myChecker = initOutputChecker(); EdtTestUtil.runInEdtAndWait( new ThrowableRunnable<Throwable>() { @Override public void run() throws Throwable { ExecutionTestCase.super.setUp(); } }); if (!myModuleOutputDir.exists()) { VirtualFile vDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ourOutputRoot); assertNotNull(ourOutputRoot.getAbsolutePath(), vDir); vDir .getChildren(); // we need this to load children to VFS to fire VFileCreatedEvent for the // output directory myCompilerTester = new CompilerTester( myProject, Arrays.asList(ModuleManager.getInstance(myProject).getModules())); List<CompilerMessage> messages = myCompilerTester.rebuild(); for (CompilerMessage message : messages) { if (message.getCategory() == CompilerMessageCategory.ERROR) { FileUtil.delete(myModuleOutputDir); fail("Compilation failed: " + message); } } } }
public void testHardLinks() throws Exception { if (!SystemInfo.isWindows && !SystemInfo.isUnix) { System.err.println(getName() + " skipped: " + SystemInfo.OS_NAME); return; } final boolean safeWrite = GeneralSettings.getInstance().isUseSafeWrite(); final File dir = FileUtil.createTempDirectory("hardlinks.", ".dir", false); final SafeWriteRequestor requestor = new SafeWriteRequestor() {}; try { GeneralSettings.getInstance().setUseSafeWrite(false); final File targetFile = new File(dir, "targetFile"); assertTrue(targetFile.createNewFile()); final File hardLinkFile = IoTestUtil.createHardLink(targetFile.getAbsolutePath(), "hardLinkFile"); final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetFile); assertNotNull(file); file.setBinaryContent("hello".getBytes("UTF-8"), 0, 0, requestor); assertTrue(file.getLength() > 0); final VirtualFile check = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(hardLinkFile); assertNotNull(check); assertEquals(file.getLength(), check.getLength()); assertEquals("hello", VfsUtilCore.loadText(check)); } finally { GeneralSettings.getInstance().setUseSafeWrite(safeWrite); FileUtil.delete(dir); } }
public static void rename(@NotNull File source, @NotNull File target) throws IOException { if (source.renameTo(target)) return; if (!source.exists()) return; copy(source, target); delete(source); }
private boolean for17move( final SvnVcs vcs, final File src, final File dst, boolean undo, SVNStatus srcStatus) throws SVNException { if (srcStatus != null && srcStatus.getCopyFromURL() == null) { undo = false; } if (undo) { myUndoingMove = true; createRevertAction(vcs, dst, true).execute(); copyUnversionedMembersOfDirectory(src, dst); if (srcStatus == null || SvnVcs.svnStatusIsUnversioned(srcStatus)) { FileUtil.delete(src); } else { createRevertAction(vcs, src, true).execute(); } restoreFromUndoStorage(dst); } else { if (doUsualMove(vcs, src)) return true; // check destination directory final SVNStatus dstParentStatus = getFileStatus(vcs, dst.getParentFile()); if (dstParentStatus == null || SvnVcs.svnStatusIsUnversioned(dstParentStatus)) { try { copyFileOrDir(src, dst); } catch (IOException e) { throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e); } createDeleteAction(vcs, src, true).execute(); return false; } moveFileWithSvn(vcs, src, dst); } return false; }
private void saveFsState(File dataStorageRoot, BuildFSState state) { final ProjectDescriptor pd = myProjectDescriptor; final File file = new File(dataStorageRoot, FS_STATE_FILE); try { final BufferExposingByteArrayOutputStream bytes = new BufferExposingByteArrayOutputStream(); final DataOutputStream out = new DataOutputStream(bytes); try { out.writeInt(FSState.VERSION); out.writeLong(myLastEventOrdinal); boolean hasWorkToDoWithModules = false; for (JpsModule module : pd.getProject().getModules()) { for (JavaModuleBuildTargetType type : JavaModuleBuildTargetType.ALL_TYPES) { if (state.hasWorkToDo(new ModuleBuildTarget(module, type))) { hasWorkToDoWithModules = true; break; } } if (hasWorkToDoWithModules) { break; } } out.writeBoolean(hasWorkToDoWithModules); state.save(out); } finally { out.close(); } saveOnDisk(bytes, file); } catch (Throwable e) { LOG.error(e); FileUtil.delete(file); } }
private void updateFsStateOnDisk( File dataStorageRoot, DataInputStream original, final long ordinal) { final File file = new File(dataStorageRoot, FS_STATE_FILE); try { final BufferExposingByteArrayOutputStream bytes = new BufferExposingByteArrayOutputStream(); final DataOutputStream out = new DataOutputStream(bytes); try { out.writeInt(FSState.VERSION); out.writeLong(ordinal); out.writeBoolean(false); while (true) { final int b = original.read(); if (b == -1) { break; } out.write(b); } } finally { out.close(); } saveOnDisk(bytes, file); } catch (Throwable e) { LOG.error(e); FileUtil.delete(file); } }
public void updateOrRepair( boolean fullUpdate, MavenGeneralSettings settings, MavenProgressIndicator progress) throws MavenProcessCanceledException { try { if (fullUpdate) { if (myKind == Kind.LOCAL) FileUtil.delete(getUpdateDir()); int context = createContext(getUpdateDir(), "update"); try { updateContext(context, settings, progress); } finally { myIndexer.releaseIndex(context); } } updateData(progress); isBroken = false; myFailureMessage = null; } catch (MavenProcessCanceledException e) { throw e; } catch (Exception e) { handleUpdateException(e); } save(); }
@Override protected File getIprFile() throws IOException { File iprFile = super.getIprFile(); if (useExternalCompiler()) { FileUtil.delete(iprFile); } return iprFile; }
private void cleanupBrokenData() { close(true); //noinspection TestOnlyProblems final File currentDataDir = getCurrentDataDir(); final File currentDataContextDir = getCurrentDataContextDir(); final File[] files = currentDataDir.listFiles(); if (files != null) { for (File file : files) { if (!FileUtil.filesEqual(file, currentDataContextDir)) { FileUtil.delete(file); } } } else { FileUtil.delete(currentDataDir); } }
private void updateData(MavenProgressIndicator progress) throws MavenIndexException { String newDataDirName; IndexData newData; newDataDirName = findAvailableDataDirName(); try { FileUtil.copyDir(getUpdateDir(), getDataContextDir(getDataDir(newDataDirName))); } catch (IOException e) { throw new MavenIndexException(e); } newData = openData(newDataDirName); try { doUpdateIndexData(newData, progress); newData.flush(); } catch (Throwable e) { newData.close(true); FileUtil.delete(getDataDir(newDataDirName)); 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 = newDataDirName; myUpdateTimestamp = System.currentTimeMillis(); oldData.close(true); File[] children = myDir.listFiles(); if (children != null) { for (File each : children) { if (each.getName().startsWith(DATA_DIR_PREFIX) && !each.getName().equals(newDataDirName)) { FileUtil.delete(each); } } } } }
private static void wipeStorage(File root, @Nullable AbstractStateStorage<?, ?> storage) { if (storage != null) { synchronized (storage) { storage.wipe(); } } else { FileUtil.delete(root); } }
private AsmCodeGenerator initCodeGenerator( final String formFileName, final String className, final String testDataPath) throws Exception { String tmpPath = FileUtil.getTempDirectory(); String formPath = testDataPath + formFileName; String javaPath = testDataPath + className + ".java"; final int rc = Main.compile(new String[] {"-d", tmpPath, javaPath}); assertEquals(0, rc); final String classPath = tmpPath + "/" + className + ".class"; final File classFile = new File(classPath); assertTrue(classFile.exists()); final LwRootContainer rootContainer = loadFormData(formPath); final AsmCodeGenerator codeGenerator = new AsmCodeGenerator( rootContainer, myClassFinder, myNestedFormLoader, false, new ClassWriter(ClassWriter.COMPUTE_FRAMES)); final FileInputStream classStream = new FileInputStream(classFile); try { codeGenerator.patchClass(classStream); } finally { classStream.close(); FileUtil.delete(classFile); final File[] inners = new File(tmpPath) .listFiles( new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.startsWith(className + "$") && name.endsWith(".class"); } }); if (inners != null) { for (File file : inners) FileUtil.delete(file); } } return codeGenerator; }
private <K> boolean registerIndexer( final StubIndexExtension<K, ?> extension, final boolean forceClean) throws IOException { final StubIndexKey<K, ?> indexKey = extension.getKey(); final int version = extension.getVersion(); myIndexIdToVersionMap.put(indexKey, version); final File versionFile = IndexInfrastructure.getVersionFile(indexKey); final boolean versionFileExisted = versionFile.exists(); final File indexRootDir = IndexInfrastructure.getIndexRootDir(indexKey); boolean needRebuild = false; if (forceClean || IndexInfrastructure.versionDiffers(versionFile, version)) { final String[] children = indexRootDir.list(); // rebuild only if there exists what to rebuild needRebuild = !forceClean && (versionFileExisted || children != null && children.length > 0); if (needRebuild) { LOG.info( "Version has changed for stub index " + extension.getKey() + ". The index will be rebuilt."); } FileUtil.delete(indexRootDir); IndexInfrastructure.rewriteVersion(versionFile, version); } for (int attempt = 0; attempt < 2; attempt++) { try { final MapIndexStorage<K, TIntArrayList> storage = new MapIndexStorage<K, TIntArrayList>( IndexInfrastructure.getStorageFile(indexKey), extension.getKeyDescriptor(), new StubIdExternalizer(), 2 * 1024); final MemoryIndexStorage<K, TIntArrayList> memStorage = new MemoryIndexStorage<K, TIntArrayList>(storage); myIndices.put(indexKey, new MyIndex<K>(memStorage)); break; } catch (IOException e) { LOG.info(e); needRebuild = true; FileUtil.delete(indexRootDir); IndexInfrastructure.rewriteVersion(versionFile, version); } } return needRebuild; }
/** {@inheritDoc} */ public VirtualFile decompile(DecompilationDescriptor descriptor, DecompilationContext context) throws DecompilationException { LOG.debug("About to decompile"); VirtualFile decompiledFile = null; try { boolean prepared = classPreparers.get(descriptor.getClassPathType()).execute(context, descriptor); if (prepared) { ConsoleContext consoleContext = context.getConsoleContext(); File targetClass = descriptor.getSourceFile(context.getTargetDirectory()); StringBuilder command = new StringBuilder(context.getCommand()); String path = targetClass.getAbsolutePath(); if (path.indexOf(' ') != -1) { path = "\"" + path + "\""; } command.append(path); consoleContext.addMessage( ConsoleEntryType.DECOMPILATION_OPERATION, "message.executing-jad", command.toString()); try { OperationStatus status = setup(descriptor, context); if (status == OperationStatus.CONTINUE) { ByteArrayOutputStream output = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); ResultType resultType = runExternalDecompiler(command.toString(), context, output, err); // occasionally the result will be empty - there's no point in endlessly // decompiling, so it gives a couple of more chances int count = 0; while (output.size() == 0 && count++ < 3) { consoleContext.addMessage( ConsoleEntryType.DECOMPILATION_OPERATION, "message.reexecuting-jad", command.toString()); resultType = runExternalDecompiler(command.toString(), context, output, err); } decompiledFile = getDecompilationAftermathHandler(resultType) .execute(context, descriptor, targetClass, output, err); } } catch (IOException e) { throw new DecompilationException(e); } catch (InterruptedException e) { throw new DecompilationException(e); } } } finally { FileUtil.delete(context.getTargetDirectory()); } return decompiledFile; }
@Override protected void after() { if (myRoot == null) { throw new IllegalStateException("before() was not called"); } FileUtil.delete(myRoot); myRoot = null; myName = null; }
private void processDeletedFiles(Project project) { final List<Pair<FilePath, WorkingCopyFormat>> deletedFiles = new ArrayList<Pair<FilePath, WorkingCopyFormat>>(); final Collection<FilePath> filesToProcess = new ArrayList<FilePath>(); List<VcsException> exceptions = new ArrayList<VcsException>(); final AbstractVcsHelper vcsHelper = AbstractVcsHelper.getInstance(project); try { fillDeletedFiles(project, deletedFiles, filesToProcess); if (deletedFiles.isEmpty() && filesToProcess.isEmpty() || myUndoingMove) return; SvnVcs vcs = SvnVcs.getInstance(project); final VcsShowConfirmationOption.Value value = vcs.getDeleteConfirmation().getValue(); if (value != VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) { if (!deletedFiles.isEmpty()) { final Collection<FilePath> confirmed = promptAboutDeletion(deletedFiles, vcs, value, vcsHelper); if (confirmed != null) { filesToProcess.addAll(confirmed); } } if (filesToProcess != null && !filesToProcess.isEmpty()) { runInBackground( project, "Deleting files from Subversion", createDeleteRunnable(project, vcs, filesToProcess, exceptions)); } final List<FilePath> deletedFilesFiles = ObjectsConvertor.convert( deletedFiles, new Convertor<Pair<FilePath, WorkingCopyFormat>, FilePath>() { @Override public FilePath convert(Pair<FilePath, WorkingCopyFormat> o) { return o.getFirst(); } }); for (FilePath file : deletedFilesFiles) { final FilePath parent = file.getParentPath(); if (parent != null) { myFilesToRefresh.add(parent.getVirtualFile()); } } if (filesToProcess != null) { deletedFilesFiles.removeAll(filesToProcess); } for (FilePath file : deletedFilesFiles) { FileUtil.delete(file.getIOFile()); } } } catch (SVNException e) { exceptions.add(new VcsException(e)); } if (!exceptions.isEmpty()) { vcsHelper.showErrors(exceptions, SvnBundle.message("delete.files.errors.title")); } }
@Override protected void tearDown() throws Exception { Messages.setTestDialog(TestDialog.DEFAULT); myProjectsManager.projectClosed(); removeFromLocalRepository("test"); if (useJps()) { CompilerTestUtil.disableExternalCompiler(myProject); FileUtil.delete(BuildManager.getInstance().getBuildSystemDirectory()); } super.tearDown(); }