|
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | | - |
17 | 16 | package com.jetbrains.python.impl.sdk.skeletons; |
18 | 17 |
|
19 | 18 | import consulo.python.impl.localize.PyLocalize; |
|
26 | 25 | import java.util.Map; |
27 | 26 |
|
28 | 27 | public class SkeletonErrorsDialog extends JDialog { |
29 | | - private JPanel contentPane; |
30 | | - private JButton buttonOK; |
31 | | - private JBScrollPane myScroller; |
32 | | - private JTextPane myMessagePane; |
| 28 | + private JPanel contentPane; |
| 29 | + private JButton buttonOK; |
| 30 | + private JBScrollPane myScroller; |
| 31 | + private JTextPane myMessagePane; |
33 | 32 |
|
34 | | - public SkeletonErrorsDialog(Map<String, List<String>> errors, List<String> failed_sdks) { |
35 | | - setContentPane(contentPane); |
36 | | - setModal(true); |
37 | | - getRootPane().setDefaultButton(buttonOK); |
| 33 | + public SkeletonErrorsDialog(Map<String, List<String>> errors, List<String> failed_sdks) { |
| 34 | + setContentPane(contentPane); |
| 35 | + setModal(true); |
| 36 | + getRootPane().setDefaultButton(buttonOK); |
38 | 37 |
|
39 | | - buttonOK.addActionListener(e -> dispose()); |
| 38 | + buttonOK.addActionListener(e -> dispose()); |
40 | 39 |
|
41 | | - // fill data |
42 | | - myMessagePane.setContentType("text/html"); |
43 | | - myMessagePane.setBorder(new EmptyBorder(0, 0, 0, 0)); |
44 | | - StringBuilder sb = new StringBuilder("<html><body style='margin: 4pt;' "); |
45 | | - Color foreground = getParent().getForeground(); |
46 | | - Color background = getParent().getBackground(); |
47 | | - if (foreground != null && background != null) { |
48 | | - sb.append("text='").append(getHTMLColor(foreground)).append("' "); |
49 | | - sb.append("bgcolor='").append(getHTMLColor(background)).append("'"); |
50 | | - } |
51 | | - sb.append(">"); |
| 40 | + // fill data |
| 41 | + myMessagePane.setContentType("text/html"); |
| 42 | + myMessagePane.setBorder(new EmptyBorder(0, 0, 0, 0)); |
| 43 | + StringBuilder sb = new StringBuilder("<html><body style='margin: 4pt;' "); |
| 44 | + Color foreground = getParent().getForeground(); |
| 45 | + Color background = getParent().getBackground(); |
| 46 | + if (foreground != null && background != null) { |
| 47 | + sb.append("text='").append(getHTMLColor(foreground)).append("' "); |
| 48 | + sb.append("bgcolor='").append(getHTMLColor(background)).append("'"); |
| 49 | + } |
| 50 | + sb.append(">"); |
52 | 51 |
|
53 | | - if (failed_sdks.size() > 0) { |
54 | | - sb.append("<h1>").append(PyLocalize.sdkErrorDialogFailedSdks()).append("</h1>"); |
55 | | - sb.append("<ul>"); |
56 | | - for (String sdk_name : failed_sdks) { |
57 | | - sb.append("<li>").append(sdk_name).append("</li>"); |
58 | | - } |
59 | | - sb.append("</ul><br>"); |
60 | | - } |
| 52 | + if (failed_sdks.size() > 0) { |
| 53 | + sb.append("<h1>").append(PyLocalize.sdkErrorDialogFailedSdks()).append("</h1>"); |
| 54 | + sb.append("<ul>"); |
| 55 | + for (String sdk_name : failed_sdks) { |
| 56 | + sb.append("<li>").append(sdk_name).append("</li>"); |
| 57 | + } |
| 58 | + sb.append("</ul><br>"); |
| 59 | + } |
61 | 60 |
|
62 | | - if (errors.size() > 0) { |
63 | | - sb.append("<h1>").append(PyLocalize.sdkErrorDialogFailedModules()).append("</h1>"); |
64 | | - for (String sdk_name : errors.keySet()) { |
65 | | - sb.append("<b>").append(sdk_name).append("</b><br>"); |
66 | | - sb.append("<ul>"); |
67 | | - for (String module_name : errors.get(sdk_name)) { |
68 | | - sb.append("<li>").append(module_name).append("</li>"); |
| 61 | + if (errors.size() > 0) { |
| 62 | + sb.append("<h1>").append(PyLocalize.sdkErrorDialogFailedModules()).append("</h1>"); |
| 63 | + for (String sdk_name : errors.keySet()) { |
| 64 | + sb.append("<b>").append(sdk_name).append("</b><br>"); |
| 65 | + sb.append("<ul>"); |
| 66 | + for (String module_name : errors.get(sdk_name)) { |
| 67 | + sb.append("<li>").append(module_name).append("</li>"); |
| 68 | + } |
| 69 | + sb.append("</ul>"); |
| 70 | + } |
| 71 | + sb.append(PyLocalize.sdkErrorDialogWereBlacklisted()); |
69 | 72 | } |
70 | | - sb.append("</ul>"); |
71 | | - } |
72 | | - sb.append(PyLocalize.sdkErrorDialogWereBlacklisted()); |
73 | | - } |
74 | 73 |
|
75 | | - sb.append("</body></html>"); |
76 | | - myMessagePane.setText(sb.toString()); |
| 74 | + sb.append("</body></html>"); |
| 75 | + myMessagePane.setText(sb.toString()); |
77 | 76 |
|
78 | | - setTitle(PyLocalize.sdkErrorDialogProblems().get()); |
| 77 | + setTitle(PyLocalize.sdkErrorDialogProblems().get()); |
79 | 78 |
|
80 | | - pack(); |
81 | | - setLocationRelativeTo(getParent()); |
82 | | - } |
| 79 | + pack(); |
| 80 | + setLocationRelativeTo(getParent()); |
| 81 | + } |
83 | 82 |
|
84 | | - private static String getHTMLColor(Color color) { |
85 | | - StringBuilder sb = new StringBuilder("#"); |
86 | | - sb.append(Integer.toHexString(color.getRGB() & 0xffffff)); |
87 | | - return sb.toString(); |
88 | | - } |
| 83 | + private static String getHTMLColor(Color color) { |
| 84 | + StringBuilder sb = new StringBuilder("#"); |
| 85 | + sb.append(Integer.toHexString(color.getRGB() & 0xffffff)); |
| 86 | + return sb.toString(); |
| 87 | + } |
89 | 88 | } |
0 commit comments