Skip to content

Commit 4250faa

Browse files
authored
Merge pull request #2499 from vitaliyboykocontributor/2491-show-message-that-indexing-in-process
2491: Prevent URN map generation during indexing.
2 parents dc30b4a + 14456ab commit 4250faa

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
1111
- Compatibility with PhpStorm/IntelliJ 2025.* [#2495](https://github.com/magento/magento2-phpstorm-plugin/pull/2495)
1212
- "Copy Path/Reference" does not show the preview value [#2497](https://github.com/magento/magento2-phpstorm-plugin/pull/2497)
1313
- Must not start write action from within read action in the other thread [#2498](https://github.com/magento/magento2-phpstorm-plugin/pull/2498)
14+
- URN map generation during indexing [#2499](https://github.com/magento/magento2-phpstorm-plugin/pull/2499)
1415

1516
## 2025.0.0
1617

src/main/java/com/magento/idea/magento2plugin/project/RegenerateUrnMapListener.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.intellij.notification.NotificationGroupManager;
1111
import com.intellij.notification.NotificationType;
1212
import com.intellij.openapi.application.ApplicationManager;
13+
import com.intellij.openapi.project.DumbService;
1314
import com.intellij.openapi.project.Project;
1415
import com.intellij.openapi.vfs.VirtualFile;
1516
import com.intellij.psi.PsiDirectory;
@@ -46,17 +47,31 @@ public RegenerateUrnMapListener(final @NotNull Project project) {
4647
* @param event MouseEvent
4748
*/
4849
@Override
50+
@SuppressWarnings("PMD.UseNotifyAllInsteadOfNotify")
4951
public void mouseClicked(final MouseEvent event) {
50-
final ExternalResourceManager manager =
51-
ExternalResourceManager.getInstance();
52-
final PsiManager psiManager = PsiManager.getInstance(project);
53-
final MagentoComponentManager componentManager =
54-
MagentoComponentManager.getInstance(project);
52+
if (DumbService.getInstance(project).isDumb()) {
53+
NotificationGroupManager.getInstance()
54+
.getNotificationGroup("Magento Notifications")
55+
.createNotification(
56+
"URN map generation unavailable",
57+
"Indexing is in progress."
58+
+ " Please wait for it to complete"
59+
+ " before running URN mapping generation.",
60+
NotificationType.WARNING
61+
)
62+
.notify(project);
63+
return;
64+
}
5565

5666
ApplicationManager.getApplication().runWriteAction(
5767
new Runnable() {
5868
@Override
5969
public void run() {
70+
final PsiManager psiManager = PsiManager.getInstance(project);
71+
final MagentoComponentManager componentManager =
72+
MagentoComponentManager.getInstance(project);
73+
final ExternalResourceManager manager =
74+
ExternalResourceManager.getInstance();
6075
final Collection<VirtualFile> xsdFiles
6176
= FilenameIndex.getAllFilesByExt(project, "xsd");
6277
final Collection<MagentoComponent> components

0 commit comments

Comments
 (0)