Search in sources :

Example 1 with Connection

use of nl.tudelft.watchdog.core.logic.network.NetworkUtils.Connection in project watchdog by TestRoots.

the class InfoDialog method createCheckIdsOnServer.

private void createCheckIdsOnServer(Composite container, Preferences preferences) {
    UIUtils.createLabel(" ", container);
    UIUtils.createLabel(" ", container);
    UIUtils.createLabel("User ID: ", container);
    Connection userConnection = NetworkUtils.urlExistsAndReturnsStatus200(NetworkUtils.buildExistingUserURL(preferences.getUserId()));
    reactOnConnectionStatus(container, userConnection, new UserButtonListener());
    Connection projectConnection = Connection.UNSUCCESSFUL;
    ProjectPreferenceSetting workspaceSettings = preferences.getOrCreateProjectSetting(WatchDogUtils.getWorkspaceName());
    boolean projectIdHasProblem = false;
    if (userConnection == Connection.SUCCESSFUL && workspaceSettings.enableWatchdog) {
        UIUtils.createLabel("Project ID: ", container);
        projectConnection = NetworkUtils.urlExistsAndReturnsStatus200(NetworkUtils.buildExistingProjectURL(workspaceSettings.projectId));
        if (projectConnection != Connection.SUCCESSFUL) {
            projectIdHasProblem = true;
        }
        reactOnConnectionStatus(container, projectConnection, new ProjectButtonListener());
    }
    if (userConnection != Connection.SUCCESSFUL || projectIdHasProblem) {
        UIUtils.createLabel(" ", container);
        UIUtils.createLabel("WatchDog cannot transfer its data.", container, colorRed);
    }
}
Also used : Connection(nl.tudelft.watchdog.core.logic.network.NetworkUtils.Connection) ProjectPreferenceSetting(nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting)

Aggregations

Connection (nl.tudelft.watchdog.core.logic.network.NetworkUtils.Connection)1 ProjectPreferenceSetting (nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting)1