mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
improvement for http://crucible.labs.intellij.net/cru/CR-IC-1432
1. Better bg/fg colors for "copyable label" 2. Better location and owner for IOExceptionDialog
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user