diff --git a/cross/org.eclipse.cdt.launch.remote/META-INF/MANIFEST.MF b/cross/org.eclipse.cdt.launch.remote/META-INF/MANIFEST.MF
index f0a07fc5c49..934a9d8f5af 100644
--- a/cross/org.eclipse.cdt.launch.remote/META-INF/MANIFEST.MF
+++ b/cross/org.eclipse.cdt.launch.remote/META-INF/MANIFEST.MF
@@ -2,15 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.launch.remote;singleton:=true
-Bundle-Version: 2.4.0.qualifier
+Bundle-Version: 2.5.0.qualifier
Bundle-Activator: org.eclipse.cdt.internal.launch.remote.Activator
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.rse.subsystems.shells.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.rse.subsystems.files.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.cdt.launch,
+Require-Bundle: org.eclipse.cdt.launch,
org.eclipse.cdt.debug.core,
org.eclipse.cdt.core,
org.eclipse.debug.ui,
@@ -19,11 +14,13 @@ Require-Bundle: org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.cdt.debug.ui,
- org.eclipse.rse.files.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.cdt.dsf.gdb;bundle-version="3.0.0",
org.eclipse.cdt.dsf.gdb.ui;bundle-version="2.1.0",
org.eclipse.cdt.dsf;bundle-version="2.1.0",
- org.eclipse.core.variables;bundle-version="3.2.300"
+ org.eclipse.core.variables;bundle-version="3.2.300",
+ org.eclipse.remote.core;bundle-version="2.0.0",
+ org.eclipse.remote.ui;bundle-version="2.0.0",
+ org.eclipse.core.filesystem
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Bundle-Vendor: %providerName
diff --git a/cross/org.eclipse.cdt.launch.remote/pom.xml b/cross/org.eclipse.cdt.launch.remote/pom.xml
index 0e2556bc342..a67e1406ecf 100644
--- a/cross/org.eclipse.cdt.launch.remote/pom.xml
+++ b/cross/org.eclipse.cdt.launch.remote/pom.xml
@@ -11,7 +11,7 @@
The RSE Remote CDT Plugin builds on top of CDT and integrates with RSE to introduce -a "Remote C/C++ Application" launch configuration. This launch configuration relies -on the shell and file services of the RSE connections.
+The remote CDT launch Plugin builds on top of CDT and integrates with Eclipse remote framework (org.eclipse.remote) +to introduce a "Remote C/C++ Application" launch configuration. This launch configuration relies +on the shell and file services of the remote framework's connections.
-The "Remote C/C++ Application" launch configuration enables the user to select from a list of RSE -connections which have the shell service available. For a debug launch, the binary is downloaded -to the remote using the file service of the RSE connection, gdbserver is automatically started +
The "Remote C/C++ Application" launch configuration enables the user to select from a list of connections which have the shell service available. For a debug launch, the binary is downloaded +to the remote using the file service of the remote framework's connection, gdbserver is automatically started on the remote using the shell service and a gdb debug connection is establised. For a run launch, the binary is downloaded to the remote using the file service and then it is invoked using the shell service.
-In the future, an RSE file service should be used to select where the remote download +
In the future, a file service should be used to select where the remote download should take place. Right now the remote path is entered manually in a text field.
null
if not found.
- */
- public static IShellService getShellService(IHost host) {
- ISubSystem ss = getSubSystemWithShellService(host);
- if (ss != null) {
- return ss.getSubSystemConfiguration().getService(
- host).getAdapter(IShellService.class);
- }
- return null;
- }
-
- /**
- * Find the first IShellServiceSubSystem service associated with the host.
- *
- * @param host
- * the connection
- * @return shell service subsystem, or null
if not found.
- */
- public static ISubSystem getSubSystemWithShellService(IHost host) {
- if (host == null)
- return null;
- ISubSystem[] subSystems = host.getSubSystems();
- IShellService ssvc = null;
- for (int i = 0; subSystems != null && i < subSystems.length; i++) {
- IService svc = subSystems[i].getSubSystemConfiguration()
- .getService(host);
- if (svc != null) {
- ssvc = svc.getAdapter(IShellService.class);
- if (ssvc != null) {
- return subSystems[i];
- }
- }
- }
- return null;
- }
-
- public static ISubSystem getFileSubsystem(IHost host) {
- if (host == null)
- return null;
- ISubSystem[] subSystems = host.getSubSystems();
- for (int i = 0; i < subSystems.length; i++) {
- if (subSystems[i] instanceof IFileServiceSubSystem)
- return subSystems[i];
- }
- return null;
- }
-
- public static IHost[] getSuitableConnections() {
- ArrayList shellConnections = new ArrayList(Arrays.asList(RSECorePlugin.getTheSystemRegistry()
- .getHostsBySubSystemConfigurationCategory("shells"))); //$NON-NLS-1$
- ArrayList terminalConnections = new ArrayList(Arrays.asList(RSECorePlugin.getTheSystemRegistry()
- .getHostsBySubSystemConfigurationCategory("terminals")));//$NON-NLS-1$
-
- Iterator iter = terminalConnections.iterator();
- while(iter.hasNext()){
- Object terminalConnection = iter.next();
- if(!shellConnections.contains(terminalConnection)){
- shellConnections.add(terminalConnection);
- }
- }
-
- return (IHost[]) shellConnections.toArray(new IHost[shellConnections.size()]);
- }
-
-
- public static void remoteFileDownload(ILaunchConfiguration config,
- ILaunch launch, String localExePath, String remoteExePath,
- IProgressMonitor monitor) throws CoreException {
-
- boolean skipDownload = config
- .getAttribute(
- IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
- false);
-
- if (skipDownload)
- // Nothing to do. Download is skipped.
- return;
- monitor.beginTask(Messages.RemoteRunLaunchDelegate_2, 100);
- IFileService fileService;
- try {
- fileService = (IFileService) RSEHelper
- .getConnectedRemoteFileService(
- getCurrentConnection(config),
- new SubProgressMonitor(monitor, 10));
- File file = new File(localExePath);
- Path remotePath = new Path(remoteExePath);
- fileService.upload(file, remotePath.removeLastSegments(1)
- .toString(), remotePath.lastSegment(), true, null, null,
- new SubProgressMonitor(monitor, 85));
- // Need to change the permissions to match the original file
- // permissions because of a bug in upload
- remoteShellExec(
- config,
- "", "chmod", "+x " + spaceEscapify(remotePath.toString()), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } catch (SystemOperationCancelledException e) {
- abort(e.getLocalizedMessage(), null, IStatus.CANCEL);
- } catch (Exception e) {
- abort(Messages.RemoteRunLaunchDelegate_6, e,
- ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- } finally {
- monitor.done();
- }
- }
-
- public static String spaceEscapify(String inputString) {
- if (inputString == null)
- return null;
-
- return inputString.replaceAll(" ", "\\\\ "); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public static IHost getCurrentConnection(ILaunchConfiguration config)
- throws CoreException {
- String remoteConnection = config.getAttribute(
- IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
- ""); //$NON-NLS-1$
- IHost connection = RSEHelper
- .getRemoteConnectionByName(remoteConnection);
- if (connection == null) {
- abort(Messages.RemoteRunLaunchDelegate_13, null,
- ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
- return connection;
- }
-
- public static Process remoteShellExec(ILaunchConfiguration config,
- String prelaunchCmd, String remoteCommandPath, String arguments,
- IProgressMonitor monitor) throws CoreException {
- // The exit command is called to force the remote shell to close after
- // our command
- // is executed. This is to prevent a running process at the end of the
- // debug session.
- // See Bug 158786.
- monitor.beginTask(NLS.bind(Messages.RemoteRunLaunchDelegate_8,
- remoteCommandPath, arguments), 10);
- String realRemoteCommand = arguments == null ? spaceEscapify(remoteCommandPath)
- : spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$
-
- String remoteCommand = realRemoteCommand + CMD_DELIMITER + EXIT_CMD;
-
- if (!prelaunchCmd.trim().isEmpty())
- remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand;
-
- IShellService shellService;
- Process p = null;
- try {
- shellService = (IShellService) RSEHelper
- .getConnectedRemoteShellService(
- getCurrentConnection(config),
- new SubProgressMonitor(monitor, 7));
-
- // This is necessary because runCommand does not actually run the
- // command right now.
- String env[] = new String[0];
- try {
- IHostShell hostShell = shellService.launchShell(
- "", env, new SubProgressMonitor(monitor, 3)); //$NON-NLS-1$
- hostShell.writeToShell(remoteCommand);
- p = new HostShellProcessAdapter(hostShell);
- } catch (Exception e) {
- if (p != null) {
- p.destroy();
- }
- abort(Messages.RemoteRunLaunchDelegate_7, e,
- ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
- } catch (Exception e1) {
- abort(e1.getMessage(), e1,
- ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
-
- monitor.done();
- return p;
- }
-
- public static IHostShell execCmdInRemoteShell(ILaunchConfiguration config,
- String prelaunchCmd, String remoteCommandPath, String arguments,
- IProgressMonitor monitor) throws Exception {
- // The exit command is called to force the remote shell to close after
- // our command
- // is executed. This is to prevent a running process at the end of the
- // debug session.
- // See Bug 158786.
- monitor.beginTask(NLS.bind(Messages.RemoteRunLaunchDelegate_8,
- remoteCommandPath, arguments), 10);
- String realRemoteCommand = arguments == null ? spaceEscapify(remoteCommandPath)
- : spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$
-
- String remoteCommand = realRemoteCommand + CMD_DELIMITER + EXIT_CMD;
-
- if (!prelaunchCmd.trim().isEmpty())
- remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand;
-
- IShellService shellService = null;
- shellService = (IShellService) RSEHelper
- .getConnectedRemoteShellService(getCurrentConnection(config),
- new SubProgressMonitor(monitor, 7));
-
- // This is necessary because runCommand does not actually run the
- // command right now.
- String env[] = new String[0];
- IHostShell hostShell = null;
- if (shellService != null) {
- hostShell = shellService.launchShell(
- "", env, new SubProgressMonitor(monitor, 3)); //$NON-NLS-1$
- hostShell.writeToShell(remoteCommand);
- }
- monitor.done();
- return hostShell;
- }
-
- public static String getRemoteHostname(ILaunchConfiguration config)
- throws CoreException {
- IHost currentConnection = getCurrentConnection(config);
- return currentConnection.getHostName();
- }
-
- /**
- * Throws a core exception with an error status object built from the given
- * message, lower level exception, and error code.
- *
- * @param message
- * the status message
- * @param exception
- * lower level exception associated with the error, or
- * null
if none
- * @param code
- * error code
- */
- public static void abort(String message, Throwable exception, int code) throws CoreException {
- IStatus status;
- if (exception != null) {
- MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, code, message, exception);
- multiStatus.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, exception.getLocalizedMessage(), exception));
- status= multiStatus;
- } else {
- status= new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, message, null);
- }
- throw new CoreException(status);
- }
-
-
-}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java
new file mode 100644
index 00000000000..153c174fa46
--- /dev/null
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java
@@ -0,0 +1,247 @@
+/********************************************************************************
+ * Copyright (c) 2009, 2015 MontaVista Software, Inc. and others.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anna Dushistova (MontaVista) - initial API and implementation
+ * Anna Dushistova (Mentor Graphics) - [314659] moved common methods for DSF and CDI launches to this class
+ * Anna Dushistova (Mentor Graphics) - changed spaceEscapify visibility
+ * Anna Dushistova (MontaVista) - [318051][remote debug] Terminating when "Remote shell" process is selected doesn't work
+ * Wainer Moschetta(IBM) - [452356] replace RSE with org.eclipse.remote
+ ********************************************************************************/
+
+package org.eclipse.cdt.launch.remote;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.internal.launch.remote.Activator;
+import org.eclipse.cdt.internal.launch.remote.Messages;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.IFileSystem;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.remote.core.IRemoteCommandShellService;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionHostService;
+import org.eclipse.remote.core.IRemoteFileService;
+import org.eclipse.remote.core.IRemoteProcess;
+import org.eclipse.remote.core.IRemoteProcessBuilder;
+import org.eclipse.remote.core.IRemoteServicesManager;
+import org.eclipse.remote.core.RemoteProcessAdapter;
+
+public class RemoteHelper {
+
+ private final static String EXIT_CMD = "exit"; //$NON-NLS-1$
+ private final static String CMD_DELIMITER = ";"; //$NON-NLS-1$
+
+ public static IRemoteConnection getRemoteConnectionByName(String remoteConnection) {
+ if (remoteConnection == null)
+ return null;
+ IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
+ if (manager == null) {
+ return null;
+ }
+ Listnull
if none
+ * @param code
+ * error code
+ */
+ public static void abort(String message, Throwable exception, int code) throws CoreException {
+ IStatus status;
+ if (exception != null) {
+ MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, code, message, exception);
+ multiStatus.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, exception.getLocalizedMessage(), exception));
+ status= multiStatus;
+ } else {
+ status= new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, message, null);
+ }
+ throw new CoreException(status);
+ }
+
+}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteUIHelper.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteUIHelper.java
new file mode 100644
index 00000000000..6f40a95438d
--- /dev/null
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteUIHelper.java
@@ -0,0 +1,182 @@
+/********************************************************************************
+ * Copyright (c) 2016 IBM Corporation and others.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wainer S. Moschetta (IBM) - initial API and implementation
+ ********************************************************************************/
+package org.eclipse.cdt.launch.remote;
+
+import java.util.ArrayList;
+
+import org.eclipse.cdt.internal.launch.remote.Activator;
+import org.eclipse.cdt.internal.launch.remote.Messages;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.remote.core.IRemoteCommandShellService;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionType;
+import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
+import org.eclipse.remote.core.IRemoteServicesManager;
+import org.eclipse.remote.core.exception.RemoteConnectionException;
+import org.eclipse.remote.ui.IRemoteUIConnectionService;
+import org.eclipse.remote.ui.IRemoteUIConnectionWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+public class RemoteUIHelper {
+ /**
+ * Open dialog to edit a remote connection.
+ *
+ * @param connection - the remote connection
+ * @param shell - the shell
+ */
+ public static void editConnectionDialog(IRemoteConnection connection, Shell shell) {
+ if (connection == null) {
+ return;
+ }
+ IRemoteUIConnectionService uiConnServices = connection.getConnectionType().getService(IRemoteUIConnectionService.class);
+ IRemoteUIConnectionWizard wizard = uiConnServices.getConnectionWizard(shell);
+ wizard.setConnection(connection.getWorkingCopy());
+ IRemoteConnectionWorkingCopy connCopy = wizard.open();
+ if (connCopy != null) {
+ try {
+ connCopy.save();
+ } catch (RemoteConnectionException e) {
+ logError(e);
+ }
+ }
+ }
+
+ /**
+ * Open dialog for user to create a new connection.
+ *
+ * @param shell - the shell
+ */
+ public static void newConnectionDialog(Shell shell) {
+ /*
+ * Evoke native new connection wizard and save connection
+ * if created by the user.
+ */
+ class NewRemoteConnectionDialog extends Dialog {
+ private String title;
+ private Combo fConnSelection;
+ private IRemoteServicesManager manager;
+
+ protected NewRemoteConnectionDialog(Shell parentShell, String windowTitle) {
+ super(parentShell);
+ title = windowTitle;
+ manager = Activator.getService(IRemoteServicesManager.class);
+ }
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(title);
+ }
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(Messages.RemoteCMainTab_New_conntype_combo_label);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL
+ | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ label.setLayoutData(data);
+ label.setFont(parent.getFont());
+ fConnSelection = new Combo (composite, SWT.DROP_DOWN | SWT.READ_ONLY);
+ ArrayListSystemConnectionPropertyPage
page for the selected connection.
*/
protected void handleEditRemoteConnectionSelected() {
- IHost currentConnectionSelected = getCurrentConnection();
- PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(getControl().getShell(), currentConnectionSelected, SYSTEM_PAGE_ID, null, null);
- if (dialog != null) {
- dialog.open();
- }
+ RemoteUIHelper.editConnectionDialog(getCurrentConnection(),
+ getControl().getShell());
}
- protected IHost getCurrentConnection() {
+ protected IRemoteConnection getCurrentConnection() {
int currentSelection = connectionCombo.getSelectionIndex();
String remoteConnection = currentSelection >= 0 ? connectionCombo
.getItem(currentSelection) : null;
- return RSEHelper.getRemoteConnectionByName(remoteConnection);
+ return RemoteHelper.getRemoteConnectionByName(remoteConnection);
}
protected void handleRemoteBrowseSelected() {
- IHost currentConnectionSelected = getCurrentConnection();
- SystemRemoteFileDialog dlg = new SystemRemoteFileDialog(getControl()
- .getShell(),
- Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title,
- currentConnectionSelected);
- dlg.setBlockOnOpen(true);
- if (dlg.open() == Window.OK) {
- Object retObj = dlg.getSelectedObject();
- if (retObj instanceof IRemoteFile) {
- IRemoteFile selectedFile = (IRemoteFile) retObj;
- String absPath = selectedFile.getAbsolutePath();
- if (selectedFile.isDirectory()) {
- // The user selected a destination folder to upload the binary
- // Append the Program name as the default file destination
- IPath appPath = new Path(fProgText.getText().trim());
- String lastSegment = appPath.lastSegment();
- if (lastSegment != null && lastSegment.trim().length() > 0) {
- IPath remotePath = new Path(selectedFile.getAbsolutePath()).append(lastSegment.trim());
- absPath = remotePath.toPortableString();
- }
+ IRemoteConnection currentConnectionSelected = getCurrentConnection();
+ RemoteResourceBrowser b = new RemoteResourceBrowser(getControl().getShell(),
+ SWT.NONE);
+ b.setConnection(currentConnectionSelected);
+ b.setTitle(Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title);
+ b.open();
+ IFileStore selectedFile = b.getResource();
+ if (selectedFile != null) {
+ String absPath = selectedFile.toURI().getPath();
+ if (selectedFile.fetchInfo().isDirectory()) {
+ // The user selected a destination folder to upload the binary
+ // Append the Program name as the default file destination
+ IPath appPath = new Path(fProgText.getText().trim());
+ String lastSegment = appPath.lastSegment();
+ if (lastSegment != null && lastSegment.trim().length() > 0) {
+ IPath remotePath = new Path(absPath).append(lastSegment.trim());
+ absPath = remotePath.toPortableString();
}
- remoteProgText.setText(absPath);
}
-
+ remoteProgText.setText(absPath);
}
}
protected void handleRemoteConnectionPropertiesSelected() {
class RemoteConnectionPropertyDialog extends Dialog {
- private IHost fHost;
+ private IRemoteConnection fHost;
boolean fbLocalHost;
private Button fSkipDownloadBtn;
private Text fWSRoot;
private String fDialogTitle;
public RemoteConnectionPropertyDialog(Shell parentShell,
- String dialogTitle, IHost host) {
+ String dialogTitle, IRemoteConnection host) {
super(parentShell);
fDialogTitle = dialogTitle;
fHost = host;
- fbLocalHost = fHost.getSystemType().isLocal();
+ IRemoteServicesManager remoteServicesManager = Activator.getService(IRemoteServicesManager.class);
+ fbLocalHost = (fHost.getConnectionType() == remoteServicesManager.getLocalConnectionType());
}
@Override
@@ -418,21 +394,17 @@ public class RemoteCDSFMainTab extends CMainTab {
fSkipDownloadBtn
.setText(Messages.RemoteCMainTab_Properties_Skip_default);
if (!fbLocalHost) {
- IPropertySet propertySet = fHost
- .getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
- if (propertySet != null) {
- String value = propertySet
- .getPropertyValue(IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
- if (value != null) {
- fWSRoot.setText(value);
- }
- fSkipDownloadBtn
- .setSelection(Boolean
- .valueOf(
- propertySet
- .getPropertyValue(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD))
- .booleanValue());
+ String value = RemoteUIHelper.getConnectionProperty(fHost,
+ IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
+ if(!value.isEmpty()) {
+ fWSRoot.setText(value);
}
+ fSkipDownloadBtn
+ .setSelection(Boolean
+ .valueOf(
+ RemoteUIHelper.getConnectionProperty(fHost,
+ IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD))
+ .booleanValue());
} else {
fSkipDownloadBtn.setEnabled(false);
fWSRoot.setEnabled(false);
@@ -444,26 +416,18 @@ public class RemoteCDSFMainTab extends CMainTab {
@Override
protected void buttonPressed(int buttonId) {
if (!fbLocalHost && (buttonId == IDialogConstants.OK_ID)) {
- IPropertySet propertySet = fHost
- .getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
- if (propertySet == null) {
- propertySet = fHost
- .createPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
- }
- propertySet.addProperty(
+ RemoteUIHelper.setConnectionProperty(fHost,
IRemoteConnectionHostConstants.REMOTE_WS_ROOT,
fWSRoot.getText());
- propertySet
- .addProperty(
- IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD,
- Boolean.toString(fSkipDownloadBtn
- .getSelection()));
- fHost.commit();
+ RemoteUIHelper.setConnectionProperty(fHost,
+ IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD,
+ Boolean.toString(fSkipDownloadBtn
+ .getSelection()));
}
super.buttonPressed(buttonId);
}
}
- IHost currentConnectionSelected = getCurrentConnection();
+ IRemoteConnection currentConnectionSelected = getCurrentConnection();
RemoteConnectionPropertyDialog dlg = new RemoteConnectionPropertyDialog(
getControl().getShell(),
Messages.RemoteCMainTab_Properties_title,
@@ -473,20 +437,10 @@ public class RemoteCDSFMainTab extends CMainTab {
}
protected void updateConnectionPulldown() {
- if (!RSECorePlugin.isInitComplete(RSECorePlugin.INIT_MODEL))
- try {
- RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL);
- } catch (InterruptedException e) {
- return;
- }
- // already initialized
connectionCombo.removeAll();
- IHost[] connections = RSEHelper.getSuitableConnections();
+ IRemoteConnection[] connections = RemoteHelper.getSuitableConnections();
for (int i = 0; i < connections.length; i++) {
- IRSESystemType sysType = connections[i].getSystemType();
- if (sysType != null && sysType.isEnabled()) {
- connectionCombo.add(connections[i].getAliasName());
- }
+ connectionCombo.add(connections[i].getName());
}
if (connections.length > 0) {
@@ -505,12 +459,10 @@ public class RemoteCDSFMainTab extends CMainTab {
return;
}
boolean bEnable = false;
- IHost currentConnectionSelected = getCurrentConnection();
- if (currentConnectionSelected != null) {
- IRSESystemType sysType = currentConnectionSelected.getSystemType();
- if (sysType != null && sysType.isEnabled() && !sysType.isLocal()) {
- bEnable = true;
- }
+ IRemoteConnection currentConnectionSelected = getCurrentConnection();
+ if (currentConnectionSelected != null &&
+ currentConnectionSelected.getConnectionType().canEdit()) {
+ bEnable = true;
}
remoteConnectionPropertiesButton.setEnabled(bEnable);
editRemoteConnectionButton.setEnabled(bEnable);
@@ -604,14 +556,14 @@ public class RemoteCDSFMainTab extends CMainTab {
}
if ((skipDownloadButton != null) && !skipDownloadButton.isDisposed()) {
skipDownloadButton.setSelection(getDefaultSkipDownload());
- if (RSEHelper.getFileSubsystem(getCurrentConnection()) == null) {
+ if (RemoteHelper.getFileSubsystem(getCurrentConnection()) == null) {
skipDownloadButton.setEnabled(false);
} else {
skipDownloadButton.setEnabled(true);
}
}
if ((remoteBrowseButton != null) && !remoteBrowseButton.isDisposed()) {
- if (RSEHelper.getFileSubsystem(getCurrentConnection()) == null) {
+ if (RemoteHelper.getFileSubsystem(getCurrentConnection()) == null) {
remoteBrowseButton.setEnabled(false);
} else {
remoteBrowseButton.setEnabled(true);
@@ -633,35 +585,27 @@ public class RemoteCDSFMainTab extends CMainTab {
}
private String getRemoteWSRoot() {
- IHost host = getCurrentConnection();
- if (host != null) {
- IPropertySet propertySet = host
- .getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
- if (propertySet != null) {
- String value = propertySet
- .getPropertyValue(IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
- if (value != null) {
- return value;
- }
+ IRemoteConnection host = getCurrentConnection();
+ if(host != null) {
+ String value = RemoteUIHelper.getConnectionProperty(host,
+ IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
+ if(!value.isEmpty()) {
+ return value;
}
}
return ""; //$NON-NLS-1$
}
private boolean getDefaultSkipDownload() {
- IHost host = getCurrentConnection();
+ IRemoteConnection host = getCurrentConnection();
if (host != null) {
- if (RSEHelper.getFileSubsystem(host) == null) {
+ if(RemoteHelper.getFileSubsystem(host) == null){
return true;
}
- IPropertySet propertySet = host
- .getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
- if (propertySet != null) {
- return Boolean
- .valueOf(
- propertySet
- .getPropertyValue(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD))
- .booleanValue();
+ String value = RemoteUIHelper.getConnectionProperty(host,
+ IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD);
+ if(!value.isEmpty()) {
+ return Boolean.valueOf(value).booleanValue();
}
}
return SKIP_DOWNLOAD_TO_REMOTE_DEFAULT;
diff --git a/cross/org.eclipse.cdt.launch.remote/toc.xml b/cross/org.eclipse.cdt.launch.remote/toc.xml
index 1b2611151af..775c22422f2 100644
--- a/cross/org.eclipse.cdt.launch.remote/toc.xml
+++ b/cross/org.eclipse.cdt.launch.remote/toc.xml
@@ -10,7 +10,7 @@ http://www.eclipse.org/legal/epl-v10.html
Contributors:
Martin Oberhuber (Wind River) - initial API and implementation
-->
-