From 68b871c9ac8e6f6be40aff331b9a73298fd93707 Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Fri, 7 Sep 2018 18:59:58 +0300 Subject: [PATCH] DBE-7036 DataGrip is missing "Report a Problem" menu item under Help --- .../ide/actions/ReportProblemAction.java | 22 +++++++ .../ide/actions/SendFeedbackAction.java | 42 ++++++++------ .../src/messages/ActionsBundle.properties | 4 +- .../src/idea/PlatformActions.xml | 1 + python/ide/src/META-INF/pycharm-core.xml | 4 -- .../jetbrains/python/ReportProblemAction.java | 57 ------------------- 6 files changed, 50 insertions(+), 80 deletions(-) create mode 100644 platform/platform-impl/src/com/intellij/ide/actions/ReportProblemAction.java delete mode 100644 python/ide/src/com/jetbrains/python/ReportProblemAction.java diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ReportProblemAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ReportProblemAction.java new file mode 100644 index 000000000000..f3f0c45ec372 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/ide/actions/ReportProblemAction.java @@ -0,0 +1,22 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + +package com.intellij.ide.actions; + +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.application.ex.ApplicationInfoEx; +import com.intellij.openapi.project.DumbAwareAction; +import org.jetbrains.annotations.NotNull; + +public class ReportProblemAction extends DumbAwareAction { + @Override + public void update(@NotNull AnActionEvent e) { + ApplicationInfoEx info = ApplicationInfoEx.getInstanceEx(); + String url = info == null ? null : info.getEAPFeedbackUrl(); + e.getPresentation().setEnabledAndVisible(url != null && url.contains("youtrack")); + } + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + SendFeedbackAction.doPerformAction(e.getProject(), ApplicationInfoEx.getInstanceEx().getEAPFeedbackUrl()); + } +} diff --git a/platform/platform-impl/src/com/intellij/ide/actions/SendFeedbackAction.java b/platform/platform-impl/src/com/intellij/ide/actions/SendFeedbackAction.java index bd87976fa453..799132a04634 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/SendFeedbackAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/SendFeedbackAction.java @@ -32,18 +32,32 @@ import java.awt.*; public class SendFeedbackAction extends AnAction implements DumbAware { @Override - public void actionPerformed(@NotNull AnActionEvent e) { - launchBrowser(e.getProject()); + public void update(@NotNull AnActionEvent e) { + ApplicationInfoEx info = ApplicationInfoEx.getInstanceEx(); + String url = info == null ? null : info.getReleaseFeedbackUrl(); + e.getPresentation().setEnabledAndVisible(url != null); } - public static void launchBrowser(@Nullable Project project) { - final ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx(); + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + doPerformAction(e.getProject()); + } + + public static void doPerformAction(@Nullable Project project) { + ApplicationInfoEx info = ApplicationInfoEx.getInstanceEx(); + String eapUrl = info.getEAPFeedbackUrl(); + String urlTemplate = info.isEAP() && !eapUrl.contains("youtrack") ? eapUrl : info.getReleaseFeedbackUrl(); + doPerformAction(project, urlTemplate); + } + + static void doPerformAction(@Nullable Project project, @NotNull String urlTemplate) { + ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx(); boolean eap = appInfo.isEAP(); - String urlTemplate = eap ? appInfo.getEAPFeedbackUrl() : appInfo.getReleaseFeedbackUrl(); + LicensingFacade la = LicensingFacade.getInstance(); urlTemplate = urlTemplate .replace("$BUILD", eap ? appInfo.getBuild().asStringWithoutProductCode() : appInfo.getBuild().asString()) .replace("$TIMEZONE", System.getProperty("user.timezone")) - .replace("$EVAL", isEvaluationLicense() ? "true" : "false") + .replace("$EVAL", la != null && la.isEvaluationLicense() ? "true" : "false") .replace("$DESCR", getDescription()); BrowserUtil.browse(urlTemplate, project); } @@ -72,7 +86,7 @@ public class SendFeedbackAction extends AnAction implements DumbAware { String osPatchLevel = System.getProperty("sun.os.patch.level"); if (osVersion != null) { sb.append(" v").append(osVersion); - if (osPatchLevel != null) { + if (osPatchLevel != null && !"unknown".equals(osPatchLevel)) { sb.append(" ").append(osPatchLevel); } } @@ -85,18 +99,10 @@ public class SendFeedbackAction extends AnAction implements DumbAware { Rectangle bounds = device.getDefaultConfiguration().getBounds(); sb.append(bounds.width).append("x").append(bounds.height); } - if (UIUtil.isRetina()) sb.append(SystemInfo.isMac ? "; Retina" : "; HiDPI"); + if (UIUtil.isRetina()) { + sb.append(SystemInfo.isMac ? "; Retina" : "; HiDPI"); + } } return sb.toString(); } - - @Override - public void update(@NotNull AnActionEvent e) { - e.getPresentation().setEnabled(ApplicationInfoEx.getInstanceEx() != null); - } - - private static boolean isEvaluationLicense() { - final LicensingFacade la = LicensingFacade.getInstance(); - return la != null && la.isEvaluationLicense(); - } } diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index ed5110bafd8c..d10fefdd9a85 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -1268,7 +1268,9 @@ action.EditCustomVmOptions.description=Opens an editor tab with a custom VM opti action.LogDebugConfigure.text=D_ebug Log Settings... action.LogDebugConfigure.description=Enable or disable additional log categories. Allows to provide more information to the support team by request. action.TechnicalSupport.text=_Support Center -action.TechnicalSupport.description=Access technical support on JetBrains Web site +action.TechnicalSupport.description=Access technical support on JetBrains website +action.ReportProblem.text=Report Problem... +action.ReportProblem.description=Report problem in JetBrains issue tracker action.TextComponent.ClearAction.text=Clear text action.TextComponent.ClearAction.description=Clear text in text components diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 51fda4c28999..fdc8a6043dea 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -565,6 +565,7 @@ + diff --git a/python/ide/src/META-INF/pycharm-core.xml b/python/ide/src/META-INF/pycharm-core.xml index bba1a2993004..800e1356c456 100644 --- a/python/ide/src/META-INF/pycharm-core.xml +++ b/python/ide/src/META-INF/pycharm-core.xml @@ -128,10 +128,6 @@ - - - - diff --git a/python/ide/src/com/jetbrains/python/ReportProblemAction.java b/python/ide/src/com/jetbrains/python/ReportProblemAction.java deleted file mode 100644 index 9ad49a7ac367..000000000000 --- a/python/ide/src/com/jetbrains/python/ReportProblemAction.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2000-2016 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; - -import com.intellij.ide.BrowserUtil; -import com.intellij.ide.actions.SendFeedbackAction; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.application.ex.ApplicationInfoEx; -import com.intellij.openapi.project.DumbAware; -import com.intellij.openapi.project.Project; -import com.intellij.ui.LicensingFacade; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class ReportProblemAction extends AnAction implements DumbAware { - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - launchBrowser(e.getProject()); - } - - public static void launchBrowser(@Nullable Project project) { - final ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx(); - boolean eap = appInfo.isEAP(); - String urlTemplate = appInfo.getEAPFeedbackUrl(); - urlTemplate = urlTemplate - .replace("$BUILD", eap ? appInfo.getBuild().asStringWithoutProductCode() : appInfo.getBuild().asString()) - .replace("$TIMEZONE", System.getProperty("user.timezone")) - .replace("$EVAL", isEvaluationLicense() ? "true" : "false") - .replace("$DESCR", SendFeedbackAction.getDescription()); - BrowserUtil.browse(urlTemplate, project); - } - - @Override - public void update(@NotNull AnActionEvent e) { - e.getPresentation().setEnabled(ApplicationInfoEx.getInstanceEx() != null); - } - - private static boolean isEvaluationLicense() { - final LicensingFacade la = LicensingFacade.getInstance(); - return la != null && la.isEvaluationLicense(); - } -}