diff --git a/platform/platform-api/src/com/intellij/util/net/IOExceptionDialog.java b/platform/platform-api/src/com/intellij/util/net/IOExceptionDialog.java index 4e0640ea52ae..fa7a27b1dc3f 100644 --- a/platform/platform-api/src/com/intellij/util/net/IOExceptionDialog.java +++ b/platform/platform-api/src/com/intellij/util/net/IOExceptionDialog.java @@ -17,6 +17,7 @@ package com.intellij.util.net; import com.intellij.openapi.MnemonicHelper; import com.intellij.ui.GuiUtils; +import com.intellij.util.ui.UIUtil; import javax.swing.*; import java.awt.event.*; @@ -38,7 +39,7 @@ public class IOExceptionDialog extends JDialog { private boolean cancelPressed = false; public IOExceptionDialog(String title, String errorText) { - super (JOptionPane.getRootFrame(), title, true); + super(UIUtil.getActiveWindow(), title, DEFAULT_MODALITY_TYPE); new MnemonicHelper().register(getContentPane()); @@ -62,6 +63,9 @@ public class IOExceptionDialog extends JDialog { ); errorLabel.setText(errorText); + errorLabel.setFont(UIManager.getFont("Label.font")); + errorLabel.setBackground(UIManager.getColor("Label.background")); + errorLabel.setForeground(UIManager.getColor("Label.foreground")); setupButton.addActionListener(new ActionListener () { public void actionPerformed(ActionEvent e) { @@ -83,7 +87,7 @@ public class IOExceptionDialog extends JDialog { }); pack(); - setLocationRelativeTo(null); + setLocationRelativeTo(getOwner()); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java b/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java index 212ade114677..2883afaf0125 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java @@ -39,6 +39,7 @@ import com.intellij.xml.util.XmlStringUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import javax.swing.*; import javax.swing.event.HyperlinkEvent; import java.io.IOException; import java.util.*; @@ -173,10 +174,16 @@ public class ActionInstallPlugin extends AnAction implements DumbAware { } }); } - catch (IOException e1) { + catch (final IOException e1) { + ourInstallingNodes.removeAll(list); PluginManagerMain.LOG.error(e1); - IOExceptionDialog - .showErrorDialog(IdeBundle.message("action.download.and.install.plugin"), IdeBundle.message("error.plugin.download.failed")); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + IOExceptionDialog + .showErrorDialog(IdeBundle.message("action.download.and.install.plugin"), IdeBundle.message("error.plugin.download.failed")); + } + }); } } } diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 9322abc3d44d..0015dec87667 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -2677,4 +2677,12 @@ public class UIUtil { return null; } + @NotNull + public static Window getActiveWindow() { + Window[] windows = Window.getWindows(); + for (Window each : windows) { + if (each.isVisible() && each.isActive()) return each; + } + return JOptionPane.getRootFrame(); + } }