1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Bug 472329: URI to path conversion in RemoteResourceBrowserWidget

Change-Id: I30987936c889c593d1ca14dff97fefe441708b1e
Signed-off-by: Markus Schorn <markus.schorn@windriver.com>
This commit is contained in:
Markus Schorn 2015-07-10 08:05:19 +02:00
parent db74024720
commit a09aefd312

View file

@ -12,6 +12,7 @@
package org.eclipse.remote.ui.widgets; package org.eclipse.remote.ui.widgets;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -185,7 +186,7 @@ public class RemoteResourceBrowserWidget extends Composite {
private String fDialogLabel; private String fDialogLabel;
private boolean fShowHidden; private boolean fShowHidden;
private final List<IFileStore> fResources = new ArrayList<IFileStore>(); private final List<IFileStore> fResources = new ArrayList<>();
private String fResource; private String fResource;
private String fInitialPath; private String fInitialPath;
private IPath fRootPath; private IPath fRootPath;
@ -304,7 +305,7 @@ public class RemoteResourceBrowserWidget extends Composite {
TreePath treePath = treePaths[0]; TreePath treePath = treePaths[0];
if (treePath.getLastSegment() instanceof DeferredFileStore) { if (treePath.getLastSegment() instanceof DeferredFileStore) {
DeferredFileStore element = ((DeferredFileStore) treePath.getLastSegment()); DeferredFileStore element = ((DeferredFileStore) treePath.getLastSegment());
String path = element.getFileStore().toURI().getPath(); String path = toPath(element.getFileStore().toURI());
String newPath = createNewFolder(path); String newPath = createNewFolder(path);
if (newPath != null) { if (newPath != null) {
fTreeViewer.expandToLevel(element, 1); fTreeViewer.expandToLevel(element, 1);
@ -322,7 +323,7 @@ public class RemoteResourceBrowserWidget extends Composite {
} }
} else { } else {
DeferredFileStore root = (DeferredFileStore) fTreeViewer.getInput(); DeferredFileStore root = (DeferredFileStore) fTreeViewer.getInput();
String path = root.getFileStore().toURI().getPath(); String path = toPath(root.getFileStore().toURI());
String newPath = createNewFolder(path); String newPath = createNewFolder(path);
if (newPath != null) { if (newPath != null) {
fTreeViewer.refresh(); fTreeViewer.refresh();
@ -372,7 +373,7 @@ public class RemoteResourceBrowserWidget extends Composite {
} }
} }
if (fResources.size() > 0) { if (fResources.size() > 0) {
fRemotePathText.setText(fResources.get(0).toURI().getPath()); fRemotePathText.setText(toPath(fResources.get(0).toURI()));
} }
updateEnablement(); updateEnablement();
notifySelectionChangedListeners(event); notifySelectionChangedListeners(event);
@ -421,6 +422,10 @@ public class RemoteResourceBrowserWidget extends Composite {
updateEnablement(); updateEnablement();
} }
private String toPath(URI uri) {
return getConnection().getService(IRemoteFileService.class).toPath(uri);
}
/** /**
* Add a listener that will be notified when the selection is changed. * Add a listener that will be notified when the selection is changed.
* *