mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
platform API: extension point for plugins to add their info to Submit a bug description (IDEA-209154)
(RIDER-IC-CR-63)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// Copyright 2000-2019 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
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
/**
|
||||
* Allows plugins to add additional details, which we want to see pre-populated in the bug reports.
|
||||
*/
|
||||
interface FeedbackDescriptionProvider {
|
||||
|
||||
/**
|
||||
* @return additional description details.
|
||||
*/
|
||||
fun getDescription(project: Project?): String?
|
||||
}
|
||||
@@ -17,6 +17,6 @@ public class ReportProblemAction extends DumbAwareAction {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
|
||||
SendFeedbackAction.doPerformActionImpl(e.getProject(), appInfo.getYoutrackUrl(), SendFeedbackAction.getDescription());
|
||||
SendFeedbackAction.doPerformActionImpl(e.getProject(), appInfo.getYoutrackUrl(), SendFeedbackAction.getDescription(e.getProject()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.ide.BrowserUtil;
|
||||
import com.intellij.ide.FeedbackDescriptionProvider;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -43,7 +45,7 @@ public class SendFeedbackAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
public static void doPerformAction(@Nullable Project project) {
|
||||
doPerformActionImpl(project, ApplicationInfoEx.getInstanceEx().getFeedbackUrl(), getDescription());
|
||||
doPerformActionImpl(project, ApplicationInfoEx.getInstanceEx().getFeedbackUrl(), getDescription(project));
|
||||
}
|
||||
|
||||
public static void doPerformAction(@Nullable Project project, @NotNull String description) {
|
||||
@@ -64,8 +66,17 @@ public class SendFeedbackAction extends AnAction implements DumbAware {
|
||||
BrowserUtil.browse(url, project);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getDescription(Project)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public static String getDescription() {
|
||||
return getDescription(null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getDescription(@Nullable Project project) {
|
||||
StringBuilder sb = new StringBuilder("\n\n");
|
||||
sb.append(ApplicationInfoEx.getInstanceEx().getBuild().asString()).append(", ");
|
||||
String javaVersion = System.getProperty("java.runtime.version", System.getProperty("java.version", "unknown"));
|
||||
@@ -106,6 +117,14 @@ public class SendFeedbackAction extends AnAction implements DumbAware {
|
||||
sb.append(SystemInfo.isMac ? "; Retina" : "; HiDPI");
|
||||
}
|
||||
}
|
||||
for (FeedbackDescriptionProvider ext : EP_NAME.getExtensions()) {
|
||||
String pluginDescription = ext.getDescription(project);
|
||||
if (pluginDescription != null && pluginDescription.length() > 0)
|
||||
sb.append("\n").append(pluginDescription);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private static ExtensionPointName<FeedbackDescriptionProvider> EP_NAME =
|
||||
new ExtensionPointName<>("com.intellij.feedbackDescriptionProvider");
|
||||
}
|
||||
@@ -348,5 +348,7 @@
|
||||
<extensionPoint qualifiedName="com.intellij.search.traverseUiHelper" interface="com.intellij.ide.ui.search.TraverseUIHelper"/>
|
||||
|
||||
<extensionPoint name="obsoleteStorage" beanClass="com.intellij.configurationStore.ObsoleteStorageBean"/>
|
||||
|
||||
<extensionPoint name="feedbackDescriptionProvider" interface="com.intellij.ide.FeedbackDescriptionProvider"/>
|
||||
</extensionPoints>
|
||||
</idea-plugin>
|
||||
|
||||
Reference in New Issue
Block a user