|
Lines 15-23
Link Here
|
| 15 |
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry |
15 |
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry |
| 16 |
* Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized |
16 |
* Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized |
| 17 |
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types |
17 |
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types |
|
|
18 |
* David McKnight (IBM) - [252912] SystemRemoteFileDialog shows Local contents even when specifying a SystemType |
| 18 |
********************************************************************************/ |
19 |
********************************************************************************/ |
| 19 |
|
20 |
|
| 20 |
package org.eclipse.rse.internal.ui.view; |
21 |
package org.eclipse.rse.internal.ui.view; |
|
|
22 |
import java.util.ArrayList; |
| 23 |
import java.util.List; |
| 24 |
|
| 21 |
import org.eclipse.rse.core.IRSESystemType; |
25 |
import org.eclipse.rse.core.IRSESystemType; |
| 22 |
import org.eclipse.rse.core.RSECorePlugin; |
26 |
import org.eclipse.rse.core.RSECorePlugin; |
| 23 |
import org.eclipse.rse.core.model.IHost; |
27 |
import org.eclipse.rse.core.model.IHost; |
|
Lines 44-56
Link Here
|
| 44 |
public SystemResourceSelectionInputProvider() |
48 |
public SystemResourceSelectionInputProvider() |
| 45 |
{ |
49 |
{ |
| 46 |
// choose random host |
50 |
// choose random host |
| 47 |
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); |
51 |
IHost[] hosts = getValidHosts(); |
| 48 |
IHost[] hosts = registry.getHosts(); |
|
|
| 49 |
if (hosts != null && hosts.length>0) { |
52 |
if (hosts != null && hosts.length>0) { |
| 50 |
_connection = hosts[0]; |
53 |
_connection = hosts[0]; |
| 51 |
} |
54 |
} |
| 52 |
} |
55 |
} |
| 53 |
|
56 |
|
|
|
57 |
private boolean validHost(IHost host){ |
| 58 |
if (_systemTypes == null){ |
| 59 |
IRSESystemType hostType = host.getSystemType(); |
| 60 |
for (int t = 0; t < _systemTypes.length; t++){ |
| 61 |
IRSESystemType type = _systemTypes[t]; |
| 62 |
if (hostType == type){ |
| 63 |
return true; |
| 64 |
} |
| 65 |
} |
| 66 |
return false; |
| 67 |
} |
| 68 |
else { |
| 69 |
return true; |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
private IHost[] getValidHosts() { |
| 74 |
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); |
| 75 |
IHost[] hosts = registry.getHosts(); |
| 76 |
|
| 77 |
// make sure the hosts are valid for the specified system types |
| 78 |
if (_systemTypes != null){ |
| 79 |
List hostList = new ArrayList(); |
| 80 |
for (int i = 0; i < hosts.length; i++){ |
| 81 |
IHost host = hosts[i]; |
| 82 |
if (validHost(host)){ |
| 83 |
hostList.add(host); |
| 84 |
} |
| 85 |
} |
| 86 |
return (IHost[])hostList.toArray(new IHost[hostList.size()]); |
| 87 |
} |
| 88 |
else { |
| 89 |
return hosts; |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 54 |
public IHost getSystemConnection() |
93 |
public IHost getSystemConnection() |
| 55 |
{ |
94 |
{ |
| 56 |
return _connection; |
95 |
return _connection; |
|
Lines 85-100
Link Here
|
| 85 |
public void setSystemTypes(IRSESystemType[] types) |
124 |
public void setSystemTypes(IRSESystemType[] types) |
| 86 |
{ |
125 |
{ |
| 87 |
_systemTypes = types; |
126 |
_systemTypes = types; |
|
|
127 |
if (_connection != null){ // reset the connection if isn't valid |
| 128 |
if (!validHost(_connection)){ |
| 129 |
_connection = null; |
| 130 |
} |
| 131 |
} |
| 88 |
} |
132 |
} |
| 89 |
|
133 |
|
| 90 |
public Object[] getSystemViewRoots() |
134 |
public Object[] getSystemViewRoots() |
| 91 |
{ |
135 |
{ |
| 92 |
if (_connection == null) |
136 |
if (_connection == null) |
| 93 |
{ |
137 |
{ |
| 94 |
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); |
138 |
IHost[] hosts = getValidHosts(); |
| 95 |
IHost[] hosts = registry.getHosts(); |
|
|
| 96 |
if (hosts!=null && hosts.length!=0) { |
139 |
if (hosts!=null && hosts.length!=0) { |
| 97 |
_connection = registry.getHosts()[0]; |
140 |
_connection = hosts[0]; |
| 98 |
} |
141 |
} |
| 99 |
} |
142 |
} |
| 100 |
return getConnectionChildren(_connection); |
143 |
return getConnectionChildren(_connection); |