Search in sources :

Example 1 with RegistrationWizardBase

use of nl.tudelft.watchdog.eclipse.ui.wizards.RegistrationWizardBase in project watchdog by TestRoots.

the class ProjectCreatedEndingPage method makeRegistration.

@Override
protected void makeRegistration() {
    Project project = new Project(Preferences.getInstance().getUserId());
    ProjectSliderPage sliderPage;
    ProjectRegistrationPage projectPage = null;
    if (getPreviousPage() instanceof ProjectRegistrationPage) {
        projectPage = (ProjectRegistrationPage) getPreviousPage();
    } else if (getPreviousPage() instanceof ProjectSliderPage) {
        sliderPage = (ProjectSliderPage) getPreviousPage();
        projectPage = (ProjectRegistrationPage) getPreviousPage().getPreviousPage();
        project.productionPercentage = sliderPage.percentageProductionSlider.getSelection();
        project.useJunitOnlyForUnitTesting = sliderPage.usesJunitForUnitTestingOnly();
        project.followTestDrivenDesign = sliderPage.usesTestDrivenDesing();
    }
    if (projectPage == null) {
        messageTitle = "How did you get here?";
        messageBody = "We couldn't figure out which wizard page\n";
        messageBody += "you came from. Please restart the registration.";
        WatchDogLogger.getInstance().logSevere("Unknown previous page");
        return;
    }
    // initialize from projectPage
    project.belongToASingleSoftware = !projectPage.noSingleProjectButton.getSelection();
    project.name = projectPage.projectNameInput.getText();
    project.website = projectPage.projectWebsite.getText();
    project.usesContinuousIntegration = projectPage.usesContinuousIntegration();
    project.usesJunit = projectPage.usesJunit();
    project.usesOtherTestingFrameworks = projectPage.usesOtherTestingFrameworks();
    project.usesOtherTestingForms = projectPage.usesOtherTestingForms();
    windowTitle = "Registration Summary";
    try {
        id = new JsonTransferer().registerNewProject(project);
    } catch (ServerCommunicationException exception) {
        successfulRegistration = false;
        messageTitle = "Problem creating new project!";
        messageBody = WordUtils.wrap(exception.getMessage(), 100, null, true);
        messageBody += "\nAre you connected to the internet, and is port 80 open?";
        messageBody += "\nPlease contact us via www.testroots.org. \nWe'll troubleshoot the issue!";
        WatchDogLogger.getInstance().logSevere(exception);
        return;
    }
    successfulRegistration = true;
    ((RegistrationWizardBase) getWizard()).setProjectId(id);
    messageTitle = "New project registered!";
    messageBody = "Your new project id is registered: ";
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) Project(nl.tudelft.watchdog.core.ui.wizards.Project) RegistrationWizardBase(nl.tudelft.watchdog.eclipse.ui.wizards.RegistrationWizardBase)

Aggregations

JsonTransferer (nl.tudelft.watchdog.core.logic.network.JsonTransferer)1 ServerCommunicationException (nl.tudelft.watchdog.core.logic.network.ServerCommunicationException)1 Project (nl.tudelft.watchdog.core.ui.wizards.Project)1 RegistrationWizardBase (nl.tudelft.watchdog.eclipse.ui.wizards.RegistrationWizardBase)1