1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

[189681] Xuan's patch for making handler retrieving name and path information of file/folder right below root.

This commit is contained in:
David McKnight 2007-05-31 20:09:02 +00:00
parent d5a4255589
commit f7513f9c83
2 changed files with 34 additions and 17 deletions

View file

@ -14,6 +14,7 @@
* Martin Oberhuber (Wind River) - Fix 154874 - handle files with space or $ in the name
* Xuan Chen (IBM) - Fix 160768 - [refresh][dstore] Refresh on renamed node within a zip does not work;
* Xuan Chen (IBM) - Fix 189487 - copy and paste a folder did not work - workbench hang
* Xuan Chen (IBM) - [189681] [dstore][linux] Refresh Folder in My Home messes up Refresh in Root
********************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
@ -1612,25 +1613,33 @@ private DataElement createDataElementFromLSString(DataElement subject,
} else {
subject.setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR);
}
String name = fullName
.substring(
fullName.lastIndexOf(File.separatorChar) + 1,
fullName.length());
String path = fullName.substring(0, fullName
.lastIndexOf(File.separatorChar));
subject.setAttribute(DE.A_NAME, name);
subject.setAttribute(DE.A_VALUE, path);
}
else { // directory
subject.setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR);
String name = fullName
.substring(
fullName.lastIndexOf(File.separatorChar) + 1,
fullName.length());
String path = fullName.substring(0, fullName.lastIndexOf(File.separatorChar));
subject.setAttribute(DE.A_NAME, name);
subject.setAttribute(DE.A_VALUE, path);
}
String name = fullName
.substring(
fullName.lastIndexOf(File.separatorChar) + 1,
fullName.length());
int lastFileSeparatorIndex = fullName.lastIndexOf(File.separatorChar);
String path = ""; //$NON-NLS-1$
if (-1 != lastFileSeparatorIndex)
{
if (0 == lastFileSeparatorIndex)
{
//Need to handle the case like "/backup". Its parent is "/", not ""
path = Character.toString(File.separatorChar);
}
else
{
path = fullName.substring(0, fullName.lastIndexOf(File.separatorChar));
}
}
subject.setAttribute(DE.A_NAME, name);
subject.setAttribute(DE.A_VALUE, path);
// DKM - do basic property stuff here
subject.setAttribute(DE.A_SOURCE, setProperties(fileobj));

View file

@ -13,6 +13,7 @@
* Contributors:
* Kevin Doyle (IBM) - Fix 183870 - Display File Exists Error
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Xuan Chen (IBM) - [189681] [dstore][linux] Refresh Folder in My Home messes up Refresh in Root
********************************************************************************/
package org.eclipse.rse.internal.services.dstore.files;
@ -725,8 +726,15 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
else
{
StringBuffer buf = new StringBuffer(remoteParent);
buf.append(getSeparator(remoteParent));
buf.append(name);
if (remoteParent.trim().equals("/")) //$NON-NLS-1$
{
buf.append(name);
}
else
{
buf.append(getSeparator(remoteParent));
buf.append(name);
}
de = getElementFor(buf.toString());
}
dsQueryCommand(de, IUniversalDataStoreConstants.C_QUERY_GET_REMOTE_OBJECT, monitor);