servicesViewer.setContentProvider(new TreeContentProvider());
servicesViewer.setLabelProvider(new ServicesTreeLabelProvider(servicesViewer) {
protected Image getColumnImage(CloudService service, ServiceViewColumn column) {
if (column == ServiceViewColumn.Tunnel) {
TunnelBehaviour handler = new TunnelBehaviour(cloudServer);
if (handler.hasCaldecottTunnel(service.getName())) {
return CloudFoundryImages.getImage(CloudFoundryImages.CONNECT);
}
}
return null;
}
});
servicesViewer.setSorter(new ServiceViewerSorter(servicesViewer) {
@Override
protected int compare(CloudService service1, CloudService service2, ServiceViewColumn sortColumn) {
if (sortColumn == ServiceViewColumn.Tunnel) {
TunnelBehaviour handler = new TunnelBehaviour(cloudServer);
if (handler.hasCaldecottTunnel(service1.getName())) {
return -1;
}
else if (handler.hasCaldecottTunnel(service2.getName())) {
return 1;
}
else {
return 0;
}