mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
GDPR support: menu action for Data Sharing Options
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.ide.gdpr.Consent;
|
||||
import com.intellij.ide.gdpr.ConsentOptions;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.ui.AppUIUtil;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class DataSharingOptionsAction extends DumbAwareAction {
|
||||
public DataSharingOptionsAction() {
|
||||
super("Data Sharing Options...", "Data Sharing Options", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setEnabledAndVisible(!ConsentOptions.getConsents().first.isEmpty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Pair<Collection<Consent>, Boolean> consentsToShow = ConsentOptions.getConsents();
|
||||
try {
|
||||
final Collection<Consent> result = AppUIUtil.confirmConsentOptions(consentsToShow.first);
|
||||
if (result != null) {
|
||||
ConsentOptions.setConsents(result);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.getInstance(DataSharingOptionsAction.class).warn(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -559,6 +559,7 @@
|
||||
<separator/>
|
||||
<action id="CheckForUpdate" class="com.intellij.openapi.updateSettings.impl.CheckForUpdateAction"/>
|
||||
<action id="About" class="com.intellij.ide.actions.AboutAction"/>
|
||||
<action id="DataSharingOptions" class="com.intellij.ide.actions.DataSharingOptionsAction"/>
|
||||
</group>
|
||||
|
||||
<group id="OtherMenu" class="com.intellij.ide.actions.NonEmptyActionGroup"/>
|
||||
|
||||
Reference in New Issue
Block a user