void () { MavenAddArchetypeDialog dialog = new MavenAddArchetypeDialog(myMainPanel); if (!dialog.showAndGet()) { return; } MavenArchetype archetype = dialog.getArchetype(); ApplicationManager.getApplication().executeOnPooledThread(() -> { MavenIndicesManager.addArchetype(archetype); ApplicationManager.getApplication().invokeLater(() -> updateArchetypesList(archetype)); }); }