1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 23:25:26 +02:00

[158783][contributed] browse button for cdt remote path

This commit is contained in:
Martin Oberhuber 2007-04-03 07:48:11 +00:00
parent 53975439f6
commit 73a42a4902
4 changed files with 65 additions and 12 deletions

View file

@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.rse.ui,
org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.cdt.debug.mi.ui,
org.eclipse.cdt.debug.ui
org.eclipse.cdt.debug.ui,
org.eclipse.rse.files.ui
Eclipse-LazyStart: true
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: J2SE-1.4

View file

@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
* All rights reserved. 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:
* Martin Oberhuber (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - initial API and implementation
* Ewa Matejska (PalmSource) - [158783] browse button for cdt remote path
*******************************************************************************/
package org.eclipse.rse.internal.remotecdt;
@ -24,6 +25,10 @@ public class Messages extends NLS {
public static String Remote_GDB_Debugger_Options;
public static String RemoteCMainTab_Program;
public static String RemoteCMainTab_Remote_Path_Browse_Button;
public static String RemoteCMainTab_Remote_Path_Browse_Button_Title;
public static String RemoteCMainTab_SkipDownload;
public static String RemoteCMainTab_ErrorNoProgram;
public static String RemoteCMainTab_ErrorNoConnection;

View file

@ -1,17 +1,16 @@
/*******************************************************************************
* Copyright (c) 2006 PalmSource, Inc.
* Copyright (c) 2006, 2007 PalmSource, Inc.
* All rights reserved. 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:
* Ewa Matejska (PalmSource)
* Ewa Matejska (PalmSource) - initial API and implementation
*******************************************************************************/
package org.eclipse.rse.internal.remotecdt;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.launch.ui.CMainTab;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@ -19,7 +18,10 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.window.Window;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.files.ui.dialogs.SystemRemoteFileDialog;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
import org.eclipse.swt.SWT;
@ -50,6 +52,7 @@ public class RemoteCMainTab extends CMainTab {
private static final boolean SKIP_DOWNLOAD_TO_REMOTE_DEFAULT = false;
protected Button newRemoteConnectionButton;
protected Button remoteBrowseButton;
protected Label connectionLabel;
protected Combo connectionCombo;
protected Label remoteProgLabel;
@ -84,7 +87,7 @@ public class RemoteCMainTab extends CMainTab {
/* The remote binary location and skip download option */
createVerticalSpacer(comp, 1);
createTargetExePath(comp);
createTargetExePathGroup(comp);
createDownloadOption(comp);
/* If the local binary path changes, modify the remote binary location */
@ -160,7 +163,7 @@ public class RemoteCMainTab extends CMainTab {
newRemoteConnectionButton = createPushButton(projComp, Messages.RemoteCMainTab_New, null);
newRemoteConnectionButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
public void widgetSelected(SelectionEvent evt) {
handleNewRemoteConnectionSelected();
updateLaunchConfigurationDialog();
updateConnectionPulldown();
@ -173,20 +176,25 @@ public class RemoteCMainTab extends CMainTab {
* createTargetExePath
* This creates the remote path user-editable textfield on the Main Tab.
*/
protected void createTargetExePath(Composite parent) {
protected void createTargetExePathGroup(Composite parent) {
Composite mainComp = new Composite(parent, SWT.NONE);
GridLayout mainLayout = new GridLayout();
mainLayout.numColumns = 2;
mainLayout.marginHeight = 0;
mainLayout.marginWidth = 0;
mainComp.setLayout(mainLayout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
mainComp.setLayoutData(gd);
remoteProgLabel = new Label(mainComp, SWT.NONE);
remoteProgLabel.setText(REMOTE_PROG_LABEL_TEXT);
gd = new GridData();
gd.horizontalSpan = 2;
remoteProgLabel.setLayoutData(gd);
remoteProgText = new Text(mainComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
remoteProgText.setLayoutData(gd);
remoteProgText.addModifyListener(new ModifyListener() {
@ -194,6 +202,15 @@ public class RemoteCMainTab extends CMainTab {
updateLaunchConfigurationDialog();
}
});
remoteBrowseButton = createPushButton(mainComp, Messages.RemoteCMainTab_Remote_Path_Browse_Button, null);
remoteBrowseButton.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleRemoteBrowseSelected();
updateLaunchConfigurationDialog();
}
});
}
/*
@ -278,6 +295,33 @@ public class RemoteCMainTab extends CMainTab {
// Ignore
}
}
protected IHost getCurrentConnection() {
int currentSelection = connectionCombo.getSelectionIndex();
String remoteConnection = currentSelection >= 0 ? connectionCombo.getItem(currentSelection) : null;
if(remoteConnection == null)
return null;
IHost[] connections = RSEUIPlugin.getTheSystemRegistry().getHosts();
int i = 0;
for(i = 0; i < connections.length; i++)
if(connections[i].getAliasName().equals(remoteConnection))
break;
return connections[i];
}
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;
remoteProgText.setText(selectedFile.getAbsolutePath());
}
}
}
protected void updateConnectionPulldown() {
connectionCombo.removeAll();

View file

@ -1,5 +1,5 @@
################################################################################
# Copyright (c) 2006 Wind River Systems, Inc. and others.
# Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
# All rights reserved. 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
@ -7,6 +7,7 @@
#
# Contributors:
# Martin Oberhuber (Wind River) - externalized strings
# Ewa Matejska (PalmSource) - [158783] browse button for cdt remote path
################################################################################
# NLS_MESSAGEFORMAT_VAR
@ -19,13 +20,15 @@ RemoteRunLaunchDelegate_4=No subsystem found.\n
RemoteRunLaunchDelegate_5=Could not connect to the remote system.
RemoteRunLaunchDelegate_6=Error during file upload.
RemoteRunLaunchDelegate_7=Could not create the hostShellProcess.\n
RemoteCMainTab_Program=Remote Path for C/C++ Application:
RemoteCMainTab_Program=Remote Absolute File Path for C/C++ Application:
RemoteCMainTab_SkipDownload=Skip download to target path.
Remote_GDB_Debugger_Options=Remote GDB Debugger Options
RemoteCMainTab_ErrorNoProgram=Remote executable path is not specified.
RemoteCMainTab_ErrorNoConnection=Remote Connection must be selected.
RemoteCMainTab_Remote_Path_Browse_Button=Browse...
RemoteCMainTab_Connection=Connection:
RemoteCMainTab_New=New
RemoteCMainTab_New=New...
Gdbserver_Settings_Tab_Name=Gdbserver Settings
Gdbserver_name_textfield_label=Gdbserver name:
Port_number_textfield_label=Port number:
RemoteCMainTab_Remote_Path_Browse_Button_Title=Select Remote C/C++ Application File