|
10 | 10 | import com.intellij.notification.NotificationGroupManager;
|
11 | 11 | import com.intellij.notification.NotificationType;
|
12 | 12 | import com.intellij.openapi.application.ApplicationManager;
|
| 13 | +import com.intellij.openapi.project.DumbService; |
13 | 14 | import com.intellij.openapi.project.Project;
|
14 | 15 | import com.intellij.openapi.vfs.VirtualFile;
|
15 | 16 | import com.intellij.psi.PsiDirectory;
|
@@ -46,17 +47,31 @@ public RegenerateUrnMapListener(final @NotNull Project project) {
|
46 | 47 | * @param event MouseEvent
|
47 | 48 | */
|
48 | 49 | @Override
|
| 50 | + @SuppressWarnings("PMD.UseNotifyAllInsteadOfNotify") |
49 | 51 | 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 | + } |
55 | 65 |
|
56 | 66 | ApplicationManager.getApplication().runWriteAction(
|
57 | 67 | new Runnable() {
|
58 | 68 | @Override
|
59 | 69 | 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(); |
60 | 75 | final Collection<VirtualFile> xsdFiles
|
61 | 76 | = FilenameIndex.getAllFilesByExt(project, "xsd");
|
62 | 77 | final Collection<MagentoComponent> components
|
|
0 commit comments