summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChin Huat Ang2018-04-09 17:55:25 -0400
committerJonah Graham2018-06-13 17:49:22 -0400
commit75e8ed9fc57253315fb639bada20f596fc559850 (patch)
tree0ce8ab34dec4ea81e83f0d54cdd0eddd7a6b9dc4
parentac2363cb925ceaa477699497c2f252d72f47f45d (diff)
downloadorg.eclipse.cdt-75e8ed9fc57253315fb639bada20f596fc559850.zip
org.eclipse.cdt-75e8ed9fc57253315fb639bada20f596fc559850.tar.gz
org.eclipse.cdt-75e8ed9fc57253315fb639bada20f596fc559850.tar.xz
Bug 533399 - Workaround RemoteResourceBrowser layout issue
Ensure that the remote connection has been opened before showing RemoteResourceBrowser dialog so that the dialog's layout would not depend on the state of the connection. Change-Id: Iec70c243b75723de418e55a1f07cd8e9804400b6 Signed-off-by: Chin Huat Ang <chin.huat.ang@intel.com>
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java
index 0d8e929..f0f0c31 100644
--- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java
@@ -43,9 +43,11 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteServicesManager;
+import org.eclipse.remote.ui.IRemoteUIConnectionService;
import org.eclipse.remote.ui.dialogs.RemoteResourceBrowser;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -344,6 +346,20 @@ public class RemoteCDSFMainTab extends CMainTab {
protected void handleRemoteBrowseSelected() {
IRemoteConnection currentConnectionSelected = getCurrentConnection();
+
+ // Try to open the connection before showing RemoteResourceBrowser
+ if (currentConnectionSelected != null && !currentConnectionSelected.isOpen()) {
+ if (currentConnectionSelected.getConnectionType().hasService(IRemoteUIConnectionService.class)) {
+
+ IRemoteUIConnectionService uiConnService = currentConnectionSelected.getConnectionType().getService(IRemoteUIConnectionService.class);
+ uiConnService.openConnectionWithProgress(getShell(), new ProgressMonitorDialog(getShell()), currentConnectionSelected);
+
+ // Don't show RemoteResourceBrowser if the connection cannot be opened
+ if (!currentConnectionSelected.isOpen())
+ return;
+ }
+ }
+
RemoteResourceBrowser b = new RemoteResourceBrowser(getControl().getShell(),
SWT.NONE);
b.setConnection(currentConnectionSelected);