diff --git a/debug/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java b/debug/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java index 3a6947654dc..6a3cfe61abe 100644 --- a/debug/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java +++ b/debug/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java @@ -105,7 +105,7 @@ public Object[] findSourceElements(String name) throws CoreException { if (fRootFile != null) { // See bug 98090 - we need to handle relative path names IFileStore target = fRootFile.getFileStore(IPath.fromOSString(name)); - if (target.fetchInfo().exists()) { + if (target.exists()) { // We no longer have to account for bug 95832, and URIs take care // of canonical paths (fix to bug 95679 was removed). IFile[] files = fRoot.findFilesForLocationURI(target.toURI()); diff --git a/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java index fdd9857fa79..1be6ba8b6c7 100644 --- a/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java +++ b/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java @@ -321,7 +321,7 @@ public void delete() throws CoreException { IFileStore store = getFileStore(); if (store != null) { store.delete(EFS.NONE, null); - if ((store.fetchInfo().exists())) { + if (store.exists()) { throw new DebugException( new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfiguration_Failed_to_delete_launch_configuration__1, null) @@ -391,7 +391,7 @@ public boolean exists() { try { IFileStore store = getFileStore(); if (store != null) { - return store.fetchInfo().exists(); + return store.exists(); } } catch (CoreException e) { } diff --git a/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java index f4be45d22e5..acbbc2e321b 100644 --- a/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java +++ b/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java @@ -308,7 +308,7 @@ protected void writeNewFile(IProgressMonitor monitor) throws CoreException { } IFileStore dir = file.getParent(); dir.mkdir(EFS.SHALLOW, null); - if (!file.fetchInfo().exists()) { + if (!file.exists()) { added = true; updateMonitor(lmonitor, 1); } diff --git a/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/DebugFileStore.java b/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/DebugFileStore.java index d5b09ae4516..82fddfe6463 100644 --- a/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/DebugFileStore.java +++ b/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/DebugFileStore.java @@ -155,7 +155,7 @@ public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreExcept } } else { IFileStore parent = getParent(); - if (parent.fetchInfo().exists()) { + if (parent.exists()) { DebugFileSystem.getDefault().setContents(toURI(), DebugFileSystem.DIRECTORY_BYTES); } else if ((options & EFS.SHALLOW) > 0) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests", //$NON-NLS-1$ diff --git a/docs/FAQ/FAQ_How_do_I_open_an_editor_on_a_file_outside_the_workspace.md b/docs/FAQ/FAQ_How_do_I_open_an_editor_on_a_file_outside_the_workspace.md index 79766cb5cbe..6c12b61937a 100644 --- a/docs/FAQ/FAQ_How_do_I_open_an_editor_on_a_file_outside_the_workspace.md +++ b/docs/FAQ/FAQ_How_do_I_open_an_editor_on_a_file_outside_the_workspace.md @@ -11,7 +11,7 @@ Since 3.3 you can use the new EFS support to open an text editor on a file outsi return; IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(filterPath)); fileStore = fileStore.getChild(names[i]); - if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) { + if (!fileStore.isDirectory() && fileStore.exists()) { IWorkbenchPage page= window.getActivePage(); try { IDE.openEditorOnFileStore(page, fileStore); diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileStore.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileStore.java index d2845f713b1..43aed9e1230 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileStore.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileStore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. + * Copyright (c) 2005, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -224,6 +224,26 @@ public interface IFileStore extends IAdaptable { */ public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException; + /** + * Returns whether this file or directory exists in the underlying file system. + * + * @return {@code true} if this file exists, and {@code false} if the file does not exist or an I/O error was encountered. + * @since 1.12 + */ + public default boolean exists() { + return fetchInfo().exists(); + } + + /** + * Returns whether this file is a directory, or {@code false} if this file does not exist. + * + * @return {@code true} if this is an existing directory, and {@code false} otherwise. + * @since 1.12 + */ + public default boolean isDirectory() { + return fetchInfo().isDirectory(); + } + /** * Returns a child of this store as specified by the provided path. The * path is treated as relative to this store. This is equivalent to diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileStore.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileStore.java index 91e54c36b8c..9f80e87f327 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileStore.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileStore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2024 IBM Corporation and others. + * Copyright (c) 2005, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -161,7 +161,7 @@ protected void copyDirectory(IFileInfo sourceInfo, IFileStore destination, int o * */ protected void copyFile(IFileInfo sourceInfo, IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { - if ((options & EFS.OVERWRITE) == 0 && destination.fetchInfo().exists()) { + if ((options & EFS.OVERWRITE) == 0 && destination.exists()) { Policy.error(EFS.ERROR_EXISTS, NLS.bind(Messages.fileExists, destination)); } String sourcePath = toString(); @@ -236,9 +236,7 @@ public IFileInfo fetchInfo() { return fetchInfo(EFS.NONE, null); } catch (CoreException e) { //there was an error contacting the file system, so treat it as non-existent file - FileInfo result = new FileInfo(getName()); - result.setExists(false); - return result; + return new FileInfo(getName()); } } diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/BlobStore.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/BlobStore.java index 3587ef9d40e..40fe93b8cc8 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/BlobStore.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/BlobStore.java @@ -44,7 +44,7 @@ public class BlobStore { public BlobStore(IFileStore store, int limit) { Assert.isNotNull(store); localStore = store; - Assert.isTrue(localStore.fetchInfo().isDirectory()); + Assert.isTrue(localStore.isDirectory()); Assert.isTrue(limit == 256 || limit == 128 || limit == 64 || limit == 32 || limit == 16 || limit == 8 || limit == 4 || limit == 2 || limit == 1); mask = (byte) (limit - 1); } diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java index 487593b91b3..c2cf86af264 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java @@ -397,7 +397,7 @@ public void copy(IResource target, IResource destination, int updateFlags, IProg SubMonitor subMonitor = SubMonitor.convert(monitor, title, 100); IFileStore destinationStore = getStore(destination); - if (destinationStore.fetchInfo().exists()) { + if (destinationStore.exists()) { String message = NLS.bind(Messages.localstore_resourceExists, destination.getFullPath()); throw new ResourceException(IResourceStatus.FAILED_WRITE_LOCAL, destination.getFullPath(), message, null); } @@ -575,7 +575,7 @@ public IFile fileForLocation(IPath location) { public int getEncoding(File target) throws CoreException { // thread safety: (the location can be null if the project for this file does not exist) IFileStore store = getStore(target); - if (!store.fetchInfo().exists()) { + if (!store.exists()) { String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.FAILED_READ_LOCAL, target.getFullPath(), message, null); } @@ -675,7 +675,7 @@ protected Workspace getWorkspace() { * Returns whether the project has any local content on disk. */ public boolean hasSavedContent(IProject project) { - return getStore(project).fetchInfo().exists(); + return getStore(project).exists(); } /** @@ -684,8 +684,8 @@ public boolean hasSavedContent(IProject project) { public boolean hasSavedDescription(IProject project) { IResource dotProjectResource = project.getFile(IProjectDescription.DESCRIPTION_FILE_NAME); return dotProjectResource.exists() ? // - getStore(dotProjectResource).fetchInfo().exists() : // - getStore(project).getChild(IProjectDescription.DESCRIPTION_FILE_NAME).fetchInfo().exists(); + getStore(dotProjectResource).exists() : // + getStore(project).getChild(IProjectDescription.DESCRIPTION_FILE_NAME).exists(); } /** @@ -1017,7 +1017,7 @@ public ProjectDescription read(IProject target, boolean creation) throws CoreExc if (description != null) { return description; } - if (!descriptionStore.fetchInfo().exists()) { + if (!descriptionStore.exists()) { String msg = NLS.bind(Messages.resources_missingProjectMeta, target.getName()); throw new ResourceException(IResourceStatus.FAILED_READ_METADATA, target.getFullPath(), msg, null); } @@ -1381,8 +1381,7 @@ && storeHistory(target)) { } if (!assumeParentDirectoryExists && !fileInfo.exists()) { IFileStore parent = store.getParent(); - IFileInfo parentInfo = parent.fetchInfo(); - if (!parentInfo.exists()) { + if (!parent.exists()) { parent.mkdir(EFS.NONE, null); } } @@ -1436,8 +1435,7 @@ public void write(IFile target, byte[] content, IFileInfo fileInfo, int updateFl throw e; } IFileStore parent = store.getParent(); - IFileInfo parentInfo = parent.fetchInfo(); - if (parentInfo.exists()) { + if (parent.exists()) { throw e; } // create missing folders: diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/HistoryStore2.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/HistoryStore2.java index b1858e8edde..f9879d424e7 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/HistoryStore2.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/HistoryStore2.java @@ -291,7 +291,7 @@ public synchronized void copyHistory(IResource sourceResource, IResource destina @Override public boolean exists(IFileState target) { - return blobStore.fileFor(((FileState) target).getUUID()).fetchInfo().exists(); + return blobStore.fileFor(((FileState) target).getUUID()).exists(); } @Override diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalAliasVisitor.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalAliasVisitor.java index 39088f39799..80cc2f9d661 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalAliasVisitor.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalAliasVisitor.java @@ -56,7 +56,7 @@ protected void deleteResource(UnifiedTreeNode node, Resource target) throws Core IResource[] aliases = workspace.getAliasManager().computeAliases(target, store); if (aliases != null) { boolean wasFilteredOut = false; - if (store.fetchInfo() != null && store.fetchInfo().exists()) { + if (store.exists()) { wasFilteredOut = target.isFiltered(); } for (IResource aliase : aliases) { diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/PollingMonitor.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/PollingMonitor.java index f35cffa2b8c..66547677619 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/PollingMonitor.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/PollingMonitor.java @@ -21,9 +21,15 @@ import org.eclipse.core.internal.resources.Resource; import org.eclipse.core.internal.utils.Messages; import org.eclipse.core.internal.utils.Policy; -import org.eclipse.core.resources.*; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.refresh.IRefreshMonitor; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.osgi.framework.Bundle; @@ -192,7 +198,7 @@ private void poll(IResource resource) { return; } //don't refresh links with no local content - if (resource.isLinked() && !((Resource) resource).getStore().fetchInfo().exists()) { + if (resource.isLinked() && !((Resource) resource).getStore().exists()) { return; } //submit refresh request diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/AliasManager.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/AliasManager.java index 2fdcf71f8a7..4519fd042cb 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/AliasManager.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/AliasManager.java @@ -467,7 +467,7 @@ private void buildLocationsMap() { * @exception CoreException */ private boolean checkDeletion(Project project, IFileStore location) throws CoreException { - if (project.exists() && !location.fetchInfo().exists()) { + if (project.exists() && !location.exists()) { //perform internal deletion of project from workspace tree because // it is already deleted from disk and we can't acquire a different //scheduling rule in this context (none is needed because we are diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java index 47413ea6c2c..29306631f33 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java @@ -30,7 +30,6 @@ import java.util.Map; import java.util.TreeSet; import org.eclipse.core.filesystem.EFS; -import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.internal.events.LifecycleEvent; import org.eclipse.core.internal.preferences.EclipsePreferences; @@ -100,8 +99,7 @@ protected void assertCreateRequirements(IProjectDescription description) throws //if the project is in the default location, need to check for collision with existing folder of different case if (!Workspace.caseSensitive) { IFileStore store = getStore(); - IFileInfo localInfo = store.fetchInfo(); - if (localInfo.exists()) { + if (store.exists()) { String name = getLocalManager().getLocalName(store); if (name != null && !store.getName().equals(name)) { String msg = NLS.bind(Messages.resources_existsLocalDifferentCase, IPath.fromOSString(store.toString()).removeLastSegments(1).append(name).toOSString()); diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java index cac927a0644..1c1ce6d3dc4 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java @@ -15,14 +15,35 @@ package org.eclipse.core.internal.resources; import java.net.URI; -import org.eclipse.core.filesystem.*; +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileInfo; +import org.eclipse.core.filesystem.IFileStore; +import org.eclipse.core.filesystem.IFileSystem; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.internal.localstore.FileSystemResourceManager; import org.eclipse.core.internal.properties.IPropertyManager; -import org.eclipse.core.internal.utils.*; -import org.eclipse.core.resources.*; +import org.eclipse.core.internal.utils.BitMask; +import org.eclipse.core.internal.utils.Messages; +import org.eclipse.core.internal.utils.Policy; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceStatus; +import org.eclipse.core.resources.IResourceVisitor; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.team.IResourceTree; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubMonitor; import org.eclipse.core.runtime.jobs.ILock; import org.eclipse.osgi.util.NLS; @@ -201,7 +222,7 @@ public void deletedProject(IProject target) { private boolean ensureDestinationEmpty(IProject source, IFileStore destinationStore, IProgressMonitor monitor) throws CoreException { String message; //Make sure the destination location is unoccupied - if (!destinationStore.fetchInfo().exists()) { + if (!destinationStore.exists()) { return true; } //check for existing children @@ -289,7 +310,7 @@ private boolean internalDeleteFile(IFile file, int flags, IProgressMonitor monit // If the file doesn't exist on disk then signal to the workspace to delete the // file and return. IFileStore fileStore = localManager.getStore(file); - boolean localExists = fileStore.fetchInfo().exists(); + boolean localExists = fileStore.exists(); if (!localExists) { deletedFile(file); // Indicate that the delete was successful. @@ -363,7 +384,7 @@ private boolean internalDeleteFolder(IFolder folder, int flags, IProgressMonitor // If the folder doesn't exist on disk then update the tree and return. IFileStore fileStore = localManager.getStore(folder); - if (!fileStore.fetchInfo().exists()) { + if (!fileStore.exists()) { deletedFolder(folder); return true; } @@ -970,7 +991,7 @@ public void standardMoveFile(IFile source, IFile destination, int flags, IProgre } catch (CoreException e) { failed(e.getStatus()); // did the fail occur after copying to the destination? - failedDeletingSource = destStore != null && destStore.fetchInfo().exists(); + failedDeletingSource = destStore != null && destStore.exists(); // if so, we should proceed if (!failedDeletingSource) { return; @@ -1039,7 +1060,7 @@ public void standardMoveFolder(IFolder source, IFolder destination, int flags, I } catch (CoreException e) { failed(e.getStatus()); // did the fail occur after copying to the destination? - failedDeletingSource = destStore != null && destStore.fetchInfo().exists(); + failedDeletingSource = destStore != null && destStore.exists(); // if so, we should proceed if (!failedDeletingSource) { return; diff --git a/resources/examples/org.eclipse.ui.examples.filesystem/META-INF/MANIFEST.MF b/resources/examples/org.eclipse.ui.examples.filesystem/META-INF/MANIFEST.MF index 325dc32f3e9..b2a8ed32f21 100644 --- a/resources/examples/org.eclipse.ui.examples.filesystem/META-INF/MANIFEST.MF +++ b/resources/examples/org.eclipse.ui.examples.filesystem/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Automatic-Module-Name: org.eclipse.ui.examples.filesystem Bundle-Name: Efs Examples Plug-in Bundle-SymbolicName: org.eclipse.ui.examples.filesystem;singleton:=true -Bundle-Version: 1.2.100.qualifier +Bundle-Version: 1.2.200.qualifier Bundle-Vendor: Eclipse.org Require-Bundle: org.eclipse.core.filesystem, org.eclipse.core.resources, diff --git a/resources/examples/org.eclipse.ui.examples.filesystem/src/org/eclipse/ui/examples/filesystem/NestedProjectCreator.java b/resources/examples/org.eclipse.ui.examples.filesystem/src/org/eclipse/ui/examples/filesystem/NestedProjectCreator.java index 6ad9d4c4c91..f7674806fe9 100644 --- a/resources/examples/org.eclipse.ui.examples.filesystem/src/org/eclipse/ui/examples/filesystem/NestedProjectCreator.java +++ b/resources/examples/org.eclipse.ui.examples.filesystem/src/org/eclipse/ui/examples/filesystem/NestedProjectCreator.java @@ -185,8 +185,7 @@ private void searchInLink(IResource link) { private void searchInStore(IFileStore store) { try { if (store.getName().equals(IProjectDescription.DESCRIPTION_FILE_NAME)) { - IFileInfo info = store.fetchInfo(); - if (!info.isDirectory()) { + if (!store.isDirectory()) { try (InputStream input = store.openInputStream(EFS.NONE, null)) { IProjectDescription description = workspace.loadProjectDescription(input); description.setLocationURI(store.getParent().toURI()); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/DeleteTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/DeleteTest.java index 25aff8e41dc..050cb39fa3e 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/DeleteTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/DeleteTest.java @@ -43,9 +43,9 @@ public void testDeleteFile() throws Exception { IFileStore file = baseStore.getChild("child"); ensureExists(file, false); - assertTrue(file.fetchInfo().exists()); + assertTrue(file.exists()); file.delete(EFS.NONE, getMonitor()); - assertFalse(file.fetchInfo().exists()); + assertFalse(file.exists()); } @Test @@ -54,9 +54,9 @@ public void testDeleteDirectory() throws Exception { IFileStore dir = baseStore.getChild("child"); ensureExists(dir, true); - assertTrue(dir.fetchInfo().exists()); + assertTrue(dir.exists()); dir.delete(EFS.NONE, getMonitor()); - assertFalse(dir.fetchInfo().exists()); + assertFalse(dir.exists()); } @Test @@ -65,11 +65,11 @@ public void testDeleteReadOnlyFile() throws Exception { ensureExists(localFileBaseStore, true); IFileStore file = localFileBaseStore.getChild("child"); ensureExists(file, false); - assertTrue(file.fetchInfo().exists()); + assertTrue(file.exists()); ensureReadOnlyLocal(file); file.delete(EFS.NONE, getMonitor()); // success: we expect that read-only files can be removed - assertFalse(file.fetchInfo().exists()); + assertFalse(file.exists()); } /** diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/FileStoreTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/FileStoreTest.java index 30a8aaeb50e..c88fd883402 100755 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/FileStoreTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/FileStoreTest.java @@ -74,7 +74,7 @@ public class FileStoreTest { private static final Random RANDOM = new Random(); private IFileStore createDir(IFileStore store, boolean clear) throws CoreException { - if (clear && store.fetchInfo().exists()) { + if (clear && store.exists()) { store.delete(EFS.NONE, null); } store.mkdir(EFS.NONE, null); @@ -190,7 +190,7 @@ public void testCopyAcrossVolumes(int fileSize) throws Throwable { destination = tempDest.getChild(subfolderName); String anotherContent = "nothing..................gnihton"; createFile(destination, anotherContent); - assertTrue(!destination.fetchInfo().isDirectory()); + assertTrue(!destination.isDirectory()); final IFileStore immutableDestination = destination; assertThrows(CoreException.class, () -> target.copy(immutableDestination, EFS.NONE, null)); assertTrue(!verifyTree(getTree(destination))); @@ -209,7 +209,7 @@ public void testCopyDirectory() throws Throwable { /* build scenario */ IFileStore temp = randomUniqueNotExistingFileStore(); temp.mkdir(EFS.NONE, null); - assertTrue(temp.fetchInfo().isDirectory()); + assertTrue(temp.isDirectory()); // create tree IFileStore target = temp.getChild("target"); target.delete(EFS.NONE, null); @@ -230,7 +230,7 @@ public void testCopyDirectoryParentMissing() throws Throwable { // try to copy when parent of destination does not exist assertThrows(CoreException.class, () -> existing.copy(child, EFS.NONE, createTestMonitor())); // destination should not exist - assertTrue(!child.fetchInfo().exists()); + assertTrue(!child.exists()); } @ParameterizedTest(name = "File size {0} bytes") @@ -248,7 +248,7 @@ public void testCaseInsensitive(int fileSize) throws Throwable { fileWithSmallName.delete(EFS.NONE, null); createFile(fileWithSmallName, content); System.out.println(fileWithSmallName.fetchInfo().getName()); - assertTrue(fileWithSmallName.fetchInfo().exists()); + assertTrue(fileWithSmallName.exists()); assertTrue( Arrays.equals(content, fileWithSmallName.readAllBytes(EFS.NONE, null))); IFileStore fileWithOtherName = temp.getChild("FILENAME"); @@ -258,11 +258,11 @@ public void testCaseInsensitive(int fileSize) throws Throwable { fileWithSmallName.copy(fileWithOtherName, IResource.DEPTH_INFINITE, null); // a NOP Operation // file content is still the same for both Cases: assertTrue(Arrays.equals(content, fileWithOtherName.readAllBytes(EFS.NONE, null))); - assertTrue(fileWithOtherName.fetchInfo().exists()); - assertTrue(fileWithSmallName.fetchInfo().exists()); + assertTrue(fileWithOtherName.exists()); + assertTrue(fileWithSmallName.exists()); fileWithOtherName.delete(EFS.NONE, null); - assertFalse(fileWithOtherName.fetchInfo().exists()); - assertFalse(fileWithSmallName.fetchInfo().exists()); + assertFalse(fileWithOtherName.exists()); + assertFalse(fileWithSmallName.exists()); CoreException exception = assertThrows(CoreException.class, () -> fileWithSmallName.move(fileWithOtherName, EFS.NONE, null)); String message = NLS.bind(Messages.couldNotMove, fileWithSmallName.toString()); @@ -281,7 +281,7 @@ public void testCopyFile(int fileSize) throws Throwable { IFileStore target = temp.getChild("target"); target.delete(EFS.NONE, null); createFile(target, content); - assertTrue(target.fetchInfo().exists()); + assertTrue(target.exists()); assertTrue(Arrays.equals(content, target.readAllBytes(EFS.NONE, null))); /* temp\target -> temp\copy of target */ @@ -333,7 +333,7 @@ public void testCopyFileAcrossVolumes(int fileSize) throws Throwable { IFileStore target = tempSrc.getChild(subfolderName); target.delete(EFS.NONE, null); createFile(target, content); - assertTrue(target.fetchInfo().exists()); + assertTrue(target.exists()); assertTrue(Arrays.equals(content, target.readAllBytes(EFS.NONE, null))); /* c:\temp\target -> d:\temp\target */ @@ -353,7 +353,7 @@ public void testCopyFileAcrossVolumes(int fileSize) throws Throwable { destination = tempDest.getChild(subfolderName); String anotherContent = "nothing..................gnihton"; createFile(destination, anotherContent); - assertTrue(!destination.fetchInfo().isDirectory()); + assertTrue(!destination.isDirectory()); target.copy(destination, IResource.DEPTH_INFINITE, null); assertTrue(Arrays.equals(content, destination.readAllBytes(EFS.NONE, null))); destination.delete(EFS.NONE, null); @@ -361,13 +361,13 @@ public void testCopyFileAcrossVolumes(int fileSize) throws Throwable { /* c:\temp\target -> d:\temp\target (but the destination is already a folder */ destination = tempDest.getChild(subfolderName); createDir(destination, true); - assertTrue(destination.fetchInfo().isDirectory()); + assertTrue(destination.isDirectory()); final IFileStore immutableDestination = destination; assertThrows(CoreException.class, () -> target.copy(immutableDestination, EFS.NONE, null)); /* test if the input stream inside the copy method was closed */ target.delete(EFS.NONE, null); createFile(target, content); - assertTrue(destination.fetchInfo().isDirectory()); + assertTrue(destination.isDirectory()); destination.delete(EFS.NONE, null); } @@ -441,24 +441,24 @@ public void testDelete() throws Throwable { } createTree(treeItems.toArray(IFileStore[]::new)); - assertTrue(singleDirectory.fetchInfo().exists()); + assertTrue(singleDirectory.exists()); long n0 = System.nanoTime(); singleDirectory.delete(EFS.NONE, null); long n1 = System.nanoTime(); System.out.println("delete singleDirectory took ms:" + (n1 - n0) / 1_000_000); - assertFalse(singleDirectory.fetchInfo().exists()); + assertFalse(singleDirectory.exists()); } { IFileStore binaryTree = tempC.getChild("tree"); createDir(binaryTree, true); createChildDirs(binaryTree, 2, 10); - assertTrue(binaryTree.fetchInfo().exists()); + assertTrue(binaryTree.exists()); long n0 = System.nanoTime(); binaryTree.delete(EFS.NONE, null); long n1 = System.nanoTime(); System.out.println("delete binaryTree took ms:" + (n1 - n0) / 1_000_000); - assertFalse(binaryTree.fetchInfo().exists()); + assertFalse(binaryTree.exists()); } } @@ -481,7 +481,7 @@ public void testMove() throws Throwable { IFileStore target = tempC.getChild("target"); String content = "just a content.....tnetnoc a tsuj"; createFile(target, content); - assertTrue(target.fetchInfo().exists()); + assertTrue(target.exists()); // create target tree IFileStore tree = tempC.getChild("tree"); createDir(tree, true); @@ -490,37 +490,37 @@ public void testMove() throws Throwable { /* rename file */ IFileStore destination = tempC.getChild("destination"); target.move(destination, EFS.NONE, null); - assertTrue(!destination.fetchInfo().isDirectory()); - assertTrue(!target.fetchInfo().exists()); + assertTrue(!destination.isDirectory()); + assertTrue(!target.exists()); destination.move(target, EFS.NONE, null); - assertTrue(!target.fetchInfo().isDirectory()); - assertTrue(!destination.fetchInfo().exists()); + assertTrue(!target.isDirectory()); + assertTrue(!destination.exists()); /* rename file (but destination is already a file) */ String anotherContent = "another content"; createFile(destination, anotherContent); final IFileStore immutableFileDestination = destination; assertThrows(CoreException.class, () -> target.move(immutableFileDestination, EFS.NONE, null)); - assertTrue(!target.fetchInfo().isDirectory()); + assertTrue(!target.isDirectory()); destination.delete(EFS.NONE, null); - assertTrue(!destination.fetchInfo().exists()); + assertTrue(!destination.exists()); /* rename file (but destination is already a folder) */ createDir(destination, true); final IFileStore immutableFolderDestination = destination; assertThrows(CoreException.class, () -> target.move(immutableFolderDestination, EFS.NONE, null)); - assertTrue(!target.fetchInfo().isDirectory()); + assertTrue(!target.isDirectory()); destination.delete(EFS.NONE, null); - assertTrue(!destination.fetchInfo().exists()); + assertTrue(!destination.exists()); /* rename folder */ destination = tempC.getChild("destination"); tree.move(destination, EFS.NONE, null); assertTrue(verifyTree(getTree(destination))); - assertTrue(!tree.fetchInfo().exists()); + assertTrue(!tree.exists()); destination.move(tree, EFS.NONE, null); assertTrue(verifyTree(getTree(tree))); - assertTrue(!destination.fetchInfo().exists()); + assertTrue(!destination.exists()); } @Test @@ -542,7 +542,7 @@ public void testMoveAcrossVolumes() throws Throwable { IFileStore target = tempSrc.getChild(subfolderName); String content = "just a content.....tnetnoc a tsuj"; createFile(target, content); - assertTrue(target.fetchInfo().exists()); + assertTrue(target.exists()); // create target tree IFileStore tree = tempSrc.getChild("tree"); createDir(tree, true); @@ -551,20 +551,20 @@ public void testMoveAcrossVolumes() throws Throwable { /* move file across volumes */ IFileStore destination = tempDest.getChild(subfolderName); target.move(destination, EFS.NONE, null); - assertTrue(!destination.fetchInfo().isDirectory()); - assertTrue(!target.fetchInfo().exists()); + assertTrue(!destination.isDirectory()); + assertTrue(!target.exists()); destination.move(target, EFS.NONE, null); - assertTrue(!target.fetchInfo().isDirectory()); - assertTrue(!destination.fetchInfo().exists()); + assertTrue(!target.isDirectory()); + assertTrue(!destination.exists()); /* move folder across volumes */ destination = tempDest.getChild(subfolderName); tree.move(destination, EFS.NONE, null); assertTrue(verifyTree(getTree(destination))); - assertTrue(!tree.fetchInfo().exists()); + assertTrue(!tree.exists()); destination.move(tree, EFS.NONE, null); assertTrue(verifyTree(getTree(tree))); - assertTrue(!destination.fetchInfo().exists()); + assertTrue(!destination.exists()); } @Test @@ -576,7 +576,7 @@ public void testMoveDirectoryParentMissing() throws Throwable { // try to move when parent of destination does not exist assertThrows(CoreException.class, () -> existing.move(child, EFS.NONE, createTestMonitor())); // destination should not exist - assertTrue(!child.fetchInfo().exists()); + assertTrue(!child.exists()); } /** @@ -775,7 +775,7 @@ public void testSortOrderPaths() { private boolean verifyNode(IFileStore node) { char type = node.getName().charAt(0); // if the name starts with d it must be a directory - return (type == 'd') == node.fetchInfo().isDirectory(); + return (type == 'd') == node.isDirectory(); } private boolean verifyTree(IFileStore[] tree) { diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/FileSystemTestUtil.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/FileSystemTestUtil.java index 0756f6191ce..85c9b22d311 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/FileSystemTestUtil.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/FileSystemTestUtil.java @@ -30,7 +30,7 @@ private FileSystemTestUtil() { static void ensureDoesNotExist(IFileStore store) throws CoreException { store.delete(EFS.NONE, getMonitor()); - assertFalse(store.fetchInfo().exists(), "store was not properly deleted: " + store); + assertFalse(store.exists(), "store was not properly deleted: " + store); } /** diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java index f3d50f9db9a..3cfccaa3b78 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java @@ -443,12 +443,12 @@ public void testBug258987(@TempDir Path tempDirectory) throws Exception { // Create the directory to which you will link. The directory needs a single file. IFileStore dirStore = getFileStore(tempDirectory); dirStore.mkdir(EFS.NONE, createTestMonitor()); - assertTrue(dirStore.fetchInfo().exists()); - assertTrue(dirStore.fetchInfo().isDirectory()); + assertTrue(dirStore.exists()); + assertTrue(dirStore.isDirectory()); IFileStore childStore = dirStore.getChild("child"); createInFileSystem(childStore); - assertTrue(childStore.fetchInfo().exists()); + assertTrue(childStore.exists()); // Create and open the first project. Project links to the directory. IProject project1 = ResourcesPlugin.getWorkspace().getRoot().getProject("project1"); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BlobStoreTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BlobStoreTest.java index ac87a6b6816..4d9189d61e0 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BlobStoreTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BlobStoreTest.java @@ -82,17 +82,17 @@ public void testDeleteBlob() throws CoreException, IOException { /* delete blob that does not exist */ UniversalUniqueIdentifier uuid = new UniversalUniqueIdentifier(); - assertTrue(!store.fileFor(uuid).fetchInfo().exists()); + assertTrue(!store.fileFor(uuid).exists()); store.deleteBlob(uuid); - assertTrue(!store.fileFor(uuid).fetchInfo().exists()); + assertTrue(!store.fileFor(uuid).exists()); /* delete existing blob */ IFileStore target = root.getChild("target"); createInFileSystem(target); uuid = store.addBlob(target, true); - assertTrue(store.fileFor(uuid).fetchInfo().exists()); + assertTrue(store.fileFor(uuid).exists()); store.deleteBlob(uuid); - assertFalse(store.fileFor(uuid).fetchInfo().exists()); + assertFalse(store.fileFor(uuid).exists()); } @Test diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/FileSystemResourceManagerTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/FileSystemResourceManagerTest.java index 8c8d955c491..050c834f551 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/FileSystemResourceManagerTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/FileSystemResourceManagerTest.java @@ -402,11 +402,11 @@ public void testWriteProject() throws CoreException { // wrap in runnable to prevent snapshot from occurring in the middle. getWorkspace().run((IWorkspaceRunnable) monitor -> { removeFromFileSystem(project); - assertFalse(fileStore.fetchInfo().isDirectory()); + assertFalse(fileStore.isDirectory()); //write project in a runnable, otherwise tree will be locked ((Project) project).writeDescription(IResource.FORCE); }, null); - assertTrue(fileStore.fetchInfo().isDirectory()); + assertTrue(fileStore.isDirectory()); long lastModified = ((Resource) dotProject).getStore().fetchInfo().getLastModified(); assertEquals(lastModified, ((Resource) project).getResourceInfo(false, false).getLocalSyncInfo()); } diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java index 113fa4ee5c8..9328100ddd4 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java @@ -712,9 +712,9 @@ public void testProjectDeletionClosedDefaultInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertFalse(otherFileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); + assertFalse(otherFileStore.exists()); /* ====================================================================== * Force = FALSE @@ -742,9 +742,9 @@ public void testProjectDeletionClosedDefaultInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertFalse(otherFileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); + assertFalse(otherFileStore.exists()); /* ====================================================================== * Force = TRUE @@ -773,9 +773,9 @@ public void testProjectDeletionClosedDefaultInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -805,9 +805,9 @@ public void testProjectDeletionClosedDefaultInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -837,9 +837,9 @@ public void testProjectDeletionClosedDefaultInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -869,9 +869,9 @@ public void testProjectDeletionClosedDefaultInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); } @@ -904,7 +904,7 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { project.close(monitor); monitor.assertUsedUp(); createInFileSystem(otherFileStore); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(otherFileStore.exists()); assertTrue(project.exists()); assertFalse(project.isOpen()); assertFalse(project.isAccessible()); @@ -918,9 +918,9 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertFalse(otherFileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); + assertFalse(otherFileStore.exists()); /* ====================================================================== * Force = FALSE @@ -937,7 +937,7 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { project.close(monitor); monitor.assertUsedUp(); createInFileSystem(otherFileStore); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(otherFileStore.exists()); assertTrue(project.exists()); assertFalse(project.isOpen()); assertFalse(project.isAccessible()); @@ -949,9 +949,9 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertFalse(otherFileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); + assertFalse(otherFileStore.exists()); /* ====================================================================== * Force = TRUE @@ -968,7 +968,7 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { project.close(monitor); monitor.assertUsedUp(); createInFileSystem(otherFileStore); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(otherFileStore.exists()); assertTrue(project.exists()); assertFalse(project.isOpen()); assertFalse(project.isAccessible()); @@ -980,9 +980,9 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1001,7 +1001,7 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { project.close(monitor); monitor.assertUsedUp(); createInFileSystem(otherFileStore); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(otherFileStore.exists()); assertTrue(project.exists()); assertFalse(project.isOpen()); assertFalse(project.isAccessible()); @@ -1013,9 +1013,9 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1034,7 +1034,7 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { project.close(monitor); monitor.assertUsedUp(); createInFileSystem(otherFileStore); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(otherFileStore.exists()); assertTrue(project.exists()); assertFalse(project.isOpen()); assertFalse(project.isAccessible()); @@ -1046,9 +1046,9 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1067,7 +1067,7 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { project.close(monitor); monitor.assertUsedUp(); createInFileSystem(otherFileStore); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(otherFileStore.exists()); assertTrue(project.exists()); assertFalse(project.isOpen()); assertFalse(project.isAccessible()); @@ -1079,9 +1079,9 @@ public void testProjectDeletionClosedDefaultOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); } @@ -1121,8 +1121,8 @@ public void testProjectDeletionClosedUserDefinedInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); projectStore.delete(EFS.NONE, null); /* ====================================================================== @@ -1145,8 +1145,8 @@ public void testProjectDeletionClosedUserDefinedInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); projectStore.delete(EFS.NONE, null); /* ====================================================================== @@ -1168,8 +1168,8 @@ public void testProjectDeletionClosedUserDefinedInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1192,8 +1192,8 @@ public void testProjectDeletionClosedUserDefinedInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1216,8 +1216,8 @@ public void testProjectDeletionClosedUserDefinedInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1240,8 +1240,8 @@ public void testProjectDeletionClosedUserDefinedInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); } @@ -1286,9 +1286,9 @@ public void testProjectDeletionClosedUserDefinedOutOfSync() throws Exception { assertFalse(file.exists()); assertFalse(otherFile.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertFalse(otherFileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); + assertFalse(otherFileStore.exists()); projectStore.delete(EFS.NONE, null); /* ====================================================================== @@ -1315,9 +1315,9 @@ public void testProjectDeletionClosedUserDefinedOutOfSync() throws Exception { assertFalse(file.exists()); assertFalse(otherFile.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertFalse(otherFileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); + assertFalse(otherFileStore.exists()); projectStore.delete(EFS.NONE, null); /* ====================================================================== @@ -1343,9 +1343,9 @@ public void testProjectDeletionClosedUserDefinedOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1372,9 +1372,9 @@ public void testProjectDeletionClosedUserDefinedOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); /* ====================================================================== * Force = TRUE @@ -1400,9 +1400,9 @@ public void testProjectDeletionClosedUserDefinedOutOfSync() throws Exception { assertFalse(file.exists()); assertFalse(otherFile.exists()); // don't delete the directory itself since the location is user-defined, but delete the contents - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1430,9 +1430,9 @@ public void testProjectDeletionClosedUserDefinedOutOfSync() throws Exception { assertFalse(file.exists()); assertFalse(otherFile.exists()); // don't delete the directory itself since its user-defined, but delete the contents - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); } @@ -1464,8 +1464,8 @@ public void testProjectDeletionOpenDefaultInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1481,8 +1481,8 @@ public void testProjectDeletionOpenDefaultInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); /* ====================================================================== * Force = TRUE @@ -1498,8 +1498,8 @@ public void testProjectDeletionOpenDefaultInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1515,8 +1515,8 @@ public void testProjectDeletionOpenDefaultInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); /* ====================================================================== * Force = TRUE @@ -1532,8 +1532,8 @@ public void testProjectDeletionOpenDefaultInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1549,8 +1549,8 @@ public void testProjectDeletionOpenDefaultInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); } /** @@ -1582,8 +1582,8 @@ public void testProjectDeletionOpenDefaultOutOfSync() throws Exception { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1600,8 +1600,8 @@ public void testProjectDeletionOpenDefaultOutOfSync() throws Exception { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); /* ====================================================================== * Force = TRUE @@ -1618,8 +1618,8 @@ public void testProjectDeletionOpenDefaultOutOfSync() throws Exception { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1638,8 +1638,8 @@ public void testProjectDeletionOpenDefaultOutOfSync() throws Exception { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1658,8 +1658,8 @@ public void testProjectDeletionOpenDefaultOutOfSync() throws Exception { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1679,8 +1679,8 @@ public void testProjectDeletionOpenDefaultOutOfSync() throws Exception { }); assertTrue(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); } /** @@ -1714,8 +1714,8 @@ public void testProjectDeletionOpenUserDefinedInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1734,8 +1734,8 @@ public void testProjectDeletionOpenUserDefinedInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); /* ====================================================================== * Force = TRUE @@ -1753,8 +1753,8 @@ public void testProjectDeletionOpenUserDefinedInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1772,8 +1772,8 @@ public void testProjectDeletionOpenUserDefinedInSync() throws CoreException { monitor.assertUsedUp(); assertFalse(project.exists()); assertFalse(file.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1794,8 +1794,8 @@ public void testProjectDeletionOpenUserDefinedInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1814,8 +1814,8 @@ public void testProjectDeletionOpenUserDefinedInSync() throws CoreException { assertFalse(project.exists()); assertFalse(file.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); } /** @@ -1855,9 +1855,9 @@ public void testProjectDeletionOpenUserDefinedOutOfSync() throws Exception { assertFalse(file.exists()); assertFalse(otherFile.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertFalse(otherFileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); + assertFalse(otherFileStore.exists()); projectStore.delete(EFS.NONE, null); /* ====================================================================== @@ -1881,9 +1881,9 @@ public void testProjectDeletionOpenUserDefinedOutOfSync() throws Exception { assertFalse(file.exists()); assertFalse(otherFile.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertFalse(otherFileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); + assertFalse(otherFileStore.exists()); projectStore.delete(EFS.NONE, null); /* ====================================================================== @@ -1906,9 +1906,9 @@ public void testProjectDeletionOpenUserDefinedOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); // cleanup projectStore.delete(EFS.NONE, null); @@ -1932,9 +1932,9 @@ public void testProjectDeletionOpenUserDefinedOutOfSync() throws Exception { assertFalse(project.exists()); assertFalse(file.exists()); assertFalse(otherFile.exists()); - assertTrue(projectStore.fetchInfo().exists()); - assertTrue(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertTrue(fileStore.exists()); + assertTrue(otherFileStore.exists()); /* ====================================================================== * Force = TRUE @@ -1957,9 +1957,9 @@ public void testProjectDeletionOpenUserDefinedOutOfSync() throws Exception { assertFalse(file.exists()); assertFalse(otherFile.exists()); // ensure the project directory and files no longer exist - assertFalse(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertFalse(otherFileStore.fetchInfo().exists()); + assertFalse(projectStore.exists()); + assertFalse(fileStore.exists()); + assertFalse(otherFileStore.exists()); /* ====================================================================== * Force = FALSE @@ -1986,9 +1986,9 @@ public void testProjectDeletionOpenUserDefinedOutOfSync() throws Exception { assertFalse(file.exists()); assertFalse(otherFile.exists()); // don't delete the directory itself since its user-defined, but delete the contents - assertTrue(projectStore.fetchInfo().exists()); - assertFalse(fileStore.fetchInfo().exists()); - assertTrue(otherFileStore.fetchInfo().exists()); + assertTrue(projectStore.exists()); + assertFalse(fileStore.exists()); + assertTrue(otherFileStore.exists()); } /** diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceTest.java index a2474b1c2af..68fea26c26d 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceTest.java @@ -796,7 +796,7 @@ public void testDeleteLinkParent() throws CoreException { assertFalse(linkParent.exists()); assertFalse(link.exists()); assertFalse(linkChild.exists()); - assertTrue(childStore.fetchInfo().exists()); + assertTrue(childStore.exists()); } /** diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_032076.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_032076.java index 2828450dfaf..5bb2e2fd3d0 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_032076.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_032076.java @@ -406,7 +406,7 @@ public void testProjectBugOnLinux(@TempDir Path tempDirectory) throws CoreExcept assertNotNull(marker); assertEquals(attributeValue, marker.getAttribute(attributeKey)); // project's content area still exists in file system - assertThat(projectStore).matches(it -> it.fetchInfo().exists(), "exists"); + assertThat(projectStore).matches(IFileStore::exists, "exists"); assertThat(workspace.getRoot()).matches(isSynchronizedDepthInfinite, "is synchronized"); } finally { diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java index f9fdb367eaa..7c40c9f0a11 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java @@ -50,7 +50,7 @@ @ExtendWith(WorkspaceResetExtension.class) public class Bug_044106 { - private static final Predicate exists = store -> store.fetchInfo().exists(); + private static final Predicate exists = IFileStore::exists; private @TempDir Path tempDirectory; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFolderTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFolderTest.java index 36f91a34480..53c21deab13 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFolderTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/IFolderTest.java @@ -127,7 +127,7 @@ public void testBug514831() throws CoreException { createInWorkspace(new IResource[] {folder}); IFileStore dir = EFS.getLocalFileSystem().fromLocalFile(folder.getLocation().toFile()); - assertThat(dir).matches(it -> it.fetchInfo().exists(), "exists"); + assertThat(dir).matches(IFileStore::exists, "exists"); dir.mkdir(EFS.NONE, null); dir.mkdir(EFS.SHALLOW, null);