Search in sources :

Example 1 with ProjectRegistrationWizard

use of nl.tudelft.watchdog.intellij.ui.wizards.projectregistration.ProjectRegistrationWizard in project watchdog by TestRoots.

the class WatchDogStartUp method checkWhetherToDisplayProjectWizard.

private void checkWhetherToDisplayProjectWizard() {
    ProjectPreferenceSetting setting = WatchDogGlobals.getPreferences().getOrCreateProjectSetting(project.getName());
    if (setting.enableWatchdog && WatchDogUtils.isEmpty(setting.projectId)) {
        ProjectRegistrationWizard wizard = new ProjectRegistrationWizard("Project Registration", project);
        wizard.show();
        if (wizard.getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) {
            registerAnonymousProject(WatchDogGlobals.getPreferences().getUserId());
        }
    }
}
Also used : ProjectRegistrationWizard(nl.tudelft.watchdog.intellij.ui.wizards.projectregistration.ProjectRegistrationWizard) UserProjectRegistrationWizard(nl.tudelft.watchdog.intellij.ui.wizards.userregistration.UserProjectRegistrationWizard) ProjectPreferenceSetting(nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting)

Example 2 with ProjectRegistrationWizard

use of nl.tudelft.watchdog.intellij.ui.wizards.projectregistration.ProjectRegistrationWizard in project watchdog by TestRoots.

the class PreferencePage method checkAndUpdateProjectID.

private void checkAndUpdateProjectID(String projectID) {
    String projectName = WatchDogUtils.getProjectName();
    if (!preferences.isAuthenticationEnabled() || !preferences.getOrCreateProjectSetting(projectName).enableWatchdog) {
        preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID);
        return;
    }
    if (projectID.length() < ID_LENGTH) {
        if (enableWatchdogInput.isSelected() && WatchDogUtils.isEmptyOrHasOnlyWhitespaces(projectIDInput.getText()) && !WatchDogUtils.isEmptyOrHasOnlyWhitespaces(userIDInput.getText())) {
            new ProjectRegistrationWizard("Project Registration", WatchDogUtils.getProject()).show();
            return;
        }
        Messages.showErrorDialog("Project ID must have 40 characters!", "Invalid Input");
        isModified = true;
    } else {
        String url = NetworkUtils.buildExistingProjectURL(projectID);
        switch(NetworkUtils.urlExistsAndReturnsStatus200(url)) {
            case SUCCESSFUL:
                preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID);
                break;
            case UNSUCCESSFUL:
            case NETWORK_ERROR:
                Messages.showErrorDialog("Project ID does not exist!", "Invalid Input");
                isModified = true;
                break;
        }
    }
}
Also used : ProjectRegistrationWizard(nl.tudelft.watchdog.intellij.ui.wizards.projectregistration.ProjectRegistrationWizard)

Aggregations

ProjectRegistrationWizard (nl.tudelft.watchdog.intellij.ui.wizards.projectregistration.ProjectRegistrationWizard)2 ProjectPreferenceSetting (nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting)1 UserProjectRegistrationWizard (nl.tudelft.watchdog.intellij.ui.wizards.userregistration.UserProjectRegistrationWizard)1