mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
Change field names and messages to conform to new API.
Change-Id: I6a29bc6f3711164d80c20aca02b0a22a7a8d84ea Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
parent
6c93815268
commit
1ad2aeddd6
3 changed files with 40 additions and 51 deletions
|
@ -66,7 +66,7 @@ public class Messages extends NLS {
|
||||||
public static String RemoteConnectionWidget_New;
|
public static String RemoteConnectionWidget_New;
|
||||||
public static String RemoteConnectionWidget_Remote;
|
public static String RemoteConnectionWidget_Remote;
|
||||||
public static String RemoteConnectionWidget_selectConnection;
|
public static String RemoteConnectionWidget_selectConnection;
|
||||||
public static String RemoteConnectionWidget_selectRemoteProvider;
|
public static String RemoteConnectionWidget_selectConnectionType;
|
||||||
|
|
||||||
public static String RemoteDevelopmentPreferencePage_Default_connection_type;
|
public static String RemoteDevelopmentPreferencePage_Default_connection_type;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ RemoteConnectionWidget_Local=Local
|
||||||
RemoteConnectionWidget_New=New...
|
RemoteConnectionWidget_New=New...
|
||||||
RemoteConnectionWidget_Remote=Remote
|
RemoteConnectionWidget_Remote=Remote
|
||||||
RemoteConnectionWidget_selectConnection=Please select a connection
|
RemoteConnectionWidget_selectConnection=Please select a connection
|
||||||
RemoteConnectionWidget_selectRemoteProvider=Please select a remote provider
|
RemoteConnectionWidget_selectConnectionType=Please select a connection type
|
||||||
RemoteDevelopmentPreferencePage_Default_connection_type=Default connection type
|
RemoteDevelopmentPreferencePage_Default_connection_type=Default connection type
|
||||||
RemoteDirectoryWidget_0=Select Directory
|
RemoteDirectoryWidget_0=Select Directory
|
||||||
RemoteDirectoryWidget_1=Directory:
|
RemoteDirectoryWidget_1=Directory:
|
||||||
|
|
|
@ -101,8 +101,8 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
Object source = e.getSource();
|
Object source = e.getSource();
|
||||||
if (source == fServicesCombo) {
|
if (source == fConnectionTypeCombo) {
|
||||||
handleRemoteServiceSelected(null);
|
handleConnectionTypeSelected(null);
|
||||||
} else if (source == fConnectionCombo) {
|
} else if (source == fConnectionCombo) {
|
||||||
handleConnectionSelected();
|
handleConnectionSelected();
|
||||||
} else if (source == fNewConnectionButton) {
|
} else if (source == fNewConnectionButton) {
|
||||||
|
@ -118,7 +118,7 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
public static final String DEFAULT_CONNECTION_NAME = "Remote Host"; //$NON-NLS-1$
|
public static final String DEFAULT_CONNECTION_NAME = "Remote Host"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force the use of a remote provider dialog, regardless of the PREF_CONNECTION_TYPE preference setting.
|
* Force the use of the connection type combo, regardless of the PREF_CONNECTION_TYPE preference setting.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@ -129,13 +129,13 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
*/
|
*/
|
||||||
public static int FLAG_NO_LOCAL_SELECTION = 1 << 1;
|
public static int FLAG_NO_LOCAL_SELECTION = 1 << 1;
|
||||||
|
|
||||||
private Combo fServicesCombo = null;
|
private Combo fConnectionTypeCombo;
|
||||||
private Button fLocalButton;
|
private Button fLocalButton;
|
||||||
private Button fRemoteButton;
|
private Button fRemoteButton;
|
||||||
private final Combo fConnectionCombo;
|
private final Combo fConnectionCombo;
|
||||||
private final Button fNewConnectionButton;
|
private final Button fNewConnectionButton;
|
||||||
|
|
||||||
private final List<IRemoteConnectionType> fConnectionTypes;
|
private List<IRemoteConnectionType> fConnectionTypes;
|
||||||
private IRemoteConnection fSelectedConnection;
|
private IRemoteConnection fSelectedConnection;
|
||||||
private IRemoteServicesManager fRemoteServicesManager = RemoteUIPlugin.getService(IRemoteServicesManager.class);
|
private IRemoteServicesManager fRemoteServicesManager = RemoteUIPlugin.getService(IRemoteServicesManager.class);
|
||||||
private IRemoteConnectionType fDefaultConnectionType;
|
private IRemoteConnectionType fDefaultConnectionType;
|
||||||
|
@ -200,30 +200,25 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
body = group;
|
body = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String id = Preferences.getString(IRemotePreferenceConstants.PREF_CONNECTION_TYPE_ID);
|
||||||
|
if (id != null) {
|
||||||
|
fDefaultConnectionType = fRemoteServicesManager.getConnectionType(id);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if we need a connection type combo, or we should just use the default provider
|
* Check if we need a connection type combo, or we should just use the default provider
|
||||||
*/
|
*/
|
||||||
if ((flags & FLAG_FORCE_CONNECTION_TYPE_SELECTION) == 0) {
|
if ((flags & FLAG_FORCE_CONNECTION_TYPE_SELECTION) != 0) {
|
||||||
String id = Preferences.getString(IRemotePreferenceConstants.PREF_CONNECTION_TYPE_ID);
|
|
||||||
if (id != null) {
|
|
||||||
fDefaultConnectionType = fRemoteServicesManager.getConnectionType(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fDefaultConnectionType == null) {
|
|
||||||
/*
|
|
||||||
* Remote provider
|
|
||||||
*/
|
|
||||||
Label label = new Label(body, SWT.NONE);
|
Label label = new Label(body, SWT.NONE);
|
||||||
label.setText(Messages.RemoteConnectionWidget_Connection_Type);
|
label.setText(Messages.RemoteConnectionWidget_Connection_Type);
|
||||||
label.setLayoutData(new GridData());
|
label.setLayoutData(new GridData());
|
||||||
|
|
||||||
fServicesCombo = new Combo(body, SWT.DROP_DOWN | SWT.READ_ONLY);
|
fConnectionTypeCombo = new Combo(body, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
||||||
gd.horizontalSpan = 3;
|
gd.horizontalSpan = 3;
|
||||||
fServicesCombo.setLayoutData(gd);
|
fConnectionTypeCombo.setLayoutData(gd);
|
||||||
fServicesCombo.addSelectionListener(fWidgetListener);
|
fConnectionTypeCombo.addSelectionListener(fWidgetListener);
|
||||||
fServicesCombo.setFocus();
|
fConnectionTypeCombo.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & FLAG_NO_LOCAL_SELECTION) == 0 && (flags & FLAG_FORCE_CONNECTION_TYPE_SELECTION) == 0) {
|
if ((flags & FLAG_NO_LOCAL_SELECTION) == 0 && (flags & FLAG_FORCE_CONNECTION_TYPE_SELECTION) == 0) {
|
||||||
|
@ -258,11 +253,11 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
fRemoteServicesManager = RemoteUIPlugin.getService(IRemoteServicesManager.class);
|
fRemoteServicesManager = RemoteUIPlugin.getService(IRemoteServicesManager.class);
|
||||||
fConnectionTypes = fRemoteServicesManager.getRemoteConnectionTypes();
|
fConnectionTypes = fRemoteServicesManager.getRemoteConnectionTypes();
|
||||||
|
|
||||||
if (fServicesCombo != null) {
|
if (fConnectionTypeCombo != null) {
|
||||||
initializeRemoteServicesCombo(null);
|
initializeConnectionTypeCombo();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleRemoteServiceSelected(null);
|
handleConnectionTypeSelected(null);
|
||||||
|
|
||||||
if (fLocalButton != null) {
|
if (fLocalButton != null) {
|
||||||
handleButtonSelected();
|
handleButtonSelected();
|
||||||
|
@ -306,9 +301,9 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
if (fDefaultConnectionType != null) {
|
if (fDefaultConnectionType != null) {
|
||||||
return fDefaultConnectionType;
|
return fDefaultConnectionType;
|
||||||
}
|
}
|
||||||
int selectionIndex = fServicesCombo.getSelectionIndex();
|
int selectionIndex = fConnectionTypeCombo.getSelectionIndex();
|
||||||
if (fConnectionTypes.size() > 0 && selectionIndex > 0) {
|
if (fConnectionTypes.size() > 0 && selectionIndex > 0) {
|
||||||
return fRemoteServicesManager.getConnectionType(fConnectionTypes.get(selectionIndex - 1).getId());
|
return fConnectionTypes.get(selectionIndex - 1);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -371,7 +366,7 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
IRemoteConnectionWorkingCopy conn = wizard.open();
|
IRemoteConnectionWorkingCopy conn = wizard.open();
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
try {
|
try {
|
||||||
handleRemoteServiceSelected(conn.save());
|
handleConnectionTypeSelected(conn.save());
|
||||||
handleConnectionSelected();
|
handleConnectionSelected();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
RemoteUIPlugin.log(e);
|
RemoteUIPlugin.log(e);
|
||||||
|
@ -382,19 +377,17 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle selection of a new remote services provider from the remote services combo. Handles the special case where the
|
* Handle selection of a new connection type from the connection type combo. Handles the special case where the
|
||||||
* services combo is null and a local connection is supplied. In this case, the selected services are not changed.
|
* connection type combo is null and a local connection is supplied. In this case, the selected connection type is not changed.
|
||||||
*
|
*
|
||||||
* The assumption is that this will trigger a call to the selection handler for the connection combo.
|
* The assumption is that this will trigger a call to the selection handler for the connection combo.
|
||||||
*
|
*
|
||||||
* @param conn
|
* @param conn
|
||||||
* connection to select as current. If conn is null, select the first item in the list.
|
* connection to select as current. If conn is null, select the first item in the list.
|
||||||
* @param notify
|
|
||||||
* if true, notify handlers that the connection has changed. This should only happen if the user changes the
|
|
||||||
* connection.
|
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
protected void handleRemoteServiceSelected(IRemoteConnection conn) {
|
protected void handleConnectionTypeSelected(IRemoteConnection conn) {
|
||||||
final boolean enabled = fWidgetListener.isEnabled();
|
final boolean enabled = fWidgetListener.isEnabled();
|
||||||
fWidgetListener.disable();
|
fWidgetListener.disable();
|
||||||
try {
|
try {
|
||||||
|
@ -404,13 +397,13 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a connection was supplied, set its remote service provider in the combo. Otherwise use the currently selected
|
* If a connection was supplied, set its connection type in the combo. Otherwise use the currently selected
|
||||||
* service.
|
* service.
|
||||||
*/
|
*/
|
||||||
if (fDefaultConnectionType == null && conn != null) {
|
if (fDefaultConnectionType == null && conn != null) {
|
||||||
for (int index = 0; index < fConnectionTypes.size(); index++) {
|
for (int index = 0; index < fConnectionTypes.size(); index++) {
|
||||||
if (fConnectionTypes.get(index).getId().equals(selectedConnectionType.getId())) {
|
if (fConnectionTypes.get(index).getId().equals(selectedConnectionType.getId())) {
|
||||||
fServicesCombo.select(index + 1);
|
fConnectionTypeCombo.select(index + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -472,30 +465,26 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the contents of the remote services combo. Keeps an array of remote services that matches the combo elements.
|
* Initialize the contents of the connection type combo. Keeps an array of connection types that matches the combo elements.
|
||||||
* Returns the id of the selected element.
|
* Returns the id of the selected element.
|
||||||
*
|
*
|
||||||
* @since 6.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
protected void initializeRemoteServicesCombo(String id) {
|
protected void initializeConnectionTypeCombo() {
|
||||||
final boolean enabled = fWidgetListener.isEnabled();
|
final boolean enabled = fWidgetListener.isEnabled();
|
||||||
fWidgetListener.disable();
|
fWidgetListener.disable();
|
||||||
IRemoteConnectionType defService = null;
|
fConnectionTypeCombo.removeAll();
|
||||||
if (id != null) {
|
|
||||||
defService = fRemoteServicesManager.getConnectionType(id);
|
|
||||||
}
|
|
||||||
fServicesCombo.removeAll();
|
|
||||||
int offset = 1;
|
int offset = 1;
|
||||||
int defIndex = 0;
|
int defIndex = 0;
|
||||||
fServicesCombo.add(Messages.RemoteConnectionWidget_selectRemoteProvider);
|
fConnectionTypeCombo.add(Messages.RemoteConnectionWidget_selectConnectionType);
|
||||||
for (int i = 0; i < fConnectionTypes.size(); i++) {
|
for (int i = 0; i < fConnectionTypes.size(); i++) {
|
||||||
fServicesCombo.add(fConnectionTypes.get(i).getName());
|
fConnectionTypeCombo.add(fConnectionTypes.get(i).getName());
|
||||||
if (defService != null && fConnectionTypes.get(i).equals(defService)) {
|
if (fDefaultConnectionType != null && fConnectionTypes.get(i).equals(fDefaultConnectionType)) {
|
||||||
defIndex = i + offset;
|
defIndex = i + offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fConnectionTypes.size() > 0) {
|
if (fConnectionTypes.size() > 0) {
|
||||||
fServicesCombo.select(defIndex);
|
fConnectionTypeCombo.select(defIndex);
|
||||||
}
|
}
|
||||||
fWidgetListener.setEnabled(enabled);
|
fWidgetListener.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
@ -542,7 +531,7 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
fLocalButton.setSelection(true);
|
fLocalButton.setSelection(true);
|
||||||
handleButtonSelected();
|
handleButtonSelected();
|
||||||
} else {
|
} else {
|
||||||
handleRemoteServiceSelected(connection);
|
handleConnectionTypeSelected(connection);
|
||||||
}
|
}
|
||||||
handleConnectionSelected();
|
handleConnectionSelected();
|
||||||
updateEnablement();
|
updateEnablement();
|
||||||
|
@ -553,7 +542,7 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
* Set the connection that should be selected in the widget.
|
* Set the connection that should be selected in the widget.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* remote services id
|
* connection type id
|
||||||
* @param name
|
* @param name
|
||||||
* connection name
|
* connection name
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -596,7 +585,7 @@ public class RemoteConnectionWidget extends Composite {
|
||||||
fConnectionCombo.setEnabled(fEnabled && services != null);
|
fConnectionCombo.setEnabled(fEnabled && services != null);
|
||||||
fNewConnectionButton.setEnabled(fEnabled && services != null
|
fNewConnectionButton.setEnabled(fEnabled && services != null
|
||||||
&& (services.getCapabilities() & IRemoteConnectionType.CAPABILITY_ADD_CONNECTIONS) != 0);
|
&& (services.getCapabilities() & IRemoteConnectionType.CAPABILITY_ADD_CONNECTIONS) != 0);
|
||||||
fServicesCombo.setEnabled(fEnabled);
|
fConnectionTypeCombo.setEnabled(fEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue