mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[plugins] IJPL-211809 Surrounded all PluginsViewCustomizer calls with try-catch blocks
(cherry picked from commit 52ce87823cf7da919bf7b2e105995ca240200c6f) IJ-CR-179435 GitOrigin-RevId: 5b5d6c0b9d03faeaff2739b1c7622e47c903873b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fe5937086c
commit
1ee4c130f1
@@ -2,11 +2,11 @@
|
||||
package com.intellij.ide.plugins;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.plugins.newui.TabbedPaneHeaderComponent;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.PluginId;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
@@ -54,6 +54,8 @@ public final class PluginManagerConfigurable
|
||||
|
||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MMM dd, yyyy");
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(PluginManagerConfigurable.class);
|
||||
|
||||
private PluginManagerConfigurablePanel myPanel;
|
||||
|
||||
/**
|
||||
@@ -96,7 +98,12 @@ public final class PluginManagerConfigurable
|
||||
public @Nullable JComponent createComponent() {
|
||||
PluginManagerConfigurablePanel panel = createPanelIfNeeded();
|
||||
|
||||
getPluginsViewCustomizer().processConfigurable(this);
|
||||
try {
|
||||
getPluginsViewCustomizer().processConfigurable(this);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("Error while processing configurable", e);
|
||||
}
|
||||
|
||||
return panel.getComponent();
|
||||
}
|
||||
|
||||
+17
-13
@@ -900,22 +900,26 @@ public final class PluginManagerConfigurablePanel implements Disposable {
|
||||
Map<PluginUiModel, Double> pluginToScore = null;
|
||||
|
||||
if (parser.internal) {
|
||||
PluginsViewCustomizer.PluginsGroupDescriptor groupDescriptor =
|
||||
PluginsViewCustomizerKt.getPluginsViewCustomizer().getInternalPluginsGroupDescriptor();
|
||||
if (groupDescriptor != null) {
|
||||
if (parser.searchQuery == null) {
|
||||
result.addDescriptors(groupDescriptor.getPlugins());
|
||||
}
|
||||
else {
|
||||
for (IdeaPluginDescriptor pluginDescriptor : groupDescriptor.getPlugins()) {
|
||||
if (StringUtil.containsIgnoreCase(pluginDescriptor.getName(), parser.searchQuery)) {
|
||||
result.addDescriptor(pluginDescriptor);
|
||||
try {
|
||||
PluginsViewCustomizer.PluginsGroupDescriptor groupDescriptor =
|
||||
PluginsViewCustomizerKt.getPluginsViewCustomizer().getInternalPluginsGroupDescriptor();
|
||||
if (groupDescriptor != null) {
|
||||
if (parser.searchQuery == null) {
|
||||
result.addDescriptors(groupDescriptor.getPlugins());
|
||||
}
|
||||
else {
|
||||
for (IdeaPluginDescriptor pluginDescriptor : groupDescriptor.getPlugins()) {
|
||||
if (StringUtil.containsIgnoreCase(pluginDescriptor.getName(), parser.searchQuery)) {
|
||||
result.addDescriptor(pluginDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
result.removeDuplicates();
|
||||
result.sortByName();
|
||||
return;
|
||||
}
|
||||
result.removeDuplicates();
|
||||
result.sortByName();
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error while loading internal plugins group", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.intellij.internal.inspector.UiInspectorUtil;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.PluginId;
|
||||
import com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
@@ -59,6 +60,7 @@ public final class ListPluginComponent extends JPanel {
|
||||
public static final Color GRAY_COLOR = JBColor.namedColor("Label.infoForeground", new JBColor(Gray._120, Gray._135));
|
||||
public static final Color SELECTION_COLOR = JBColor.namedColor("Plugins.lightSelectionBackground", new JBColor(0xEDF6FE, 0x464A4D));
|
||||
public static final Color HOVER_COLOR = JBColor.namedColor("Plugins.hoverBackground", new JBColor(0xEDF6FE, 0x464A4D));
|
||||
private static final Logger LOG = Logger.getInstance(ListPluginComponent.class);
|
||||
|
||||
private static final Ref<Boolean> HANDLE_FOCUS_ON_SELECTION = new Ref<>(Boolean.TRUE);
|
||||
|
||||
@@ -163,7 +165,12 @@ public final class ListPluginComponent extends JPanel {
|
||||
|
||||
UiInspectorUtil.registerProvider(this, new PluginIdUiInspectorContextProvider());
|
||||
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processListPluginComponent(this);
|
||||
try {
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processListPluginComponent(this);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("Error while customizing list plugin component", e);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull PluginsGroup getGroup() { return myGroup; }
|
||||
@@ -335,7 +342,12 @@ public final class ListPluginComponent extends JPanel {
|
||||
myAlignButton.setOpaque(false);
|
||||
}
|
||||
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processCreateButtons(this);
|
||||
try {
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processCreateButtons(this);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("Error while customizing create buttons", e);
|
||||
}
|
||||
}
|
||||
|
||||
private @NotNull InstallButton createInstallButton() {
|
||||
@@ -855,7 +867,12 @@ public final class ListPluginComponent extends JPanel {
|
||||
myAlignButton.setVisible(true);
|
||||
}
|
||||
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processRemoveButtons(this);
|
||||
try {
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processRemoveButtons(this);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("Error while customizing remove buttons", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateButtons(PluginUiModel installedPlugin, PluginInstallationState state) {
|
||||
@@ -892,7 +909,12 @@ public final class ListPluginComponent extends JPanel {
|
||||
updateErrors();
|
||||
setSelection(mySelection, false);
|
||||
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processUpdateEnabledState(this);
|
||||
try {
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processUpdateEnabledState(this);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("Error while customizing enabled state", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEnabledStateUI() {
|
||||
|
||||
+14
-2
@@ -4,6 +4,7 @@ package com.intellij.ide.plugins.newui;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.ui.ComponentUtil;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -19,6 +20,7 @@ import java.util.function.Consumer;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class MultiSelectionEventHandler extends EventHandler {
|
||||
private static final Logger LOG = Logger.getInstance(MultiSelectionEventHandler.class);
|
||||
private PluginsGroupComponent myContainer;
|
||||
private PagePluginLayout myLayout;
|
||||
private List<ListPluginComponent> myComponents;
|
||||
@@ -95,7 +97,12 @@ public final class MultiSelectionEventHandler extends EventHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processCreatePopupMenu(component, group, getSelection());
|
||||
try {
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processCreatePopupMenu(component, group, getSelection());
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("Error while customizing popup menu", e);
|
||||
}
|
||||
|
||||
ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu("PluginManagerConfigurable", group);
|
||||
popupMenu.setTargetComponent(component);
|
||||
@@ -188,7 +195,12 @@ public final class MultiSelectionEventHandler extends EventHandler {
|
||||
}
|
||||
component.handleKeyAction(event, getSelection());
|
||||
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processHandleKeyAction(component, event, getSelection());
|
||||
try {
|
||||
PluginsViewCustomizerKt.getListPluginComponentCustomizer().processHandleKeyAction(component, event, getSelection());
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("Error while customizing handle key action", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+22
-3
@@ -24,6 +24,7 @@ import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.application.asContextElement
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.extensions.PluginId
|
||||
import com.intellij.openapi.progress.runBlockingCancellable
|
||||
import com.intellij.openapi.project.Project
|
||||
@@ -177,7 +178,13 @@ class PluginDetailsPageComponent @JvmOverloads constructor(
|
||||
|
||||
init {
|
||||
nameAndButtons = BaselinePanel(12, false)
|
||||
customizer = getPluginsViewCustomizer().getPluginDetailsCustomizer(pluginModel.getModel())
|
||||
customizer = try {
|
||||
getPluginsViewCustomizer().getPluginDetailsCustomizer(pluginModel.getModel())
|
||||
}
|
||||
catch (e: Exception) {
|
||||
LOG.error("Error while getting plugin details customizer", e)
|
||||
NoOpPluginsViewCustomizer.getPluginDetailsCustomizer(pluginModel.getModel())
|
||||
}
|
||||
pluginManagerCustomizer = PluginManagerCustomizer.getInstance()
|
||||
|
||||
createPluginPanel()
|
||||
@@ -186,6 +193,8 @@ class PluginDetailsPageComponent @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val LOG = logger<PluginDetailsPageComponent>()
|
||||
|
||||
@JvmStatic
|
||||
fun createDescriptionComponent(imageViewHandler: Consumer<in View>?): JEditorPane {
|
||||
val kit = HTMLEditorKitBuilder().withViewFactoryExtensions({ e, view ->
|
||||
@@ -460,7 +469,12 @@ class PluginDetailsPageComponent @JvmOverloads constructor(
|
||||
component.background = PluginManagerConfigurable.MAIN_BG_COLOR
|
||||
}
|
||||
|
||||
customizer.processPluginNameAndButtonsComponent(nameAndButtons)
|
||||
try {
|
||||
customizer.processPluginNameAndButtonsComponent(nameAndButtons)
|
||||
}
|
||||
catch (e: Exception) {
|
||||
LOG.error("Error during PluginDetailsPage customization", e)
|
||||
}
|
||||
}
|
||||
|
||||
fun setOnlyUpdateMode() {
|
||||
@@ -893,7 +907,12 @@ class PluginDetailsPageComponent @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
if (plugin != null) {
|
||||
customizer.processShowPlugin(plugin!!.getDescriptor())
|
||||
try {
|
||||
customizer.processShowPlugin(plugin!!.getDescriptor())
|
||||
}
|
||||
catch (e: Exception) {
|
||||
LOG.error("Error during processShowPlugin() customization", e)
|
||||
}
|
||||
}
|
||||
|
||||
mySuggestedIdeBanner.suggestIde(suggestedCommercialIde, plugin!!.pluginId)
|
||||
|
||||
Reference in New Issue
Block a user