1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 370768 - new 'Edit...' button to access connection properties

Change-Id: I0117516b6c79bfe4acc80ecce81c5acad775c697
Signed-off-by: Iulia Vasii <IuliaMadalina.Vasii@freescale.com>
Reviewed-on: https://git.eclipse.org/r/35543
Tested-by: Hudson CI
Reviewed-by: Teodor Madan <teodor.madan@freescale.com>
Tested-by: Teodor Madan <teodor.madan@freescale.com>
This commit is contained in:
Iulia Vasii 2014-10-27 16:23:45 +02:00 committed by Teodor Madan
parent 9134d71fe5
commit 1a87fa7fe3
4 changed files with 84 additions and 16 deletions

View file

@ -41,6 +41,7 @@ public class Messages extends NLS {
public static String RemoteCMainTab_ErrorNoConnection;
public static String RemoteCMainTab_Connection;
public static String RemoteCMainTab_New;
public static String RemoteCMainTab_Edit;
public static String RemoteCMainTab_Properties;
public static String RemoteCMainTab_Properties_title;
public static String RemoteCMainTab_Properties_Location;

View file

@ -43,6 +43,7 @@ RemoteCMainTab_ErrorNoConnection=Remote Connection must be selected.
RemoteCMainTab_Remote_Path_Browse_Button=Browse...
RemoteCMainTab_Connection=Connection:
RemoteCMainTab_New=New...
RemoteCMainTab_Edit=Edit...
Gdbserver_Settings_Tab_Name=Gdbserver Settings
Gdbserver_name_textfield_label=Gdbserver path:
Port_number_textfield_label=Port number:

View file

@ -22,6 +22,7 @@
* Anna Dushistova (MontaVista) - [375067] [remote] Automated remote launch does not support project-less debug
* Dan Ungureanu (Freescale) - [428367] [remote launch] Fix missing title for Properties dialog
* Alvaro Sanchez-Leon (Ericsson) - [430313] [remote] Auto Remote Debug - Unable to download to folder
* Iulia Vasii (Freescale) - [370768] new 'Edit...' button to access connection properties
*******************************************************************************/
package org.eclipse.cdt.launch.remote.tabs;
@ -39,6 +40,7 @@ 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.preference.PreferenceDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.RSECorePlugin;
@ -62,6 +64,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
public class RemoteCDSFMainTab extends CMainTab {
@ -76,7 +79,11 @@ public class RemoteCDSFMainTab extends CMainTab {
private static final String REMOTE_PATH_DEFAULT = EMPTY_STRING;
private static final boolean SKIP_DOWNLOAD_TO_REMOTE_DEFAULT = false;
/* SystemConnectionPropertyPage id*/
private static final String SYSTEM_PAGE_ID = "org.eclipse.rse.SystemPropertyPage"; //$NON-NLS-1$
protected Button newRemoteConnectionButton;
protected Button editRemoteConnectionButton;
protected Button remoteConnectionPropertiesButton;
protected Button remoteBrowseButton;
protected Label connectionLabel;
@ -156,7 +163,7 @@ public class RemoteCDSFMainTab extends CMainTab {
protected void createRemoteConnectionGroup(Composite parent, int colSpan) {
Composite projComp = new Composite(parent, SWT.NONE);
GridLayout projLayout = new GridLayout();
projLayout.numColumns = 4;
projLayout.numColumns = 5;
projLayout.marginHeight = 0;
projLayout.marginWidth = 0;
projComp.setLayout(projLayout);
@ -178,7 +185,7 @@ public class RemoteCDSFMainTab extends CMainTab {
public void modifyText(ModifyEvent e) {
useDefaultsFromConnection();
updatePropertiesButton();
updateConnectionButtons();
setDirty(true);
updateLaunchConfigurationDialog();
}
@ -196,6 +203,16 @@ public class RemoteCDSFMainTab extends CMainTab {
}
});
editRemoteConnectionButton = createPushButton(projComp,
Messages.RemoteCMainTab_Edit, null);
editRemoteConnectionButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
handleEditRemoteConnectionSelected();
}
});
remoteConnectionPropertiesButton = createPushButton(projComp,
Messages.RemoteCMainTab_Properties, null);
remoteConnectionPropertiesButton
@ -309,6 +326,17 @@ public class RemoteCDSFMainTab extends CMainTab {
}
}
/**
* Opens the <code>SystemConnectionPropertyPage</code> 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();
}
}
protected IHost getCurrentConnection() {
int currentSelection = connectionCombo.getSelectionIndex();
String remoteConnection = currentSelection >= 0 ? connectionCombo
@ -463,23 +491,28 @@ public class RemoteCDSFMainTab extends CMainTab {
if (connections.length > 0) {
connectionCombo.select(connections.length - 1);
}
updatePropertiesButton();
updateConnectionButtons();
}
private void updatePropertiesButton() {
private void updateConnectionButtons() {
if ((remoteConnectionPropertiesButton == null)
|| remoteConnectionPropertiesButton.isDisposed()) {
return;
}
boolean bEnableProperties = false;
if ((editRemoteConnectionButton == null)
|| editRemoteConnectionButton.isDisposed()) {
return;
}
boolean bEnable = false;
IHost currentConnectionSelected = getCurrentConnection();
if (currentConnectionSelected != null) {
IRSESystemType sysType = currentConnectionSelected.getSystemType();
if (sysType != null && sysType.isEnabled() && !sysType.isLocal()) {
bEnableProperties = true;
bEnable = true;
}
}
remoteConnectionPropertiesButton.setEnabled(bEnableProperties);
remoteConnectionPropertiesButton.setEnabled(bEnable);
editRemoteConnectionButton.setEnabled(bEnable);
}
protected void updateTargetProgFromConfig(ILaunchConfiguration config) {
@ -664,7 +697,7 @@ public class RemoteCDSFMainTab extends CMainTab {
updateTargetProgFromConfig(config);
updateSkipDownloadFromConfig(config);
updatePropertiesButton();
updateConnectionButtons();
isInitializing = false;
}

View file

@ -21,6 +21,7 @@
* Anna Dushistova (Mentor Graphics) - [318052] [remote launch] Properties are not saved/used
* Anna Dushistova (Mentor Graphics) - [333453] adapted the fix from RemoteCDSFMainTab.java
* Dan Ungureanu (Freescale) - [428367] [remote launch] Fix missing title for Properties dialog
* Iulia Vasii (Freescale) - [370768] new 'Edit...' button to access connection properties
*******************************************************************************/
package org.eclipse.cdt.launch.remote.tabs;
@ -38,6 +39,7 @@ 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.preference.PreferenceDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.RSECorePlugin;
@ -61,6 +63,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
public class RemoteCMainTab extends CMainTab {
@ -75,7 +78,11 @@ public class RemoteCMainTab extends CMainTab {
private static final String REMOTE_PATH_DEFAULT = EMPTY_STRING;
private static final boolean SKIP_DOWNLOAD_TO_REMOTE_DEFAULT = false;
/* SystemConnectionPropertyPage id*/
private static final String SYSTEM_PAGE_ID = "org.eclipse.rse.SystemPropertyPage"; //$NON-NLS-1$
protected Button newRemoteConnectionButton;
protected Button editRemoteConnectionButton;
protected Button remoteConnectionPropertiesButton;
protected Button remoteBrowseButton;
protected Label connectionLabel;
@ -173,7 +180,7 @@ public class RemoteCMainTab extends CMainTab {
protected void createRemoteConnectionGroup(Composite parent, int colSpan) {
Composite projComp = new Composite(parent, SWT.NONE);
GridLayout projLayout = new GridLayout();
projLayout.numColumns = 4;
projLayout.numColumns = 5;
projLayout.marginHeight = 0;
projLayout.marginWidth = 0;
projComp.setLayout(projLayout);
@ -195,7 +202,7 @@ public class RemoteCMainTab extends CMainTab {
public void modifyText(ModifyEvent e) {
useDefaultsFromConnection();
updatePropertiesButton();
updateConnectionButtons();
setDirty(true);
updateLaunchConfigurationDialog();
}
@ -213,6 +220,16 @@ public class RemoteCMainTab extends CMainTab {
}
});
editRemoteConnectionButton = createPushButton(projComp,
Messages.RemoteCMainTab_Edit, null);
editRemoteConnectionButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
handleEditRemoteConnectionSelected();
}
});
remoteConnectionPropertiesButton = createPushButton(projComp,
Messages.RemoteCMainTab_Properties, null);
remoteConnectionPropertiesButton
@ -374,7 +391,7 @@ public class RemoteCMainTab extends CMainTab {
updateTargetProgFromConfig(config);
updateSkipDownloadFromConfig(config);
updatePropertiesButton();
updateConnectionButtons();
isInitializing = false;
}
@ -391,6 +408,17 @@ public class RemoteCMainTab extends CMainTab {
}
}
/**
* Opens the <code>SystemConnectionPropertyPage</code> 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();
}
}
protected IHost getCurrentConnection() {
int currentSelection = connectionCombo.getSelectionIndex();
String remoteConnection = currentSelection >= 0 ? connectionCombo
@ -534,23 +562,28 @@ public class RemoteCMainTab extends CMainTab {
if (connections.length > 0) {
connectionCombo.select(connections.length - 1);
}
updatePropertiesButton();
updateConnectionButtons();
}
private void updatePropertiesButton() {
private void updateConnectionButtons() {
if ((remoteConnectionPropertiesButton == null)
|| remoteConnectionPropertiesButton.isDisposed()) {
return;
}
boolean bEnableProperties = false;
if ((editRemoteConnectionButton == null)
|| editRemoteConnectionButton.isDisposed()) {
return;
}
boolean bEnable = false;
IHost currentConnectionSelected = getCurrentConnection();
if (currentConnectionSelected != null) {
IRSESystemType sysType = currentConnectionSelected.getSystemType();
if (sysType != null && sysType.isEnabled() && !sysType.isLocal()) {
bEnableProperties = true;
bEnable = true;
}
}
remoteConnectionPropertiesButton.setEnabled(bEnableProperties);
remoteConnectionPropertiesButton.setEnabled(bEnable);
editRemoteConnectionButton.setEnabled(bEnable);
}
protected void updateTargetProgFromConfig(ILaunchConfiguration config) {