1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-05 23:35:48 +02:00

Provide a more relevant message when Daytime service isn't available.

This commit is contained in:
David Dykstal 2006-06-19 16:27:14 +00:00
parent 4c8908a591
commit aa05ec3371

View file

@ -16,6 +16,9 @@
package org.eclipse.rse.examples.daytime.connectorservice;
import java.net.ConnectException;
import java.text.MessageFormat;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.subsystems.AbstractConnectorService;
import org.eclipse.rse.examples.daytime.DaytimeResources;
@ -48,7 +51,13 @@ public class DaytimeConnectorService extends AbstractConnectorService {
private void internalConnect() throws Exception
{
fDaytimeService.setHostName(getHostName());
fDaytimeService.getTimeOfDay();
try {
fDaytimeService.getTimeOfDay();
} catch (ConnectException e) {
String template = "Daytime service is not available on {0}.";
String message = MessageFormat.format(template, new Object[] {getHostName()});
throw new Exception(message);
}
//if no exception is thrown, we consider ourselves connected!
fIsConnected = true;
//TODO force a refresh of the Viewer in order to show the resource