Skip to content

Commit

Permalink
Expose externalProjectPath on ExternalSystemNotificationExtension.cus…
Browse files Browse the repository at this point in the history
…tomize()
  • Loading branch information
vmadalin committed May 10, 2023
1 parent 98408a4 commit a075b77
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ 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);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,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;
Expand Down Expand Up @@ -140,7 +141,7 @@ public ExternalSystemNotificationManager(final @NotNull Project project) {
if (!externalSystemId.equals(targetExternalSystemId) && !targetExternalSystemId.equals(ProjectSystemId.IDE)) {
continue;
}
extension.customize(notificationData, project, error);
extension.customize(notificationData, project, externalProjectPath, error);
}
return notificationData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public void onFailure(@NotNull ExternalSystemTaskId id, @NotNull Exception e) {
String title = ExternalSystemBundle.message("notification.project.refresh.fail.title",
externalSystemId.getReadableName(), projectName);
DataContext dataContext = BuildConsoleUtils.getDataContext(id, syncViewManager);
FailureResult failureResult = createFailureResult(title, e, externalSystemId, project, dataContext);
FailureResult failureResult = createFailureResult(title, e, externalSystemId, project, externalProjectPath, dataContext);
finishSyncEventSupplier.set(() -> new FinishBuildEventImpl(id, null, System.currentTimeMillis(),
BuildBundle.message("build.status.failed"), failureResult));
processHandler.notifyProcessTerminated(1);
Expand Down Expand Up @@ -540,7 +540,7 @@ private void handExecutionResult(@NotNull ExternalSystemTaskActivator externalSy
ExternalSystemTaskId id = resolveProjectTask.getId();
String title = ExternalSystemBundle.message("notification.project.refresh.fail.title",
externalSystemId.getReadableName(), projectName);
FailureResult failureResult = createFailureResult(title, t, externalSystemId, project, DataContext.EMPTY_CONTEXT);
FailureResult failureResult = createFailureResult(title, t, externalSystemId, project, externalProjectPath, DataContext.EMPTY_CONTEXT);
finishSyncEventSupplier.set(() -> new FinishBuildEventImpl(id, null, System.currentTimeMillis(),
BuildBundle.message("build.status.failed"), failureResult));

Expand Down Expand Up @@ -703,10 +703,11 @@ public static void markModuleAsMaven(@NotNull Module module, boolean isMavenModu
@NotNull Throwable exception,
@NotNull ProjectSystemId externalSystemId,
@NotNull Project project,
@NotNull String externalProjectPath,
@NotNull DataContext dataContext) {
ExternalSystemNotificationManager notificationManager = ExternalSystemNotificationManager.getInstance(project);
NotificationData notificationData =
notificationManager.createNotification(title, exception, externalSystemId, project, dataContext);
notificationManager.createNotification(title, exception, externalSystemId, project, externalProjectPath, dataContext);
if (notificationData == null) {
return new FailureResultImpl();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a075b77

Please sign in to comment.