From ed65c9653939498db059da19a350bc1a79d76696 Mon Sep 17 00:00:00 2001 From: irengrig Date: Mon, 30 Nov 2009 15:03:08 +0300 Subject: [PATCH] IDEA-26317 (NPE from projectlevelman.NewMappings.cleanupMappings on running duplicates) --- .../openapi/vcs/changes/ui/ChangesViewBalloonProblemNotifier.java | 5 ++++- .../com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewBalloonProblemNotifier.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewBalloonProblemNotifier.java index d7274baacb..39163c316d 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewBalloonProblemNotifier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewBalloonProblemNotifier.java @@ -15,6 +15,7 @@ */ package com.intellij.openapi.vcs.changes.ui; +import com.intellij.openapi.application.Application; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.ui.MessageType; @@ -44,12 +45,14 @@ public class ChangesViewBalloonProblemNotifier implements Runnable { } public static void showMe(final Project project, final String message, final MessageType type) { + final Application application = ApplicationManager.getApplication(); + if (application.isHeadlessEnvironment()) return; final Runnable showErrorAction = new Runnable() { public void run() { new ChangesViewBalloonProblemNotifier(project, message, type).run(); } }; - if (ApplicationManager.getApplication().isDispatchThread()) { + if (application.isDispatchThread()) { showErrorAction.run(); } else { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java index d41b2e17ce..ee68995885 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java @@ -17,11 +17,13 @@ package com.intellij.openapi.vcs.impl.projectlevelman; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.*; +import com.intellij.openapi.vcs.changes.ui.ChangesViewBalloonProblemNotifier; import com.intellij.openapi.vcs.impl.DefaultVcsRootPolicy; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; @@ -394,6 +396,10 @@ public class NewMappings { filteredFiles = AbstractVcs.filterUniqueRootsDefault(objects, fileConvertor); } else { final AbstractVcs vcs = allVcses.getByName(vcsName); + if (vcs == null) { + ChangesViewBalloonProblemNotifier.showMe(myProject, "VCS plugin not found for mapping to : '" + vcsName + "'", MessageType.ERROR); + continue; + } filteredFiles = vcs.filterUniqueRoots(objects, fileConvertor); } -- 2.11.4.GIT