WIP plugins: show strong notification to disable all disallowed plugins

GitOrigin-RevId: 95154463bcab7d4d068723e1074922241d28c6fa
This commit is contained in:
Eugene Petrenko
2021-07-13 17:53:09 +00:00
committed by intellij-monorepo-bot
parent 83d1ab926e
commit 09b93ecbc9
3 changed files with 29 additions and 5 deletions
@@ -471,7 +471,9 @@ button.http.proxy.settings=&HTTP Proxy Settings...
group.vendor=Vendor
plugin.status.installed=Installed
plugin.status.not.allowed=Blocked
plugin.status.not.allowed.but.enabled=Disable!
plugin.status.not.allowed.tooltip=The plugin is not approved by your organization
plugin.status.not.allowed.tooltip.but.enabled=Please disable the plugin, it is not approved by your organization
plugin.status.bundled=bundled
progress.downloading.plugin=Downloading plugin ''{0}''
error.cannot.create.temp.dir=Unable to create temp directory ''{0}''
@@ -1,4 +1,4 @@
// Copyright 2000-2018 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.
// Copyright 2000-2021 JetBrains s.r.o. and contributors. 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.plugins.newui;
import com.intellij.ide.IdeBundle;
@@ -28,6 +28,10 @@ public class InstallButton extends ColorButton {
private static final Color BorderColor = JBColor.namedColor("Plugins.Button.installBorderColor", GreenColor);
public InstallButton(boolean fill) {
setButtonColors(fill);
}
public void setButtonColors(boolean fill) {
if (fill) {
setTextColor(FillForegroundColor);
setBgColor(FillBackgroundColor);
@@ -170,13 +170,31 @@ public class ListPluginComponent extends JPanel {
}
private void createNotAllowedMarker() {
myInstallButton = new InstallButton(true);
myInstallButton.setEnabled(false, IdeBundle.message("plugin.status.not.allowed"));
myInstallButton.setToolTipText(IdeBundle.message("plugin.status.not.allowed.tooltip"));
ColorButton.setWidth72(myInstallButton);
myInstallButton = new InstallButton(false);
setupNotAllowedMarkerButton();
myLayout.addButtonComponent(myInstallButton);
}
private void setupNotAllowedMarkerButton() {
if (myMarketplace || myPluginModel.getState(myPlugin).isDisabled()) {
myInstallButton.setButtonColors(false);
myInstallButton.setEnabled(false, IdeBundle.message("plugin.status.not.allowed"));
myInstallButton.setToolTipText(IdeBundle.message("plugin.status.not.allowed.tooltip"));
} else {
myInstallButton.setButtonColors(false);
myInstallButton.setEnabled(true, IdeBundle.message("plugin.status.not.allowed.but.enabled"));
myInstallButton.setText(IdeBundle.message("plugin.status.not.allowed.but.enabled"));
myInstallButton.setToolTipText(IdeBundle.message("plugin.status.not.allowed.tooltip"));
myInstallButton.setBorderColor(JBColor.red);
myInstallButton.setTextColor(JBColor.red);
myInstallButton.addActionListener(e -> {
myPluginModel.setEnabledState(List.of(myPlugin), PluginEnableDisableAction.globally(false));
setupNotAllowedMarkerButton();
});
}
ColorButton.setWidth72(myInstallButton);
}
private void createButtons() {
if (myMarketplace) {
if (InstalledPluginsState.getInstance().wasInstalled(myPlugin.getPluginId())) {