1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 03:53:21 +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 * list of connection types to select from
* @since 2.0 * @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); this(parent, style, title, flags, null, connectionTypes);
} }
@ -218,7 +219,8 @@ public class RemoteConnectionWidget extends Composite {
* list of connection types to select from * list of connection types to select from
* @since 2.0 * @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); super(parent, style);
if (connectionTypes != null) { if (connectionTypes != null) {
@ -520,8 +522,7 @@ public class RemoteConnectionWidget extends Composite {
/* /*
* Enable 'new' button if new connections are supported * Enable 'new' button if new connections are supported
*/ */
fNewConnectionButton fNewConnectionButton.setEnabled(selectedConnectionType.canAdd());
.setEnabled(selectedConnectionType.canAdd());
} }
} finally { } finally {
fWidgetListener.setEnabled(enabled); fWidgetListener.setEnabled(enabled);
@ -651,14 +652,14 @@ public class RemoteConnectionWidget extends Composite {
isRemote = !fLocalButton.getSelection(); isRemote = !fLocalButton.getSelection();
} }
fConnectionCombo.setEnabled(fEnabled && isRemote); fConnectionCombo.setEnabled(fEnabled && isRemote);
fNewConnectionButton.setEnabled(fEnabled && isRemote fNewConnectionButton.setEnabled(fEnabled && isRemote && fDefaultConnectionType.canAdd());
&& fDefaultConnectionType.canAdd());
} else { } else {
IRemoteConnectionType services = getSelectedConnectionType(); IRemoteConnectionType services = getSelectedConnectionType();
fConnectionCombo.setEnabled(fEnabled && services != null); fConnectionCombo.setEnabled(fEnabled && services != null);
fNewConnectionButton.setEnabled(fEnabled && services != null fNewConnectionButton.setEnabled(fEnabled && services != null && services.canAdd());
&& services.canAdd()); if (fConnectionTypeCombo != null) {
fConnectionTypeCombo.setEnabled(fEnabled); fConnectionTypeCombo.setEnabled(fEnabled);
}
} }
} }
} }