Search in sources :

Example 1 with ProjectSettingsStorage

use of com.almightyalpaca.jetbrains.plugins.discord.settings.data.storage.ProjectSettingsStorage in project Intellij-Discord-Integration by Almighty-Alpaca.

the class ToolsMenuDisableAnAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = e.getData(PlatformDataKeys.PROJECT);
    if (project == null)
        return;
    DiscordIntegrationApplicationComponent applicationComponent = DiscordIntegrationApplicationComponent.getInstance();
    DiscordIntegrationProjectComponent projectComponent = DiscordIntegrationProjectComponent.getInstance(project);
    InstanceInfo instanceInfo = applicationComponent.getInstanceInfo();
    if (projectComponent != null) {
        ProjectInfo projectInfo = projectComponent.getProjectInfo();
        ProjectSettingsStorage settings = DiscordIntegrationProjectSettings.getInstance(project).getState();
        settings.setEnabled(!settings.isEnabled());
        applicationComponent.updateData(data -> data.projectSetSettings(System.currentTimeMillis(), instanceInfo, projectInfo, settings));
        update(e);
        DiscordIntegrationProjectConfigurable.getInstance(project).reset();
    }
}
Also used : Project(com.intellij.openapi.project.Project) ProjectSettingsStorage(com.almightyalpaca.jetbrains.plugins.discord.settings.data.storage.ProjectSettingsStorage) DiscordIntegrationProjectComponent(com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent) ProjectInfo(com.almightyalpaca.jetbrains.plugins.discord.data.ProjectInfo) DiscordIntegrationApplicationComponent(com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationApplicationComponent) InstanceInfo(com.almightyalpaca.jetbrains.plugins.discord.data.InstanceInfo)

Aggregations

DiscordIntegrationApplicationComponent (com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationApplicationComponent)1 DiscordIntegrationProjectComponent (com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent)1 InstanceInfo (com.almightyalpaca.jetbrains.plugins.discord.data.InstanceInfo)1 ProjectInfo (com.almightyalpaca.jetbrains.plugins.discord.data.ProjectInfo)1 ProjectSettingsStorage (com.almightyalpaca.jetbrains.plugins.discord.settings.data.storage.ProjectSettingsStorage)1 Project (com.intellij.openapi.project.Project)1