Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose externalProjectPath on ExternalSystemNotificationExtension.customize() #2427

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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 @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
}
Expand Down Expand Up @@ -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();
}
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