diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java index 7fbbbe5b197..c7eed5320b1 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java @@ -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)); diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java index 59a8224dab5..afb0964a4b5 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java @@ -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);