1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 09:45:39 +02:00

[202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized

This commit is contained in:
Martin Oberhuber 2007-09-11 16:30:31 +00:00
parent 5eaa0ffcc6
commit bfb2e7d049
2 changed files with 19 additions and 8 deletions

View file

@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [190442] made SystemActionViewerFilter API * Martin Oberhuber (Wind River) - [190442] made SystemActionViewerFilter API
* Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -128,7 +129,6 @@ public class SystemResourceSelectionForm implements ISelectionChangedListener
} }
/** /**
* Return all selected objects. * Return all selected objects.
* @see #setMultipleSelectionMode(boolean)
*/ */
public Object[] getSelectedObjects() public Object[] getSelectedObjects()
{ {
@ -199,6 +199,7 @@ public class SystemResourceSelectionForm implements ISelectionChangedListener
connectionChanged(connection); connectionChanged(connection);
}} }}
); );
_connectionCombo.listenToConnectionEvents(true);
} }
_pathText = SystemWidgetHelpers.createReadonlyTextField(composite_prompts); _pathText = SystemWidgetHelpers.createReadonlyTextField(composite_prompts);

View file

@ -13,6 +13,7 @@
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -25,7 +26,7 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
public abstract class SystemResourceSelectionInputProvider extends SystemAbstractAPIProvider public abstract class SystemResourceSelectionInputProvider extends SystemAbstractAPIProvider
{ {
private IHost _connection; private IHost _connection = null;
private boolean _onlyConnection = false; private boolean _onlyConnection = false;
private boolean _allowNew = true; private boolean _allowNew = true;
private IRSESystemType[] _systemTypes; private IRSESystemType[] _systemTypes;
@ -41,8 +42,9 @@ public abstract class SystemResourceSelectionInputProvider extends SystemAbstrac
// choose random host // choose random host
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
IHost[] hosts = registry.getHosts(); IHost[] hosts = registry.getHosts();
if (hosts != null) if (hosts != null && hosts.length>0) {
_connection = hosts[0]; _connection = hosts[0];
}
} }
public IHost getSystemConnection() public IHost getSystemConnection()
@ -86,8 +88,10 @@ public abstract class SystemResourceSelectionInputProvider extends SystemAbstrac
if (_connection == null) if (_connection == null)
{ {
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
_connection = registry.getHosts()[0]; IHost[] hosts = registry.getHosts();
if (hosts!=null && hosts.length!=0) {
_connection = registry.getHosts()[0];
}
} }
return getConnectionChildren(_connection); return getConnectionChildren(_connection);
} }
@ -101,16 +105,22 @@ public abstract class SystemResourceSelectionInputProvider extends SystemAbstrac
{ {
if (selectedConnection != null) if (selectedConnection != null)
{ {
return getSubSystem(selectedConnection).getChildren(); ISubSystem ss = getSubSystem(selectedConnection);
if (ss!=null) {
return ss.getChildren();
}
} }
return null; return new Object[0];
} }
public boolean hasConnectionChildren(IHost selectedConnection) public boolean hasConnectionChildren(IHost selectedConnection)
{ {
if (selectedConnection != null) if (selectedConnection != null)
{ {
return getSubSystem(selectedConnection).hasChildren(); ISubSystem ss = getSubSystem(selectedConnection);
if (ss!=null) {
return ss.hasChildren();
}
} }
return false; return false;
} }