From f27cd2c1b724667ba324cfedadb2eaf05778b770 Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Sat, 16 Aug 2014 15:01:05 +0400 Subject: [PATCH] log skeleton generation errors and don't show it to user --- .../sdk/skeletons/PySkeletonRefresher.java | 36 ++++--- .../sdk/skeletons/SkeletonErrorsDialog.form | 61 ------------ .../sdk/skeletons/SkeletonErrorsDialog.java | 94 ------------------- 3 files changed, 22 insertions(+), 169 deletions(-) delete mode 100644 python/src/com/jetbrains/python/sdk/skeletons/SkeletonErrorsDialog.form delete mode 100644 python/src/com/jetbrains/python/sdk/skeletons/SkeletonErrorsDialog.java diff --git a/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java b/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java index 284a125e8736..4e4a43102202 100644 --- a/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java +++ b/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java @@ -20,7 +20,6 @@ import com.google.common.collect.Lists; import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer; import com.intellij.execution.ExecutionException; import com.intellij.notification.Notification; -import com.intellij.notification.NotificationListener; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; import com.intellij.openapi.application.ApplicationManager; @@ -35,6 +34,7 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; @@ -58,7 +58,6 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.event.HyperlinkEvent; import java.awt.*; import java.io.*; import java.util.*; @@ -164,18 +163,27 @@ public class PySkeletonRefresher { else { message = PyBundle.message("sdk.errorlog.$0.mods.fail.in.$1.sdks", module_errors, errors.size()); } - Notifications.Bus.notify( - new Notification( - PythonSdkType.SKELETONS_TOPIC, PyBundle.message("sdk.some.skeletons.failed"), message, - NotificationType.WARNING, - new NotificationListener() { - @Override - public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { - new SkeletonErrorsDialog(errors, failedSdks).setVisible(true); - } - } - ) - ); + logErrors(errors, failedSdks, message); + } + } + + private static void logErrors(@NotNull final Map> errors, @NotNull final List failedSdks, + @NotNull final String message) { + LOG.warn(PyBundle.message("sdk.some.skeletons.failed")); + LOG.warn(message); + + if (failedSdks.size() > 0) { + LOG.warn(PyBundle.message("sdk.error.dialog.failed.sdks")); + LOG.warn(StringUtil.join(failedSdks, ", ")); + } + + if (errors.size() > 0) { + LOG.warn(PyBundle.message("sdk.error.dialog.failed.modules")); + for (String sdkName : errors.keySet()) { + for (String moduleName : errors.get(sdkName)) { + LOG.warn(moduleName); + } + } } } diff --git a/python/src/com/jetbrains/python/sdk/skeletons/SkeletonErrorsDialog.form b/python/src/com/jetbrains/python/sdk/skeletons/SkeletonErrorsDialog.form deleted file mode 100644 index c82d5fa91b00..000000000000 --- a/python/src/com/jetbrains/python/sdk/skeletons/SkeletonErrorsDialog.form +++ /dev/null @@ -1,61 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/python/src/com/jetbrains/python/sdk/skeletons/SkeletonErrorsDialog.java b/python/src/com/jetbrains/python/sdk/skeletons/SkeletonErrorsDialog.java deleted file mode 100644 index f6c6b45ceb44..000000000000 --- a/python/src/com/jetbrains/python/sdk/skeletons/SkeletonErrorsDialog.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jetbrains.python.sdk.skeletons; - -import com.intellij.ui.components.JBScrollPane; -import com.jetbrains.python.PyBundle; - -import javax.swing.*; -import javax.swing.border.EmptyBorder; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.List; -import java.util.Map; - -public class SkeletonErrorsDialog extends JDialog { - private JPanel contentPane; - private JButton buttonOK; - private JBScrollPane myScroller; - private JTextPane myMessagePane; - - public SkeletonErrorsDialog(Map> errors, List failed_sdks) { - setContentPane(contentPane); - setModal(true); - getRootPane().setDefaultButton(buttonOK); - - buttonOK.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - dispose(); - } - }); - - // fill data - myMessagePane.setContentType("text/html"); - myMessagePane.setBorder(new EmptyBorder(0, 0, 0, 0)); - StringBuilder sb = new StringBuilder(""); - - if (failed_sdks.size() > 0) { - sb.append("

").append(PyBundle.message("sdk.error.dialog.failed.sdks")).append("

"); - sb.append("
    "); - for (String sdk_name : failed_sdks) { - sb.append("
  • ").append(sdk_name).append("
  • "); - } - sb.append("

"); - } - - if (errors.size() > 0) { - sb.append("

").append(PyBundle.message("sdk.error.dialog.failed.modules")).append("

"); - for (String sdk_name : errors.keySet()) { - sb.append("").append(sdk_name).append("
"); - sb.append("
    "); - for (String module_name : errors.get(sdk_name)) { - sb.append("
  • ").append(module_name).append("
  • "); - } - sb.append("
"); - } - sb.append(PyBundle.message("sdk.error.dialog.were.blacklisted")); - } - - sb.append(""); - myMessagePane.setText(sb.toString()); - - setTitle(PyBundle.message("sdk.error.dialog.problems")); - - pack(); - setLocationRelativeTo(getParent()); - } - - private static String getHTMLColor(Color color) { - StringBuilder sb = new StringBuilder("#"); - sb.append(Integer.toHexString(color.getRGB() & 0xffffff)); - return sb.toString(); - } -}