mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 23:35:48 +02:00
[198272] FTP should return classification for symbolic links so they show a link overlay
This commit is contained in:
parent
cfd90b9336
commit
4f92ce3fba
3 changed files with 34 additions and 11 deletions
|
@ -18,6 +18,7 @@
|
||||||
* Javier Montalvo Orus (Symbian) - Fixing 161238 - [ftp] connections to VMS servers are not usable
|
* Javier Montalvo Orus (Symbian) - Fixing 161238 - [ftp] connections to VMS servers are not usable
|
||||||
* Javier Montalvo Orus (Symbian) - Fixing 176216 - [api] FTP sould provide API to allow clients register their own FTPListingParser
|
* Javier Montalvo Orus (Symbian) - Fixing 176216 - [api] FTP sould provide API to allow clients register their own FTPListingParser
|
||||||
* Javier Montalvo Orus (Symbian) - [197758] Unix symbolic links are not classified as file vs. folder
|
* Javier Montalvo Orus (Symbian) - [197758] Unix symbolic links are not classified as file vs. folder
|
||||||
|
* Javier Montalvo Orus (Symbian) - [198272] FTP should return classification for symbolic links so they show a link overlay
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.files.ftp;
|
package org.eclipse.rse.internal.services.files.ftp;
|
||||||
|
@ -95,7 +96,7 @@ public class FTPHostFile implements IHostFile
|
||||||
return !(_isDirectory || _isRoot);
|
return !(_isDirectory || _isRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSymbolicLink()
|
public boolean isLink()
|
||||||
{
|
{
|
||||||
return _isLink;
|
return _isLink;
|
||||||
}
|
}
|
||||||
|
@ -247,4 +248,33 @@ public class FTPHostFile implements IHostFile
|
||||||
_isDirectory = isDirectory;
|
_isDirectory = isDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClassification() {
|
||||||
|
String result;
|
||||||
|
String linkTarget;
|
||||||
|
|
||||||
|
if (isLink()) {
|
||||||
|
result = "symbolic link"; //$NON-NLS-1$
|
||||||
|
if ((linkTarget = _ftpFile.getLink()) !=null) {
|
||||||
|
if(isDirectory()) {
|
||||||
|
result += "(directory):" + linkTarget; //$NON-NLS-1$
|
||||||
|
} else if((getUserPermissions() & 0x01) == 0x01) {
|
||||||
|
result += "(executable):" + linkTarget; //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
result += "(file):" + linkTarget; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (isFile()) {
|
||||||
|
if ((getUserPermissions() & 0x01) == 0x01) {
|
||||||
|
result = "executable"; //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
result = "file"; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
} else if (isDirectory()) {
|
||||||
|
result = "directory"; //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
result = "unknown"; //default-fallback //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -516,7 +516,7 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
||||||
FTPHostFile f = new FTPHostFile(parentPath, _ftpFiles[i]);
|
FTPHostFile f = new FTPHostFile(parentPath, _ftpFiles[i]);
|
||||||
String name = f.getName();
|
String name = f.getName();
|
||||||
|
|
||||||
if(f.isSymbolicLink()) {
|
if(f.isLink()) {
|
||||||
if(name.indexOf('.')==-1) {
|
if(name.indexOf('.')==-1) {
|
||||||
//modify FTPHostFile to be shown as a folder
|
//modify FTPHostFile to be shown as a folder
|
||||||
f.setIsDirectory(true);
|
f.setIsDirectory(true);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* Javier Montalvo Orus (Symbian) - [198272] FTP should return classification for symbolic links so they show a link overlay
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.subsystems.files.ftp.model;
|
package org.eclipse.rse.internal.subsystems.files.ftp.model;
|
||||||
|
@ -48,14 +48,7 @@ public class FTPRemoteFile extends AbstractRemoteFile
|
||||||
|
|
||||||
public String getClassification()
|
public String getClassification()
|
||||||
{
|
{
|
||||||
if (isFile())
|
return _ftpHostFile.getClassification();
|
||||||
{
|
|
||||||
return "file"; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "directory"; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue