From 8edc81a2bb6d7f7c942dbd797b574df8ec73cc6a Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 11 Oct 2012 13:48:25 +0400 Subject: [PATCH] [git] notnull, reformat --- .../commands/GitMessageWithFilesDetector.java | 70 ++++++++++--------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/plugins/git4idea/src/git4idea/commands/GitMessageWithFilesDetector.java b/plugins/git4idea/src/git4idea/commands/GitMessageWithFilesDetector.java index a3c8910ab94b..11d60848a4bc 100644 --- a/plugins/git4idea/src/git4idea/commands/GitMessageWithFilesDetector.java +++ b/plugins/git4idea/src/git4idea/commands/GitMessageWithFilesDetector.java @@ -39,53 +39,25 @@ public class GitMessageWithFilesDetector implements GitLineHandlerListener { private final Event myEvent; private final VirtualFile myRoot; - public enum Event { - LOCAL_CHANGES_OVERWRITTEN_BY_MERGE( - "Your local changes to the following files would be overwritten by merge", - "commit your changes or stash them before"), - LOCAL_CHANGES_OVERWRITTEN_BY_CHECKOUT( - "Your local changes to the following files would be overwritten by checkout", - "commit your changes or stash them before"), - UNTRACKED_FILES_OVERWRITTEN_BY( - "The following untracked working tree files would be overwritten by", - "Please move or remove them before" - ) - ; - - private final String myMessageStartMarker; - private final String myMessageEndMarker; - - Event(String messageStartMarker, String messageEndMarker) { - myMessageStartMarker = messageStartMarker; - myMessageEndMarker = messageEndMarker; - } - - public String getMessageStartMarker() { - return myMessageStartMarker; - } - - public String getMessageEndMarker() { - return myMessageEndMarker; - } - } - private final Set myAffectedFiles = new HashSet(); private boolean myMessageDetected; private boolean myFilesAreDisplayed; - public GitMessageWithFilesDetector(Event event, VirtualFile root) { + public GitMessageWithFilesDetector(@NotNull Event event, @NotNull VirtualFile root) { myEvent = event; myRoot = root; } @Override - public void onLineAvailable(String line, Key outputType) { + public void onLineAvailable(@NotNull String line, @NotNull Key outputType) { if (line.contains(myEvent.getMessageStartMarker())) { myMessageDetected = true; myFilesAreDisplayed = true; - } else if (line.contains(myEvent.getMessageEndMarker())) { + } + else if (line.contains(myEvent.getMessageEndMarker())) { myFilesAreDisplayed = false; - } else if (myFilesAreDisplayed) { + } + else if (myFilesAreDisplayed) { myAffectedFiles.add(line.trim()); } } @@ -125,4 +97,34 @@ public class GitMessageWithFilesDetector implements GitLineHandlerListener { return files; } + public enum Event { + LOCAL_CHANGES_OVERWRITTEN_BY_MERGE( + "Your local changes to the following files would be overwritten by merge", + "commit your changes or stash them before"), + LOCAL_CHANGES_OVERWRITTEN_BY_CHECKOUT( + "Your local changes to the following files would be overwritten by checkout", + "commit your changes or stash them before"), + UNTRACKED_FILES_OVERWRITTEN_BY( + "The following untracked working tree files would be overwritten by", + "Please move or remove them before" + ) + ; + + private final String myMessageStartMarker; + private final String myMessageEndMarker; + + Event(String messageStartMarker, String messageEndMarker) { + myMessageStartMarker = messageStartMarker; + myMessageEndMarker = messageEndMarker; + } + + public String getMessageStartMarker() { + return myMessageStartMarker; + } + + public String getMessageEndMarker() { + return myMessageEndMarker; + } + } + }