Search in sources :

Example 1 with ProjectPreferenceSetting

use of nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting in project watchdog by TestRoots.

the class StartupUIThread method checkWhetherToDisplayProjectWizard.

private void checkWhetherToDisplayProjectWizard() {
    ProjectPreferenceSetting setting = preferences.getOrCreateProjectSetting(workspaceName);
    if (setting.enableWatchdog && WatchDogUtils.isEmpty(setting.projectId)) {
        displayProjectWizard();
        savePreferenceStoreIfNeeded();
    }
}
Also used : ProjectPreferenceSetting(nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting)

Example 2 with ProjectPreferenceSetting

use of nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting in project watchdog by TestRoots.

the class WatchDogStartUp method checkWhetherToStartWatchDog.

private void checkWhetherToStartWatchDog() {
    ProjectPreferenceSetting setting = WatchDogGlobals.getPreferences().getOrCreateProjectSetting(project.getName());
    if (setting.enableWatchdog) {
        WatchDogLogger.getInstance().logInfo("Starting WatchDog ...");
        InitializationManager.getInstance(project);
        WatchDogUtils.setWatchDogActiveForProject(project);
        new ViewToolWindowButtonsAction().setSelected(null, true);
    }
}
Also used : ViewToolWindowButtonsAction(com.intellij.ide.actions.ViewToolWindowButtonsAction) ProjectPreferenceSetting(nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting)

Example 3 with ProjectPreferenceSetting

use of nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting 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);
        }
    }
}
Also used : Preferences(nl.tudelft.watchdog.intellij.ui.preferences.Preferences) ProjectPreferenceSetting(nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting) UserProjectRegistrationWizard(nl.tudelft.watchdog.intellij.ui.wizards.userregistration.UserProjectRegistrationWizard)

Example 4 with ProjectPreferenceSetting

use of nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting 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 5 with ProjectPreferenceSetting

use of nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting in project watchdog by TestRoots.

the class PreferencePage method createContents.

@Override
protected Control createContents(Composite parent) {
    Color colorRed = new Color(getShell().getDisplay(), 255, 0, 0);
    UIUtils.createLabel("Changes in the settings become active after a restart of Eclipse.", parent, colorRed);
    UIUtils.createLabel("", parent);
    Group localGroup = createGroup(parent, "Local Settings", 1);
    UIUtils.createLabel("Here you can define the local WatchDog settings for this workspace.", localGroup);
    UIUtils.createLabel("", localGroup);
    Composite projectComposite = UIUtils.createGridedComposite(localGroup, 2);
    projectComposite.setLayoutData(UIUtils.createFullGridUsageData());
    UIUtils.createLabel("Project-ID ", projectComposite);
    projectIDInput = UIUtils.createTextInput(projectComposite);
    projectIDInput.setTextLimit(ID_LENGTH);
    enableWatchdogInput = new Button(localGroup, SWT.CHECK);
    enableWatchdogInput.setText("Monitor this workspace with WatchDog ");
    ProjectPreferenceSetting workspaceSetting = preferences.getOrCreateProjectSetting(workspace);
    projectIDInput.setText(workspaceSetting.projectId);
    enableWatchdogInput.setSelection(workspaceSetting.enableWatchdog);
    UIUtils.createLabel("", parent);
    Group globalGroup = createGroup(parent, "Global Settings", 1);
    UIUtils.createLabel("Here you can enter settings that will affect WatchDog no matter which workspace you have opened.  ", globalGroup);
    UIUtils.createLabel("", globalGroup);
    return super.createContents(globalGroup);
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Color(org.eclipse.swt.graphics.Color) ProjectPreferenceSetting(nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting)

Aggregations

ProjectPreferenceSetting (nl.tudelft.watchdog.core.ui.preferences.ProjectPreferenceSetting)8 UserProjectRegistrationWizard (nl.tudelft.watchdog.intellij.ui.wizards.userregistration.UserProjectRegistrationWizard)2 ViewToolWindowButtonsAction (com.intellij.ide.actions.ViewToolWindowButtonsAction)1 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 DocumentEvent (javax.swing.event.DocumentEvent)1 Connection (nl.tudelft.watchdog.core.logic.network.NetworkUtils.Connection)1 Preferences (nl.tudelft.watchdog.intellij.ui.preferences.Preferences)1 ProjectRegistrationWizard (nl.tudelft.watchdog.intellij.ui.wizards.projectregistration.ProjectRegistrationWizard)1 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 Color (org.eclipse.swt.graphics.Color)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1 Nullable (org.jetbrains.annotations.Nullable)1