Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 121665 Details for
Bug 215261
[EFS] request to add method to IFileStore to get physical path
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Draft patch for approach 1. Derived from e4 repository.
efs_interface.patch.txt (text/plain), 32.45 KB, created by
Chris Recoskie
on 2009-01-06 13:14:03 EST
(
hide
)
Description:
Draft patch for approach 1. Derived from e4 repository.
Filename:
MIME Type:
Creator:
Chris Recoskie
Created:
2009-01-06 13:14:03 EST
Size:
32.45 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.filesystem >Index: src/org/eclipse/core/internal/filesystem/local/LocalFile.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java,v >retrieving revision 1.30 >diff -u -r1.30 LocalFile.java >--- src/org/eclipse/core/internal/filesystem/local/LocalFile.java 19 Nov 2008 15:09:14 -0000 1.30 >+++ src/org/eclipse/core/internal/filesystem/local/LocalFile.java 5 Jan 2009 18:59:59 -0000 >@@ -15,7 +15,7 @@ > import org.eclipse.core.filesystem.*; > import org.eclipse.core.filesystem.URIUtil; > import org.eclipse.core.filesystem.provider.FileInfo; >-import org.eclipse.core.filesystem.provider.FileStore; >+import org.eclipse.core.filesystem.provider.FileStore2; > import org.eclipse.core.internal.filesystem.Messages; > import org.eclipse.core.internal.filesystem.Policy; > import org.eclipse.core.runtime.*; >@@ -23,9 +23,9 @@ > > /** > * File system implementation based on storage of files in the local >- * operating system's file system. >+ * operating system's file system. The logical model and the physical model of the files are identical. > */ >-public class LocalFile extends FileStore { >+public class LocalFile extends FileStore2 { > /** > * The java.io.File that this store represents. > */ >@@ -84,6 +84,9 @@ > } > } > >+ /** >+ * @deprecated >+ */ > public String[] childNames(int options, IProgressMonitor monitor) { > String[] names = file.list(); > return (names == null ? EMPTY_STRING_ARRAY : names); >@@ -163,14 +166,23 @@ > return info; > } > >+ /** >+ * @deprecated >+ */ > public IFileStore getChild(IPath path) { > return new LocalFile(new File(file, path.toOSString())); > } > >+ /** >+ * @deprecated >+ */ > public IFileStore getFileStore(IPath path) { > return new LocalFile(new Path(file.getPath()).append(path).toFile()); > } > >+ /** >+ * @deprecated >+ */ > public IFileStore getChild(String name) { > return new LocalFile(new File(file, name)); > } >@@ -183,10 +195,16 @@ > return LocalFileSystem.getInstance(); > } > >+ /** >+ * @deprecated >+ */ > public String getName() { > return file.getName(); > } > >+ /** >+ * @deprecated >+ */ > public IFileStore getParent() { > File parent = file.getParentFile(); > return parent == null ? null : new LocalFile(parent); >@@ -252,6 +270,9 @@ > return false; > } > >+ /** >+ * @deprecated >+ */ > public boolean isParentOf(IFileStore other) { > if (!(other instanceof LocalFile)) > return false; >@@ -425,4 +446,81 @@ > public URI toURI() { > return URIUtil.toURI(filePath); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalChild(java.lang.String) >+ */ >+ public IFileStore getPhysicalChild(String name) { >+ return getLogicalChild(name); // physical and logical are the same in this case >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalChildInfos(int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IFileInfo[] getPhysicalChildInfos(int options, IProgressMonitor monitor) throws CoreException { >+ return getLogicalChildInfos(options, monitor); // physical and logical are the same in this case >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalChildNames(int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public String[] getPhysicalChildNames(int options, IProgressMonitor monitor) throws CoreException { >+ return getLogicalChildNames(options, monitor); // physical and logical are the same in this case >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalChildren(int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IFileStore[] getPhysicalChildren(int options, IProgressMonitor monitor) throws CoreException { >+ return getLogicalChildren(options, monitor); // physical and logical are the same in this case >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalFilename() >+ */ >+ public String getPhysicalName() { >+ return getLogicalName(); // physical and logical are the same in this case >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalParent() >+ */ >+ public IFileStore getPhysicalParent() throws CoreException { >+ return getLogicalParent(); // physical and logical are the same in this case >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#isPhysicalFile() >+ */ >+ public boolean isPhysical() { >+ return true; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#isPhysicalParentOf(org.eclipse.core.filesystem.IFileStore) >+ */ >+ public boolean isPhysicalParentOf(IFileStore other) { >+ return isLogicalParentOf(other); // physical and logical are the same in this case >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalLocation() >+ */ >+ public String getPhysicalLocation() { >+ return filePath; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getFileStoreLogical(org.eclipse.core.runtime.IPath) >+ */ >+ public IFileStore getFileStoreLogical(IPath logicalPath) { >+ return getFileStore(logicalPath); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getFileStorePhysical(org.eclipse.core.runtime.IPath) >+ */ >+ public IFileStore getFileStorePhysical(IPath physicalPath) { >+ return getFileStoreLogical(physicalPath); // physical and logical are the same in this case >+ } > } >Index: src/org/eclipse/core/filesystem/provider/FileStore.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileStore.java,v >retrieving revision 1.29 >diff -u -r1.29 FileStore.java >--- src/org/eclipse/core/filesystem/provider/FileStore.java 17 Apr 2008 12:54:59 -0000 1.29 >+++ src/org/eclipse/core/filesystem/provider/FileStore.java 5 Jan 2009 18:59:59 -0000 >@@ -98,6 +98,8 @@ > * Subclasses should override this method where a more efficient implementation > * is possible. This default implementation calls {@link #fetchInfo()} on each > * child, which will result in a file system call for each child. >+ * >+ * @deprecated > */ > public IFileInfo[] childInfos(int options, IProgressMonitor monitor) throws CoreException { > IFileStore[] childStores = childStores(options, monitor); >@@ -108,14 +110,16 @@ > return childInfos; > } > >- /* (non-Javadoc) >+ /** > * @see org.eclipse.core.filesystem.IFileStore#childNames(int, org.eclipse.core.runtime.IProgressMonitor) >+ * @deprecated > */ > public abstract String[] childNames(int options, IProgressMonitor monitor) throws CoreException; > > /** > * The default implementation of {@link IFileStore#childStores(int, IProgressMonitor)}. > * Subclasses may override. >+ * @deprecated > */ > public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException { > String[] children = childNames(options, monitor); >@@ -305,6 +309,7 @@ > * Subclasses may override. > * > * @since org.eclipse.core.filesystem 1.2 >+ * @deprecated > */ > public IFileStore getFileStore(IPath path) { > IFileStore result = this; >@@ -321,8 +326,9 @@ > return result; > } > >- /* (non-Javadoc) >+ /** > * @see org.eclipse.core.filesystem.IFileStore#getChild(java.lang.String) >+ * @deprecated > */ > public abstract IFileStore getChild(String name); > >@@ -339,13 +345,15 @@ > } > } > >- /* (non-Javadoc) >+ /** > * @see org.eclipse.core.filesystem.IFileStore#getName() >+ * @deprecated > */ > public abstract String getName(); > >- /* (non-Javadoc) >+ /** > * @see org.eclipse.core.filesystem.IFileStore#getParent() >+ * @deprecated > */ > public abstract IFileStore getParent(); > >@@ -370,6 +378,7 @@ > * @param other The store to test for parentage. > * @return <code>true</code> if this store is a parent of the provided > * store, and <code>false</code> otherwise. >+ * @deprecated > */ > public boolean isParentOf(IFileStore other) { > while (true) { >Index: src/org/eclipse/core/filesystem/IFileStore.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileStore.java,v >retrieving revision 1.29 >diff -u -r1.29 IFileStore.java >--- src/org/eclipse/core/filesystem/IFileStore.java 7 Apr 2008 08:55:40 -0000 1.29 >+++ src/org/eclipse/core/filesystem/IFileStore.java 5 Jan 2009 18:59:59 -0000 >@@ -59,6 +59,9 @@ > * <li> This store does not exist.</li> > * </ul> > * @see IFileTree#getChildInfos(IFileStore) >+ * @see IFileStore2#getLogicalChildInfos(int, IProgressMonitor) >+ * @see IFileStore2#getPhysicalChildInfos(int, IProgressMonitor) >+ * @deprecated > */ > public IFileInfo[] childInfos(int options, IProgressMonitor monitor) throws CoreException; > >@@ -75,6 +78,9 @@ > * <ul> > * <li> This store does not exist.</li> > * </ul> >+ * @deprecated >+ * @see IFileStore2#getLogicalChildNames(int, IProgressMonitor) >+ * @see IFileStore2#getPhysicalChildNames(int, IProgressMonitor) > */ > public String[] childNames(int options, IProgressMonitor monitor) throws CoreException; > >@@ -93,6 +99,9 @@ > * <li> This store does not exist.</li> > * </ul> > * @see IFileTree#getChildStores(IFileStore) >+ * @see IFileStore2#getLogicalChildren(int, IProgressMonitor) >+ * @see IFileStore2#getPhysicalChildren(int, IProgressMonitor) >+ * @deprecated > */ > public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException; > >@@ -239,6 +248,9 @@ > * @return the member store > * > * @since org.eclipse.core.filesystem 1.2 >+ * @deprecated >+ * @see IFileStore2#getFileStoreLogical(IPath) >+ * @see IFileStore2#getFileStorePhysical(IPath) > */ > public IFileStore getFileStore(IPath path); > >@@ -251,6 +263,9 @@ > * > * @param name The name of the child store to return > * @return A child file store. >+ * @deprecated >+ * @see IFileStore2#getLogicalChild(String) >+ * @see IFileStore2#getPhysicalChild(String) > */ > public IFileStore getChild(String name); > >@@ -271,6 +286,9 @@ > * <code>fetchInfo().getName()</code>. > * </p> > * @return The name of this store >+ * @deprecated >+ * @see IFileStore2#getLogicalName() >+ * @see IFileStore2#getPhysicalName() > */ > public String getName(); > >@@ -282,6 +300,9 @@ > * > * @return The parent store, or <code>null</code> if this store is the root > * of a file system. >+ * @deprecated >+ * @see IFileStore2#getLogicalParent() >+ * @see IFileStore2#getPhysicalParent() > */ > public IFileStore getParent(); > >@@ -305,6 +326,9 @@ > * @param other The store to test for parentage. > * @return <code>true</code> if this store is a parent of the provided > * store, and <code>false</code> otherwise. >+ * @deprecated >+ * @see IFileStore2#isLogicalParentOf(IFileStore) >+ * @see IFileStore2#isPhysicalParentOf(IFileStore) > */ > public boolean isParentOf(IFileStore other); > >Index: src/org/eclipse/core/internal/filesystem/NullFileStore.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/NullFileStore.java,v >retrieving revision 1.9 >diff -u -r1.9 NullFileStore.java >--- src/org/eclipse/core/internal/filesystem/NullFileStore.java 3 Jun 2008 12:40:03 -0000 1.9 >+++ src/org/eclipse/core/internal/filesystem/NullFileStore.java 5 Jan 2009 18:59:59 -0000 >@@ -15,7 +15,7 @@ > import java.net.URISyntaxException; > import org.eclipse.core.filesystem.*; > import org.eclipse.core.filesystem.provider.FileInfo; >-import org.eclipse.core.filesystem.provider.FileStore; >+import org.eclipse.core.filesystem.provider.FileStore2; > import org.eclipse.core.runtime.*; > > /** >@@ -23,8 +23,10 @@ > * such as a location based on an undefined variable. This store > * acts much like /dev/null on *nix: writes are ignored, reads return > * empty streams, and modifications such as delete, mkdir, will fail. >+ * The logical model and physical model of this file are identical, >+ * even though reads and writes all result in null operations. > */ >-public class NullFileStore extends FileStore { >+public class NullFileStore extends FileStore2 { > private IPath path; > > /** >@@ -35,14 +37,23 @@ > this.path = path; > } > >+ /** >+ * @deprecated >+ */ > public IFileInfo[] childInfos(int options, IProgressMonitor monitor) { > return EMPTY_FILE_INFO_ARRAY; > } > >+ /** >+ * @deprecated >+ */ > public String[] childNames(int options, IProgressMonitor monitor) { > return EMPTY_STRING_ARRAY; > } > >+ /** >+ * @deprecated >+ */ > public void delete(int options, IProgressMonitor monitor) throws CoreException { > //super implementation will always fail > super.delete(options, monitor); >@@ -54,6 +65,9 @@ > return result; > } > >+ /** >+ * @deprecated >+ */ > public IFileStore getChild(String name) { > return new NullFileStore(path.append(name)); > } >@@ -62,10 +76,16 @@ > return NullFileSystem.getInstance(); > } > >+ /** >+ * @deprecated >+ */ > public String getName() { > return String.valueOf(path.lastSegment()); > } > >+ /** >+ * @deprecated >+ */ > public IFileStore getParent() { > return path.segmentCount() == 0 ? null : new NullFileStore(path.removeLastSegments(1)); > } >@@ -105,4 +125,78 @@ > return null; > } > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalChild(java.lang.String) >+ */ >+ public IFileStore getPhysicalChild(String name) { >+ return getLogicalChild(name); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalChildInfos(int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IFileInfo[] getPhysicalChildInfos(int options, IProgressMonitor monitor) throws CoreException { >+ return getLogicalChildInfos(options, monitor); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalChildNames(int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public String[] getPhysicalChildNames(int options, IProgressMonitor monitor) throws CoreException { >+ return getLogicalChildNames(options, monitor); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalChildren(int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IFileStore[] getPhysicalChildren(int options, IProgressMonitor monitor) throws CoreException { >+ return getLogicalChildren(options, monitor); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalFilename() >+ */ >+ public String getPhysicalName() { >+ return getLogicalName(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getPhysicalParent() >+ */ >+ public IFileStore getPhysicalParent() throws CoreException { >+ return getLogicalParent(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#isPhysicalFile() >+ */ >+ public boolean isPhysical() { >+ return true; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#isPhysicalParentOf(org.eclipse.core.filesystem.IFileStore) >+ */ >+ public boolean isPhysicalParentOf(IFileStore other) { >+ return isLogicalParentOf(other); >+ } >+ >+ public String getPhysicalLocation() { >+ return path.toOSString(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getFileStoreLogical(org.eclipse.core.runtime.IPath) >+ */ >+ public IFileStore getFileStoreLogical(IPath logicalPath) { >+ return getFileStore(logicalPath); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getFileStorePhysical(org.eclipse.core.runtime.IPath) >+ */ >+ public IFileStore getFileStorePhysical(IPath physicalPath) { >+ return getFileStoreLogical(physicalPath); // physical and logical are the same in this case >+ } > } >Index: src/org/eclipse/core/filesystem/IFileStore2.java >=================================================================== >RCS file: src/org/eclipse/core/filesystem/IFileStore2.java >diff -N src/org/eclipse/core/filesystem/IFileStore2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/filesystem/IFileStore2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,317 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.filesystem; >+ >+import org.eclipse.core.runtime.*; >+ >+/** >+ * Extension of IFileStore which provides a distinct notion between the >+ * logical model of a file and its physical model. The logical model can be any >+ * arbitrary model of the file as Eclipse sees it, but the physical model >+ * always reflects the file as it is modeled by the operating system on which >+ * the store physically resides on disk. >+ * @author crecoskie >+ * @since 3.5 >+ * >+ */ >+public interface IFileStore2 extends IFileStore { >+ /** >+ * Returns <code>true</code> if this file has a physical, one-to-one representation >+ * with a file as modeled by the operating system where the store physically resides on disk. >+ * Stores which reside inside archive files, databases, etc. must respond <code>false</code>. >+ * @return boolean >+ */ >+ public boolean isPhysical(); >+ >+ /** >+ * Returns a String corresponding to the name of the physical file >+ * as modeled by the operating system where the store physically resides on disk. >+ * >+ * @return String >+ */ >+ public String getPhysicalName(); >+ >+ /** >+ * Returns a String corresponding to the absolute path with which >+ * this store is associated, as modeled by the operating system where >+ * the store physically resides on disk. >+ * >+ * @return String >+ */ >+ public String getPhysicalLocation(); >+ >+ /** >+ * <p>Returns an IFileStore representing the file's physical parent >+ * as modeled by the operating system where the store physically resides on disk.</p> >+ * >+ * <p>This is a handle only method; the parent >+ * is returned regardless of whether this store or the parent store exists.</p> >+ * >+ * <p>This method returns <code>null</code> when this store represents the root >+ * directory of a file system.</p> >+ * >+ * @return The parent store, or <code>null</code> if this store is the root >+ * of a file system. >+ * >+ * @exception CoreException if this store does not have a physical representation (isPhysical() returns false); >+ */ >+ public IFileStore getPhysicalParent() throws CoreException; >+ >+ /** >+ * Returns an array of type IFileStore[] representing the store's physical children >+ * as modeled by the operating system where the store physically resides on disk. >+ * Returns an empty array if there are no children. >+ * Returns null if this file does not have a physical representation (isPhysical() returns false). >+ * >+ * @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} >+ * is applicable). >+ * @param monitor a progress monitor, or <code>null</code> if progress >+ * reporting and cancellation are not desired >+ * @return The children of this store, or an empty array if this >+ * store has no children. >+ * @exception CoreException if this method fails. Reasons include: >+ * <ul> >+ * <li> This store does not exist.</li> >+ * <li> This store does not have a physical representation (isPhysical() returns <code>false</code>). >+ * </ul> >+ * @see IFileStore2#getLogicalChildren(int, IProgressMonitor) >+ */ >+ public IFileStore[] getPhysicalChildren(int options, IProgressMonitor monitor) throws CoreException; >+ >+ /** >+ * Returns a child store with the provided physical name whose physical parent is >+ * this store. This is a handle-only method; a child is provided regardless >+ * of whether this store or the child store exists, or whether this store >+ * represents a directory or not. >+ * </p> >+ * >+ * @param name The name of the child store to return >+ * @return A child file store. >+ * @exception CoreException if this store does not have a physical representation (isPhysical() returns <code>false</code>). >+ */ >+ public IFileStore getPhysicalChild(String name) throws CoreException; >+ >+ /** >+ * Returns a handle to the member store identified by the given path. The >+ * path is treated as relative to this store's physical location. >+ * >+ * <p> >+ * This is a handle-only method; a store is provided regardless >+ * of whether this store or the member store exists, or whether this store >+ * represents a directory or not. >+ * </p> >+ * >+ * @param physicalPath the path of the member store >+ * @return the member store >+ * @exception CoreException if this store does not have a physical >+ * representation (isPhysical() returns <code>false</code>). >+ * >+ * @since 3.5 >+ */ >+ public IFileStore getFileStorePhysical(IPath physicalPath) throws CoreException; >+ >+ /** >+ * Returns whether this store is a physical parent of the provided store. This >+ * is equivalent to, but typically more efficient than, the following: >+ * <code> >+ * while (true) { >+ * other = other.getPhyisicalParent(); >+ * if (other == null) >+ * return false; >+ * if (this.equals(other)) >+ * return true; >+ * } >+ * </code> >+ * <p> >+ * This is a handle only method; this test works regardless of whether >+ * this store or the parameter store exists. >+ * </p> >+ * >+ * @param other The store to test for parentage. >+ * @return <code>true</code> if this store is a parent of the provided >+ * store, and <code>false</code> otherwise. >+ * @exception CoreException if either or both of this store and/or <code>other</code> >+ * does not have a physical representation (isPhysical() returns <code>false</code>). >+ */ >+ public boolean isPhysicalParentOf(IFileStore other) throws CoreException; >+ >+ /** >+ * Returns the names of the files and directories physically contained within this store. >+ * >+ * @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} >+ * is applicable). >+ * @param monitor a progress monitor, or <code>null</code> if progress >+ * reporting and cancellation are not desired >+ * @return The names of the children of this store, or an empty array if this >+ * store has no children. >+ * @exception CoreException if this method fails. Reasons include: >+ * <ul> >+ * <li> This store does not exist.</li> >+ * <li> This store does not have a physical representation (isPhysical() returns <code>false</code>) >+ * </ul> >+ */ >+ public String[] getPhysicalChildNames(int options, IProgressMonitor monitor) throws CoreException; >+ >+ /** >+ * Returns an {@link IFileInfo} instance for each file and directory contained >+ * within this store. The parent-child relationship reflects the physical files >+ * as modeled by the operating system where the store physically resides on disk. >+ * >+ * @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} >+ * is applicable). >+ * @param monitor a progress monitor, or <code>null</code> if progress >+ * reporting and cancellation are not desired >+ * @return An array of information about the children of this store, or an empty >+ * array if this store has no children. >+ * @exception CoreException if this method fails. Reasons include: >+ * <ul> >+ * <li> This store does not exist.</li> >+ * <li> This store does not have a physical representation (isPhysical() returns <code>false</code>) >+ * </ul> >+ * @see IFileTree#getChildInfos(IFileStore) >+ */ >+ public IFileInfo[] getPhysicalChildInfos(int options, IProgressMonitor monitor) throws CoreException; >+ >+ /** >+ * Returns the logical name for this store. This name need not be the same as its name >+ * as modeled by the operating system where the store physically resides on disk. >+ * >+ * @return String >+ */ >+ public String getLogicalName(); >+ >+ /** >+ * <p>Returns an IFileStore representing the store's logical parent. >+ * The parent need not be the same as the physical parent as modeled >+ * by the operating system where the store physically resides on disk.</p> >+ * >+ * <p>This is a handle only method; the parent >+ * is returned regardless of whether this store or the parent store exists. This >+ * method returns <code>null</code> when this store represents the root >+ * directory of a file system.</p> >+ * >+ * @return The parent store, or <code>null</code> if this store is the root >+ * of a file system. >+ * >+ */ >+ public IFileStore getLogicalParent() throws CoreException; >+ >+ /** >+ * Returns an array of type IFileStore[] representing the store's logical children. >+ * These children need not be the same as the phyiscal children as modeled by the >+ * operating system where the store physically resides on disk. >+ * Returns an empty array if there are no children. >+ * Returns null if this file does not have a physical representation (isPhysical() returns false). >+ * >+ * @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} >+ * is applicable). >+ * @param monitor a progress monitor, or <code>null</code> if progress >+ * reporting and cancellation are not desired >+ * @return The children of this store, or an empty array if this >+ * store has no children. >+ * @exception CoreException if this method fails. Reasons include: >+ * <ul> >+ * <li> This store does not exist.</li> >+ * </ul> >+ * @see IFileStore2#getLogicalChildren(int, IProgressMonitor) >+ */ >+ public IFileStore[] getLogicalChildren(int options, IProgressMonitor monitor) throws CoreException; >+ >+ /** >+ * Returns a child store with the provided logical name whose logical parent is >+ * this store. This is a handle-only method; a child is provided regardless >+ * of whether this store or the child store exists, or whether this store >+ * represents a directory or not. >+ * </p> >+ * >+ * @param name The name of the child store to return >+ * @return A child file store. >+ */ >+ public IFileStore getLogicalChild(String name); >+ >+ /** >+ * Returns a handle to the member store identified by the given path. The >+ * path is treated as relative to this store's logical path. I.e., segments of the path >+ * resolved against logical children of this store. >+ * >+ * <p> >+ * This is a handle-only method; a store is provided regardless >+ * of whether this store or the member store exists, or whether this store >+ * represents a directory or not. >+ * </p> >+ * >+ * @param logicalPath the path of the member store >+ * @return the member store >+ * >+ * @since 3.5 >+ */ >+ public IFileStore getFileStoreLogical(IPath logicalPath); >+ >+ /** >+ * Returns whether this store is a logical parent of the provided store. This >+ * is equivalent to, but typically more efficient than, the following: >+ * <code> >+ * while (true) { >+ * other = other.getLogicalParent(); >+ * if (other == null) >+ * return false; >+ * if (this.equals(other)) >+ * return true; >+ * } >+ * </code> >+ * <p> >+ * This is a handle only method; this test works regardless of whether >+ * this store or the parameter store exists. >+ * </p> >+ * >+ * @param other The store to test for parentage. >+ * @return <code>true</code> if this store is a parent of the provided >+ * store, and <code>false</code> otherwise. >+ */ >+ public boolean isLogicalParentOf(IFileStore other); >+ >+ /** >+ * Returns the names of the files and directories logically contained within this store. >+ * >+ * @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} >+ * is applicable). >+ * @param monitor a progress monitor, or <code>null</code> if progress >+ * reporting and cancellation are not desired >+ * @return The names of the children of this store, or an empty array if this >+ * store has no children. >+ * @exception CoreException if this method fails. Reasons include: >+ * <ul> >+ * <li> This store does not exist.</li> >+ * </ul> >+ */ >+ public String[] getLogicalChildNames(int options, IProgressMonitor monitor) throws CoreException; >+ >+ /** >+ * Returns an {@link IFileInfo} instance for each file and directory contained >+ * within this store. The parent-child relationship reflects the logical model as seen by >+ * EFS, and does not necessarily reflect the physical layout >+ * as modeled by the operating system where the store physically resides on disk. >+ * >+ * @param options bit-wise or of option flag constants (currently only {@link EFS#NONE} >+ * is applicable). >+ * @param monitor a progress monitor, or <code>null</code> if progress >+ * reporting and cancellation are not desired >+ * @return An array of information about the children of this store, or an empty >+ * array if this store has no children. >+ * @exception CoreException if this method fails. Reasons include: >+ * <ul> >+ * <li> This store does not exist.</li> >+ * </ul> >+ * @see IFileTree#getChildInfos(IFileStore) >+ */ >+ public IFileInfo[] getLogicalChildInfos(int options, IProgressMonitor monitor) throws CoreException; >+ >+} >Index: src/org/eclipse/core/filesystem/provider/FileStore2.java >=================================================================== >RCS file: src/org/eclipse/core/filesystem/provider/FileStore2.java >diff -N src/org/eclipse/core/filesystem/provider/FileStore2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/filesystem/provider/FileStore2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,72 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.core.filesystem.provider; >+ >+import org.eclipse.core.filesystem.*; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+ >+/** >+ * @author crecoskie >+ */ >+public abstract class FileStore2 extends FileStore implements IFileStore2 { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getLogicalChild(java.lang.String) >+ */ >+ public IFileStore getLogicalChild(String name) { >+ return getChild(name); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getLogicalChildInfos(int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IFileInfo[] getLogicalChildInfos(int options, IProgressMonitor monitor) throws CoreException { >+ return childInfos(options, monitor); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getLogicalChildNames(int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public String[] getLogicalChildNames(int options, IProgressMonitor monitor) throws CoreException { >+ return childNames(options, monitor); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getLogicalChildren(int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IFileStore[] getLogicalChildren(int options, IProgressMonitor monitor) throws CoreException { >+ return childStores(options, monitor); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getLogicalFilename() >+ */ >+ public String getLogicalName() { >+ return getName(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#getLogicalParent() >+ */ >+ public IFileStore getLogicalParent() throws CoreException { >+ return getParent(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.filesystem.IFileStore2#isLogicalParentOf(org.eclipse.core.filesystem.IFileStore) >+ */ >+ public boolean isLogicalParentOf(IFileStore other) { >+ return isParentOf(other); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 215261
: 121665 |
121666