本文整理匯總了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"));
}
示例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);
}
}
}
}
}
示例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();
}
});
}
}
示例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();
}
}
示例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());
}
}
}
示例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");
}
}
示例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;
}
示例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"));
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
示例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)));
}
}
示例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);
}
}