From e04efa5d8e425d9c03d1895a424f40c99a7fe5d2 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Mon, 26 Jun 2017 16:37:46 +0300 Subject: [PATCH] Disable "Compare Subversion Properties" action if project is null IDEA-128112 --- .../idea/svn/actions/ShowPropertiesDiffAction.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShowPropertiesDiffAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShowPropertiesDiffAction.java index 8e74634314eb..be8f50f64e1f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShowPropertiesDiffAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShowPropertiesDiffAction.java @@ -59,6 +59,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import static com.intellij.openapi.actionSystem.CommonDataKeys.PROJECT; import static com.intellij.util.ObjectUtils.notNull; import static com.intellij.util.containers.ContainerUtil.exists; @@ -66,11 +67,10 @@ public class ShowPropertiesDiffAction extends AnAction implements DumbAware { @Override public void update(@NotNull AnActionEvent e) { - Change[] changes = e.getData(VcsDataKeys.CHANGES); - boolean showAction = checkThatChangesAreUnderSvn(changes); + boolean isVisible = checkThatChangesAreUnderSvn(e.getData(VcsDataKeys.CHANGES)); - e.getPresentation().setVisible(changes != null && showAction); - e.getPresentation().setEnabled(showAction); + e.getPresentation().setVisible(isVisible); + e.getPresentation().setEnabled(isVisible && e.getProject() != null); } private static boolean checkThatChangesAreUnderSvn(@Nullable Change[] changes) { @@ -86,7 +86,7 @@ public class ShowPropertiesDiffAction extends AnAction implements DumbAware { Change[] changes = e.getData(VcsDataKeys.CHANGE_LEAD_SELECTION); if (checkThatChangesAreUnderSvn(changes)) { - new CalculateAndShow(e.getProject(), changes[0], e.getPresentation().getText()).queue(); + new CalculateAndShow(e.getRequiredData(PROJECT), changes[0], e.getPresentation().getText()).queue(); } } @@ -99,7 +99,7 @@ public class ShowPropertiesDiffAction extends AnAction implements DumbAware { private Exception myException; private final String myErrorTitle; - private CalculateAndShow(@Nullable final Project project, final Change change, final String errorTitle) { + private CalculateAndShow(@NotNull Project project, final Change change, final String errorTitle) { super(project, SvnBundle.message("fetching.properties.contents.progress.title"), true, PerformInBackgroundOption.DEAF); myChange = change; myErrorTitle = errorTitle;