Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2018-06-27 13:17:16 -0400
committerMichael Keppler2018-06-30 13:36:55 -0400
commit4b5392f48ea79268f56f89d7f08b0bff513cb927 (patch)
tree5ef8e7e41ba64c8340bcd6eb8bb32fb2c0621ffc /org.eclipse.egit.ui/src/org
parenteaea49ca97365415d516073901c2335c84513149 (diff)
downloadegit-4b5392f48ea79268f56f89d7f08b0bff513cb927.tar.gz
egit-4b5392f48ea79268f56f89d7f08b0bff513cb927.tar.xz
egit-4b5392f48ea79268f56f89d7f08b0bff513cb927.zip
Fix history preference page field editor layout
BooleanFieldEditors manipulate the GridLayout of their composite parent to have only one column. Therefore avoid BooleanFieldEditors as last field editor, if some of the other field editors need more than one column. Also improve the option label for shortening long branch and tag names. See screenshots in bugzilla. Change-Id: I1cc6656da65467081ea33327fdb8d683cb37b3a6 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de> Bug:536357
Diffstat (limited to 'org.eclipse.egit.ui/src/org')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/HistoryPreferencePage.java18
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties2
2 files changed, 13 insertions, 7 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/HistoryPreferencePage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/HistoryPreferencePage.java
index 730d0a201..8c0399645 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/HistoryPreferencePage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/HistoryPreferencePage.java
@@ -16,6 +16,7 @@ import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.IntegerFieldEditor;
@@ -84,6 +85,8 @@ public class HistoryPreferencePage extends FieldEditorPreferencePage implements
UIPreferences.RESOURCEHISTORY_SHOW_EMAIL_ADDRESSES,
UIText.HistoryPreferencePage_toggleEmailAddresses,
showGroup));
+ addField(new BooleanFieldEditor(UIPreferences.HISTORY_CUT_AT_START,
+ UIText.HistoryPreferencePage_toggleShortenAtStart, showGroup));
addField(new IntegerFieldEditor(UIPreferences.HISTORY_MAX_NUM_COMMITS,
UIText.ResourceHistory_MaxNumCommitsInList,
showGroup));
@@ -96,10 +99,8 @@ public class HistoryPreferencePage extends FieldEditorPreferencePage implements
showGroup));
addField(new IntegerFieldEditor(UIPreferences.HISTORY_MAX_DIFF_LINES,
UIText.HistoryPreferencePage_MaxDiffLines, showGroup));
-
- addField(new BooleanFieldEditor(UIPreferences.HISTORY_CUT_AT_START,
- UIText.HistoryPreferencePage_toggleShortenAtStart, showGroup));
updateMargins(showGroup);
+
Group commentGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
// we need a span of 2 to accommodate the field editors
GridDataFactory.fillDefaults().grab(true, false).span(2, 1)
@@ -120,12 +121,17 @@ public class HistoryPreferencePage extends FieldEditorPreferencePage implements
UIText.ResourceHistory_toggleCommentFill,
commentGroup));
updateMargins(commentGroup);
- adjustGridLayout();
}
+ /**
+ * {@link FieldEditor} sets the margin of its parent to zero in its
+ * <code>createControl(Composite)</code> method. Therefore fix the group
+ * margin only after adding the field editors.
+ *
+ * @param group
+ * group control
+ */
private void updateMargins(Group group) {
- // make sure there is some room between the group border
- // and the controls in the group
GridLayout layout = (GridLayout) group.getLayout();
layout.marginWidth = 5;
layout.marginHeight = 5;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
index d51eb3da6..a562e84fe 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
@@ -722,7 +722,7 @@ HistoryPage_findbar_reference=Branch/Tag
HistoryPreferencePage_toggleAllBranches=All &Branches and Tags
HistoryPreferencePage_toggleAdditionalRefs=&Additional Refs
HistoryPreferencePage_toggleEmailAddresses=&E-mail addresses in Author/Committer columns
-HistoryPreferencePage_toggleShortenAtStart=&Shorten long tag and branch names at start
+HistoryPreferencePage_toggleShortenAtStart=&Shorten long tag and branch names at the front
HistoryPreferencePage_MaxBranchLength=Maximum characters to show for a &branch:
HistoryPreferencePage_MaxDiffLines=Maximum lines to show for a &diff:
HistoryPreferencePage_MaxTagLength=&Maximum characters to show for a tag:

Back to the top