1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 09:55:29 +02:00

Bug 469274 - Fix potential NPE if no connection type combo

Change-Id: I8e4a3647cea799d6607e082f32e09532a4b999cd
Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
Greg Watson 2015-06-03 14:09:29 -04:00
parent 4488f6ff37
commit 79428df611

View file

@ -197,7 +197,8 @@ public class RemoteConnectionWidget extends Composite {
* list of connection types to select from
* @since 2.0
*/
public RemoteConnectionWidget(Composite parent, int style, String title, int flags, List<IRemoteConnectionType> connectionTypes) {
public RemoteConnectionWidget(Composite parent, int style, String title, int flags,
List<IRemoteConnectionType> connectionTypes) {
this(parent, style, title, flags, null, connectionTypes);
}
@ -218,7 +219,8 @@ public class RemoteConnectionWidget extends Composite {
* list of connection types to select from
* @since 2.0
*/
public RemoteConnectionWidget(Composite parent, int style, String title, int flags, IRunnableContext context, List<IRemoteConnectionType> connectionTypes) {
public RemoteConnectionWidget(Composite parent, int style, String title, int flags, IRunnableContext context,
List<IRemoteConnectionType> connectionTypes) {
super(parent, style);
if (connectionTypes != null) {
@ -520,8 +522,7 @@ public class RemoteConnectionWidget extends Composite {
/*
* Enable 'new' button if new connections are supported
*/
fNewConnectionButton
.setEnabled(selectedConnectionType.canAdd());
fNewConnectionButton.setEnabled(selectedConnectionType.canAdd());
}
} finally {
fWidgetListener.setEnabled(enabled);
@ -651,14 +652,14 @@ public class RemoteConnectionWidget extends Composite {
isRemote = !fLocalButton.getSelection();
}
fConnectionCombo.setEnabled(fEnabled && isRemote);
fNewConnectionButton.setEnabled(fEnabled && isRemote
&& fDefaultConnectionType.canAdd());
fNewConnectionButton.setEnabled(fEnabled && isRemote && fDefaultConnectionType.canAdd());
} else {
IRemoteConnectionType services = getSelectedConnectionType();
fConnectionCombo.setEnabled(fEnabled && services != null);
fNewConnectionButton.setEnabled(fEnabled && services != null
&& services.canAdd());
fConnectionTypeCombo.setEnabled(fEnabled);
fNewConnectionButton.setEnabled(fEnabled && services != null && services.canAdd());
if (fConnectionTypeCombo != null) {
fConnectionTypeCombo.setEnabled(fEnabled);
}
}
}
}