diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemRunnableState.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemRunnableState.java index ef34d4489997f..5f12580044d71 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemRunnableState.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemRunnableState.java @@ -326,7 +326,8 @@ public void onTaskOutput(@NotNull ExternalSystemTaskId id, @NotNull String text, public void onFailure(@NotNull ExternalSystemTaskId id, @NotNull Exception e) { DataContext dataContext = BuildConsoleUtils.getDataContext(id, progressListener); FailureResult failureResult = ExternalSystemUtil.createFailureResult( - executionName + " " + BuildBundle.message("build.status.failed"), e, id.getProjectSystemId(), myProject, dataContext); + executionName + " " + BuildBundle.message("build.status.failed"), e, id.getProjectSystemId(), myProject, + mySettings.getExternalProjectPath(), dataContext); eventDispatcher.onEvent(id, new FinishBuildEventImpl(id, null, System.currentTimeMillis(), BuildBundle.message("build.status.failed"), failureResult)); processHandler.notifyProcessTerminated(1); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationExtension.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationExtension.java index c8e5146571fa4..d25610493b43c 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationExtension.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationExtension.java @@ -36,14 +36,29 @@ public interface ExternalSystemNotificationExtension { /** * Allows to customize external system processing notification. * - * @param notificationData notification data - * @param project target ide project - * @param error error occurred during external system processing + * @param notificationData notification data + * @param project target ide project + * @param externalProjectPath path of the target external project + * @param error error occurred during external system processing */ void customize(@NotNull NotificationData notificationData, @NotNull Project project, + @NotNull String externalProjectPath, @Nullable Throwable error); + /** + * Allows to customize external system processing notification. + * @deprecated Use {@link #customize(NotificationData, Project, String, Throwable)} instead + * @param notificationData notification data + * @param project target ide project + * @param error error occurred during external system processing + */ + @Deprecated + default void customize(@NotNull NotificationData notificationData, + @NotNull Project project, + @Nullable Throwable error) { + } + /** * Allows to determine internal errors comes from external system which might be confusing for IDE users. * Such errors shouldn't be shown to the end user on UI. diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationExtensionImpl.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationExtensionImpl.java index 34ab26874d0b1..67291105bf21b 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationExtensionImpl.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationExtensionImpl.java @@ -36,6 +36,7 @@ public ProjectSystemId getTargetExternalSystemId() { @Override public void customize(@NotNull NotificationData notification, @NotNull Project project, + @NotNull String externalProjectPath, @Nullable Throwable error) { if (error == null) return; Throwable unwrapped = RemoteUtil.unwrap(error); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationManager.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationManager.java index fddcd550542f4..53618b7779483 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationManager.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationManager.java @@ -102,6 +102,7 @@ public ExternalSystemNotificationManager(final @NotNull Project project) { @NotNull Throwable error, @NotNull ProjectSystemId externalSystemId, @NotNull Project project, + @NotNull String externalProjectPath, @NotNull DataContext dataContext) { if (isInternalError(error, externalSystemId)) { return null; @@ -141,6 +142,7 @@ public ExternalSystemNotificationManager(final @NotNull Project project) { if (!externalSystemId.equals(targetExternalSystemId) && !targetExternalSystemId.equals(ProjectSystemId.IDE)) { continue; } + extension.customize(notificationData, project, externalProjectPath, error); extension.customize(notificationData, project, error); } return notificationData; diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java index daf6791ba5b74..c7642812d2500 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java @@ -416,7 +416,7 @@ public void onFailure(@NotNull ExternalSystemTaskId id, @NotNull Exception e) { var externalSystemName = externalSystemId.getReadableName(); var title = ExternalSystemBundle.message("notification.project.refresh.fail.title", externalSystemName, projectName); var dataContext = BuildConsoleUtils.getDataContext(id, syncViewManager); - var eventResult = createFailureResult(title, e, externalSystemId, project, dataContext); + var eventResult = createFailureResult(title, e, externalSystemId, project, externalProjectPath, dataContext); return new FinishBuildEventImpl(id, null, eventTime, eventMessage, eventResult); }); processHandler.notifyProcessTerminated(1); @@ -585,7 +585,7 @@ private static void handleSyncResult( var systemName = externalSystemId.getReadableName(); var projectName = resolveProjectTask.getProjectName(); var title = ExternalSystemBundle.message("notification.project.refresh.fail.title", systemName, projectName); - var eventResult = createFailureResult(title, t, externalSystemId, project, DataContext.EMPTY_CONTEXT); + var eventResult = createFailureResult(title, t, externalSystemId, project, externalProjectPath, DataContext.EMPTY_CONTEXT); return new FinishBuildEventImpl(taskId, null, eventTime, eventMessage, eventResult); }); } @@ -699,9 +699,10 @@ public static void markModuleAsMaven(@NotNull Module module, @Nullable String mo @NotNull Throwable exception, @NotNull ProjectSystemId externalSystemId, @NotNull Project project, + @NotNull String externalProjectPath, @NotNull DataContext dataContext) { var notificationManager = ExternalSystemNotificationManager.getInstance(project); - var notificationData = notificationManager.createNotification(title, exception, externalSystemId, project, dataContext); + var notificationData = notificationManager.createNotification(title, exception, externalSystemId, project, externalProjectPath, dataContext); if (notificationData == null) { return new FailureResultImpl(); } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/notification/GradleNotificationExtension.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/notification/GradleNotificationExtension.java index a7678e82fa80c..4a3eec24b55d0 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/notification/GradleNotificationExtension.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/notification/GradleNotificationExtension.java @@ -80,6 +80,7 @@ public boolean isInternalError(@NotNull Throwable error) { @Override public void customize(@NotNull NotificationData notification, @NotNull Project project, + @NotNull String externalProjectPath, @Nullable Throwable error) { if (error == null) return; Throwable unwrapped = RemoteUtil.unwrap(error);