Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.core.filebuffers')
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
index 6f73ded95e0..99752828a0a 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
@@ -10,6 +10,8 @@ Contributors:
**********************************************************************/
package org.eclipse.core.filebuffers;
+import java.io.File;
+
import org.eclipse.core.internal.filebuffers.FileBuffersPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRoot;
@@ -72,4 +74,27 @@ public final class FileBuffers {
return fileLocation.makeAbsolute();
}
+
+ /**
+ * Returns the file in the local file system for the given location.
+ * <p>
+ * The location is either a full path of a workspace resource or an
+ * absolute path in the local file system.
+ * </p>
+ *
+ * @param location
+ * @return
+ */
+ public static File getSystemFileAtLocation(IPath location) {
+ if (location == null)
+ return null;
+
+ IFile file= getWorkspaceFileAtLocation(location);
+ if (file != null) {
+ IPath path= file.getLocation();
+ return path.toFile();
+ }
+
+ return location.toFile();
+ }
}

Back to the top