Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2014-02-14 14:58:21 +0000
committerMatthias Sohn2014-02-16 21:12:14 +0000
commit266c2790091598e93324b88e1d530c6a0c127d00 (patch)
treee8cf311818df88cdf95d99d61abd9099fdcfc445
parenta04f8f83df45661037cb7976148ed4e5d3a4a01a (diff)
downloadegit-266c2790091598e93324b88e1d530c6a0c127d00.tar.gz
egit-266c2790091598e93324b88e1d530c6a0c127d00.tar.xz
egit-266c2790091598e93324b88e1d530c6a0c127d00.zip
[historyView] Ref shortening with "..." can be longer than original
Also count the "..." for the max ref length. To compensate for shortening more than before, increase the default max length to 18. Before: "origin/stable-3..." After: "origin/stable-3.3" Bug: 428201 Change-Id: I5a79b98902268f445355aa60f7747f0d448bd259 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java11
2 files changed, 9 insertions, 6 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java
index 8867d09f1a..a1270344e5 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java
@@ -105,8 +105,8 @@ public class PluginPreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(UIPreferences.CLONE_WIZARD_STORE_SECURESTORE, false);
store.setDefault(UIPreferences.COMMIT_DIALOG_HISTORY_SIZE, 10);
store.setDefault(UIPreferences.CHECKOUT_PROJECT_RESTORE, true);
- store.setDefault(UIPreferences.HISTORY_MAX_TAG_LENGTH, 15);
- store.setDefault(UIPreferences.HISTORY_MAX_BRANCH_LENGTH, 15);
+ store.setDefault(UIPreferences.HISTORY_MAX_TAG_LENGTH, 18);
+ store.setDefault(UIPreferences.HISTORY_MAX_BRANCH_LENGTH, 18);
store.setDefault(UIPreferences.CLONE_WIZARD_SHOW_DETAILED_FAILURE_DIALOG, true);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java
index 5d3a41d089..42c67e5ea5 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTPlotRenderer.java
@@ -54,7 +54,7 @@ class SWTPlotRenderer extends AbstractPlotRenderer<SWTLane, Color> {
private static final RGB INNER_OTHER = new RGB(250, 250, 250);
- private static final int MAX_LABEL_LENGTH = 15;
+ private static final int MAX_LABEL_LENGTH = 18;
private static final String ELLIPSIS = "\u2026"; // ellipsis "..." (in UTF-8) //$NON-NLS-1$
@@ -213,12 +213,15 @@ class SWTPlotRenderer extends AbstractPlotRenderer<SWTLane, Color> {
.getInt(UIPreferences.HISTORY_MAX_BRANCH_LENGTH);
else
maxLength = MAX_LABEL_LENGTH;
- if (txt.length() > maxLength)
+ if (txt.length() > maxLength) {
+ // Account for the ellipsis length
+ int textLength = maxLength - 3;
if (Activator.getDefault().getPreferenceStore()
.getBoolean(UIPreferences.HISTORY_CUT_AT_START))
- txt = ELLIPSIS + txt.substring(txt.length() - maxLength);
+ txt = ELLIPSIS + txt.substring(txt.length() - textLength);
else
- txt = txt.substring(0, maxLength) + ELLIPSIS;
+ txt = txt.substring(0, textLength) + ELLIPSIS;
+ }
// highlight checked out branch
Font oldFont = g.getFont();

Back to the top