aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2018-06-30 15:17:29 -0400
committerGerrit Code Review @ Eclipse.org2018-06-30 15:17:29 -0400
commitc6ad7e0920c436560faaa00c972ce6d9a0816293 (patch)
treecd0a1dae4ba2da49b79948d133cf1fad0b77bd57
parent15f528ae779f70aeac130568258fed0221979e87 (diff)
parent4b5392f48ea79268f56f89d7f08b0bff513cb927 (diff)
downloadegit-c6ad7e0920c436560faaa00c972ce6d9a0816293.tar.gz
egit-c6ad7e0920c436560faaa00c972ce6d9a0816293.tar.xz
egit-c6ad7e0920c436560faaa00c972ce6d9a0816293.zip
Merge "Fix history preference page field editor layout"
-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: