From 39efcb5ab07b5dad3af0f8e8e86956dcd0df6cf1 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Sat, 23 Mar 2013 18:36:51 +0400 Subject: [PATCH] [git] DRY (define constants), protect against NPE (flip equals) --- plugins/git4idea/src/git4idea/GitVcs.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/git4idea/src/git4idea/GitVcs.java b/plugins/git4idea/src/git4idea/GitVcs.java index 29a604029ed3..d848a15c197a 100644 --- a/plugins/git4idea/src/git4idea/GitVcs.java +++ b/plugins/git4idea/src/git4idea/GitVcs.java @@ -460,17 +460,19 @@ public class GitVcs extends AbstractVcs { myVersion = GitVersion.identifyVersion(executable); if (! myVersion.isSupported()) { log.info("Unsupported Git version: " + myVersion); - String message = String.format("The configured version of Git is not supported: %s.
" + - "The minimal supported version is %s. Please update.", + final String SETTINGS_LINK = "settings"; + final String UPDATE_LINK = "update"; + String message = String.format("The configured version of Git is not supported: %s.
" + + "The minimal supported version is %s. Please update.", myVersion, GitVersion.MIN); IMPORTANT_ERROR_NOTIFICATION.createNotification("Unsupported Git version", message, NotificationType.ERROR, new NotificationListener.Adapter() { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) { - if (e.getDescription().equals("settings")) { + if (SETTINGS_LINK.equals(e.getDescription())) { ShowSettingsUtil.getInstance().showSettingsDialog(myProject, getConfigurable().getDisplayName()); } - else if (e.getDescription().equals("update")) { + else if (UPDATE_LINK.equals(e.getDescription())) { BrowserUtil.browse("http://git-scm.com"); } }