aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Oberhuber2017-04-24 05:39:06 -0400
committerGerrit Code Review @ Eclipse.org2017-04-24 05:39:06 -0400
commit11ead853597b95ec4049c614e887922ed02ee121 (patch)
treef4625b37b49414aee2f78025c39fb8cf10be4818
parentcd2ea5b4cd7cbe7a53e8737e50847be98c1d69fd (diff)
parent2f2d289b65d31662e1f151967c76b4499a7b7c70 (diff)
downloadorg.eclipse.tcf-11ead853597b95ec4049c614e887922ed02ee121.tar.gz
org.eclipse.tcf-11ead853597b95ec4049c614e887922ed02ee121.tar.xz
org.eclipse.tcf-11ead853597b95ec4049c614e887922ed02ee121.zip
Merge "fixed bug id 507022, refresh workspace when download a file from target connection into a workbench project."
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DownloadFilesHandler.java28
1 files changed, 25 insertions, 3 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DownloadFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DownloadFilesHandler.java
index 85f8e1717..5f4896494 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DownloadFilesHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DownloadFilesHandler.java
@@ -17,16 +17,22 @@ import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode;
import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
import org.eclipse.ui.handlers.HandlerUtil;
/**
@@ -42,7 +48,7 @@ public class DownloadFilesHandler extends AbstractHandler {
dlg.setText(Messages.DownloadFilesHandler_folderDlg_text);
dlg.setMessage(Messages.DownloadFilesHandler_folderDlg_message);
- String destination = dlg.open();
+ final String destination = dlg.open();
if (destination == null)
return null;
@@ -52,7 +58,23 @@ public class DownloadFilesHandler extends AbstractHandler {
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
List<IFSTreeNode> nodes = selection.toList();
IRuntimeModel peer = nodes.get(0).getRuntimeModel();
- UiExecutor.execute(peer.operationDownload(nodes, destinationFile, new MoveCopyCallback()));
+ peer.operationDownload(nodes, destinationFile, new MoveCopyCallback()).runInUserJob(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ if (status.isOK()) {
+ IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(destination));
+ if (container != null) {
+ try {
+ container.refreshLocal(IResource.DEPTH_ONE, null);
+ }
+ catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ });
+
return null;
}