mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Bug 440993 - return a file store for #getStore(IPath)
Change-Id: I1f39423a8b667c001c8dec8e4914396546536e64 Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
parent
559dd99ea8
commit
52e01f7339
3 changed files with 19 additions and 15 deletions
|
@ -33,6 +33,7 @@ public class JSchFileManager implements IRemoteFileManager {
|
||||||
/**
|
/**
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getDirectorySeparator() {
|
public String getDirectorySeparator() {
|
||||||
return "/"; //$NON-NLS-1$
|
return "/"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -44,12 +45,13 @@ public class JSchFileManager implements IRemoteFileManager {
|
||||||
* org.eclipse.remote.core.IRemoteFileManager#getResource(java.lang.
|
* org.eclipse.remote.core.IRemoteFileManager#getResource(java.lang.
|
||||||
* String)
|
* String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IFileStore getResource(String pathStr) {
|
public IFileStore getResource(String pathStr) {
|
||||||
IPath path = new Path(pathStr);
|
IPath path = new Path(pathStr);
|
||||||
if (!path.isAbsolute()) {
|
if (!path.isAbsolute()) {
|
||||||
path = new Path(fConnection.getWorkingDirectory()).append(path);
|
path = new Path(fConnection.getWorkingDirectory()).append(path);
|
||||||
}
|
}
|
||||||
return new JschFileStore(JSchFileSystem.getURIFor(fConnection.getName(), path.toString()));
|
return JschFileStore.getInstance(JSchFileSystem.getURIFor(fConnection.getName(), path.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -57,6 +59,7 @@ public class JSchFileManager implements IRemoteFileManager {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.remote.core.IRemoteFileManager#toPath(java.net.URI)
|
* @see org.eclipse.remote.core.IRemoteFileManager#toPath(java.net.URI)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toPath(URI uri) {
|
public String toPath(URI uri) {
|
||||||
return uri.getPath();
|
return uri.getPath();
|
||||||
}
|
}
|
||||||
|
@ -68,6 +71,7 @@ public class JSchFileManager implements IRemoteFileManager {
|
||||||
* org.eclipse.remote.core.IRemoteFileManager#toURI(org.eclipse.core
|
* org.eclipse.remote.core.IRemoteFileManager#toURI(org.eclipse.core
|
||||||
* .runtime.IPath)
|
* .runtime.IPath)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public URI toURI(IPath path) {
|
public URI toURI(IPath path) {
|
||||||
try {
|
try {
|
||||||
return JSchFileSystem.getURIFor(fConnection.getName(), path.toString());
|
return JSchFileSystem.getURIFor(fConnection.getName(), path.toString());
|
||||||
|
@ -82,6 +86,7 @@ public class JSchFileManager implements IRemoteFileManager {
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.remote.core.IRemoteFileManager#toURI(java.lang.String)
|
* org.eclipse.remote.core.IRemoteFileManager#toURI(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public URI toURI(String path) {
|
public URI toURI(String path) {
|
||||||
return toURI(new Path(path));
|
return toURI(new Path(path));
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,16 @@ public class JSchFileSystem extends FileSystem {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.core.filesystem.provider.FileSystem#getStore(org.eclipse.core.runtime.IPath)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IFileStore getStore(IPath path) {
|
||||||
|
return EFS.getNullFileSystem().getStore(path);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -115,14 +125,4 @@ public class JSchFileSystem extends FileSystem {
|
||||||
return EFS.getNullFileSystem().getStore(uri);
|
return EFS.getNullFileSystem().getStore(uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.core.filesystem.provider.FileSystem#getStore(org.eclipse.core.runtime.IPath)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IFileStore getStore(IPath path) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -44,8 +44,6 @@ import org.eclipse.remote.internal.jsch.core.commands.PutInfoCommand;
|
||||||
import org.eclipse.remote.internal.jsch.core.messages.Messages;
|
import org.eclipse.remote.internal.jsch.core.messages.Messages;
|
||||||
|
|
||||||
public class JschFileStore extends FileStore {
|
public class JschFileStore extends FileStore {
|
||||||
private static Map<String, JschFileStore> instanceMap = new HashMap<String, JschFileStore>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public factory method for obtaining JschFileStore instances.
|
* Public factory method for obtaining JschFileStore instances.
|
||||||
*
|
*
|
||||||
|
@ -64,11 +62,12 @@ public class JschFileStore extends FileStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private final JSchConnection fConnection;
|
private static Map<String, JschFileStore> instanceMap = new HashMap<String, JschFileStore>();
|
||||||
|
|
||||||
private final IPath fRemotePath;
|
private final IPath fRemotePath;
|
||||||
private final URI fURI;
|
private final URI fURI;
|
||||||
|
|
||||||
public JschFileStore(URI uri) {
|
private JschFileStore(URI uri) {
|
||||||
fURI = uri;
|
fURI = uri;
|
||||||
fRemotePath = new Path(uri.getPath());
|
fRemotePath = new Path(uri.getPath());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue