Skip to content

Refresh file presentation after sync - #8407

Merged
LeFrosch merged 2 commits into
bazelbuild:masterfrom
LeFrosch:pull/fd7849e7c9d7e624bd202cd32218377969bff982
Jul 23, 2026
Merged

Refresh file presentation after sync#8407
LeFrosch merged 2 commits into
bazelbuild:masterfrom
LeFrosch:pull/fd7849e7c9d7e624bd202cd32218377969bff982

Conversation

@LeFrosch

@LeFrosch LeFrosch commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

To avoid stile file representations i.e., the sync status, the file status has to be refreshed after every sync.

Addresses: https://youtrack.jetbrains.com/issue/CPP-45375

To avoid stile file representations i.e., the sync status, the file status has to be refreshed after every sync.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helper method refreshSyncStatusIndicators in ProjectTargetManagerImpl.java to refresh the project view and update the file presentation of all open files during build start and after sync. The reviewer pointed out a potential threading issue, as these UI-related operations might be executed on background threads, and suggested wrapping them in ApplicationManager.getApplication().invokeLater while checking if the project is disposed.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +172 to +175
final var fileEditorManager = FileEditorManager.getInstance(project);
for (final var file : fileEditorManager.getOpenFiles()) {
fileEditorManager.updateFilePresentation(file);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Updating file presentation and querying open files are UI-related operations. Since refreshSyncStatusIndicators can be called from background threads (e.g., during buildStarted or afterSync), executing these operations directly on the calling thread can lead to CalledInWrongThreadException or threading issues.

It is safer to wrap these operations in ApplicationManager.getApplication().invokeLater(...) and ensure the project is not disposed before executing.

      com.intellij.openapi.application.ApplicationManager.getApplication().invokeLater(() -> {
        if (project.isDisposed()) {
          return;
        }
        final var fileEditorManager = FileEditorManager.getInstance(project);
        for (final var file : fileEditorManager.getOpenFiles()) {
          fileEditorManager.updateFilePresentation(file);
        }
      });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is a correct finding

@LeFrosch
LeFrosch marked this pull request as ready for review July 17, 2026 08:35
@LeFrosch
LeFrosch requested review from mai93 and ujohnny as code owners July 17, 2026 08:35
@github-actions github-actions Bot added product: CLion CLion plugin product: IntelliJ IntelliJ plugin product: GoLand GoLand plugin awaiting-review Awaiting review from Bazel team on PRs labels Jul 17, 2026
Comment on lines +172 to +175
final var fileEditorManager = FileEditorManager.getInstance(project);
for (final var file : fileEditorManager.getOpenFiles()) {
fileEditorManager.updateFilePresentation(file);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is a correct finding

@LeFrosch
LeFrosch merged commit 1180605 into bazelbuild:master Jul 23, 2026
4 checks passed
@LeFrosch
LeFrosch deleted the pull/fd7849e7c9d7e624bd202cd32218377969bff982 branch July 23, 2026 08:17
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in Bazel IntelliJ Plugin Jul 23, 2026
@github-actions github-actions Bot removed the awaiting-review Awaiting review from Bazel team on PRs label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: CLion CLion plugin product: GoLand GoLand plugin product: IntelliJ IntelliJ plugin

Projects

Development

Successfully merging this pull request may close these issues.

2 participants