summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Parker2013-01-07 18:43:39 (EST)
committer Gerrit Code Review @ Eclipse.org2013-01-31 14:45:12 (EST)
commit24d29243465ff0611b1aa888912dffbf9b113b86 (patch)
tree24e1f856760185981c1ceca8d78b459783f68330
parent47cfb690ed76daebc12bd016a3e149bbddd2fa3c (diff)
downloadorg.eclipse.mylyn.reviews-24d29243465ff0611b1aa888912dffbf9b113b86.zip
org.eclipse.mylyn.reviews-24d29243465ff0611b1aa888912dffbf9b113b86.tar.gz
org.eclipse.mylyn.reviews-24d29243465ff0611b1aa888912dffbf9b113b86.tar.bz2
396006: [ui] Limit size of patch set displayrefs/changes/12/9512/2
Change-Id: Ide0611056c1e59794959eec29f04ed9bbe88726b Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=396006
-rw-r--r--org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java
index defd064..a358ac8 100644
--- a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java
+++ b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java
@@ -114,6 +114,8 @@ import com.google.gerrit.reviewdb.PatchSet;
*/
public class PatchSetSection extends AbstractGerritSection {
+ private static final int MAXIMUM_ITEMS_SHOWN = 30;
+
private class CompareAction extends Action {
private final PatchSet base;
@@ -588,8 +590,16 @@ public class PatchSetSection extends AbstractGerritSection {
Text refText = new Text(composite, SWT.READ_ONLY);
refText.setText(patchSetDetail.getPatchSet().getRefName());
- final TableViewer viewer = new TableViewer(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.VIRTUAL);
- GridDataFactory.fillDefaults().span(2, 1).grab(true, true).hint(500, SWT.DEFAULT).applyTo(viewer.getControl());
+ boolean fixedViewerSize = patchSetDetail.getPatches().size() > MAXIMUM_ITEMS_SHOWN;
+ int heightHint = fixedViewerSize ? 300 : SWT.DEFAULT;
+ int style = SWT.SINGLE | SWT.BORDER | SWT.VIRTUAL;
+ if (fixedViewerSize) {
+ style |= SWT.V_SCROLL;
+ } else {
+ style |= SWT.NO_SCROLL;
+ }
+ final TableViewer viewer = new TableViewer(composite, style);
+ GridDataFactory.fillDefaults().span(2, 1).grab(true, true).hint(500, heightHint).applyTo(viewer.getControl());
viewer.setContentProvider(new IStructuredContentProvider() {
private EContentAdapter modelAdapter;