Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2018-05-23 07:37:57 -0400
committerMatthias Sohn2018-06-04 17:52:18 -0400
commitfc34792f8068b7785181cd84236247589864399b (patch)
tree78f12a0455806a174a0057d427344df97ee811fb /org.eclipse.egit.ui/src/org/eclipse/egit/ui
parentd3b1c746f2bd1dce22cbc2c7d8f33237a3dc2b4e (diff)
downloadegit-fc34792f8068b7785181cd84236247589864399b.tar.gz
egit-fc34792f8068b7785181cd84236247589864399b.tar.xz
egit-fc34792f8068b7785181cd84236247589864399b.zip
Refactor class to contain its private methods
The static comparator class has some private methods, which were declared in the top level utility class instead. Move them into the static comparator class to make it self-contained. Change-Id: Id814aeb2d0e9d15c928953b6602843c7ab481925 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CommonUtils.java52
1 files changed, 27 insertions, 25 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CommonUtils.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CommonUtils.java
index 0d93e75ef..759264e72 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CommonUtils.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CommonUtils.java
@@ -105,6 +105,32 @@ public class CommonUtils {
return o1.compareTo(o2);
}
}
+
+ private LinkedList<String> splitIntoDigitAndNonDigitParts(
+ String input) {
+ LinkedList<String> parts = new LinkedList<>();
+ int partStart = 0;
+ boolean previousWasDigit = Character.isDigit(input.charAt(0));
+ for (int i = 1; i < input.length(); i++) {
+ boolean isDigit = Character.isDigit(input.charAt(i));
+ if (isDigit != previousWasDigit) {
+ parts.add(input.substring(partStart, i));
+ partStart = i;
+ previousWasDigit = isDigit;
+ }
+ }
+ parts.add(input.substring(partStart));
+ return parts;
+ }
+
+ private String stripLeadingZeros(String input) {
+ for (int i = 0; i < input.length(); i++) {
+ if (input.charAt(i) != '0') {
+ return input.substring(i);
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
};
/**
@@ -143,7 +169,7 @@ public class CommonUtils {
};
/**
- * Programatically run command based on it id and given selection
+ * Programmatically run command based on its id and given selection
*
* @param commandId
* id of command that should be run
@@ -203,30 +229,6 @@ public class CommonUtils {
return (T) service;
}
- private static LinkedList<String> splitIntoDigitAndNonDigitParts(
- String input) {
- LinkedList<String> parts = new LinkedList<>();
- int partStart = 0;
- boolean previousWasDigit = Character.isDigit(input.charAt(0));
- for (int i = 1; i < input.length(); i++) {
- boolean isDigit = Character.isDigit(input.charAt(i));
- if (isDigit != previousWasDigit) {
- parts.add(input.substring(partStart, i));
- partStart = i;
- previousWasDigit = isDigit;
- }
- }
- parts.add(input.substring(partStart));
- return parts;
- }
-
- private static String stripLeadingZeros(String input) {
- for (int i = 0; i < input.length(); i++)
- if (input.charAt(i) != '0')
- return input.substring(i);
- return ""; //$NON-NLS-1$
- }
-
/**
* Assuming that the string {@code commitMessage} is a commit message,
* returns the offset in the string of the footer of the commit message, if

Back to the top