use of nl.tudelft.watchdog.intellij.ui.preferences.Preferences in project watchdog by TestRoots.
the class WatchDogStartUp method checkWhetherToDisplayUserProjectRegistrationWizard.
/**
* Checks whether there is a registered WatchDog user
*/
private void checkWhetherToDisplayUserProjectRegistrationWizard() {
Preferences preferences = Preferences.getInstance();
ProjectPreferenceSetting projectSetting = preferences.getOrCreateProjectSetting(project.getName());
if (!WatchDogUtils.isEmpty(WatchDogGlobals.getPreferences().getUserId()) || (projectSetting.startupQuestionAsked && !projectSetting.enableWatchdog)) {
return;
}
UserProjectRegistrationWizard wizard = new UserProjectRegistrationWizard("User and Project Registration", project);
wizard.show();
if (wizard.getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) {
if (Messages.YES == Messages.showYesNoDialog(WATCHDOG_UNREGISTERED_WARNING, "WatchDog is not registered!", Messages.getQuestionIcon())) {
makeSilentRegistration();
} else {
userProjectRegistrationCancelled = true;
preferences.registerProjectUse(project.getName(), false);
}
}
}
use of nl.tudelft.watchdog.intellij.ui.preferences.Preferences in project watchdog by TestRoots.
the class WatchDogStartUp method makeSilentRegistration.
private void makeSilentRegistration() {
String userId = "";
Preferences preferences = Preferences.getInstance();
if (preferences.getUserId() == null || preferences.getUserId().isEmpty()) {
User user = new User();
user.programmingExperience = "NA";
try {
userId = new JsonTransferer().registerNewUser(user);
} catch (ServerCommunicationException exception) {
WatchDogLogger.getInstance().logSevere(exception);
}
if (WatchDogUtils.isEmptyOrHasOnlyWhitespaces(userId)) {
return;
}
preferences.setUserId(userId);
preferences.registerProjectId(WatchDogUtils.getProjectName(), "");
}
registerAnonymousProject(preferences.getUserId());
}
use of nl.tudelft.watchdog.intellij.ui.preferences.Preferences in project watchdog by TestRoots.
the class WatchDogStartUp method registerAnonymousProject.
private void registerAnonymousProject(String userId) {
String projectId = "";
Preferences preferences = Preferences.getInstance();
try {
projectId = new JsonTransferer().registerNewProject(new nl.tudelft.watchdog.core.ui.wizards.Project(userId));
} catch (ServerCommunicationException exception) {
WatchDogLogger.getInstance().logSevere(exception);
}
if (WatchDogUtils.isEmptyOrHasOnlyWhitespaces(projectId)) {
return;
}
preferences.registerProjectId(WatchDogUtils.getProjectName(), projectId);
preferences.registerProjectUse(WatchDogUtils.getProjectName(), true);
}
use of nl.tudelft.watchdog.intellij.ui.preferences.Preferences in project watchdog by TestRoots.
the class UserRegistrationStep method makeRegistration.
protected void makeRegistration() {
User user = new User();
user.email = getEmailInput().getText();
user.organization = getOrganizationInput().getText();
user.mayContactUser = getMayContactUser();
user.programmingExperience = getProgrammingExperience();
user.operatingSystem = System.getProperty("os.name");
try {
id = new JsonTransferer().registerNewUser(user);
} catch (ServerCommunicationException exception) {
successfulRegistration = false;
messageTitle = "Problem creating new user!";
messageBody = "<html>" + WordUtils.wrap(exception.getMessage(), 100, "<br>", true);
messageBody += "<br>Are you connected to the internet, and is port 80 open?";
messageBody += "<br>Please contact us via www.testroots.org. <br>We'll troubleshoot the issue!</html>";
return;
}
successfulRegistration = true;
((UserProjectRegistrationWizard) getWizard()).userid = id;
messageTitle = "New user registered!";
messageBody = "Your new user id is registered: ";
Preferences preferences = Preferences.getInstance();
preferences.setUserId(id);
preferences.registerProjectId(WatchDogUtils.getProjectName(), "");
preferences.setProgrammingExperience(user.programmingExperience);
}
use of nl.tudelft.watchdog.intellij.ui.preferences.Preferences in project watchdog by TestRoots.
the class RegistrationWizardBase method performFinish.
public void performFinish() {
Preferences preferences = Preferences.getInstance();
preferences.registerProjectId(WatchDogUtils.getProjectName(), projectId);
preferences.registerProjectUse(WatchDogUtils.getProjectName(), true);
return;
}
Aggregations