Bug 514806 - p2 installation dialog move Select All and Deselect All
button to the side of the filtered tree


Change-Id: I4d7f13fc747c02d562ccbc4f41997e35736c8a7c
Signed-off-by: David Weiser <david.weiser@vogella.com>
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
index a75fd12..3242115 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
@@ -106,6 +106,7 @@
 
 		Composite aboveSash = new Composite(sashForm, SWT.NONE);
 		GridLayout grid = new GridLayout();
+		grid.numColumns = 2;
 		grid.marginWidth = 0;
 		grid.marginHeight = 0;
 		aboveSash.setLayout(grid);
@@ -140,6 +141,7 @@
 
 		// select buttons
 		createSelectButtons(aboveSash);
+		createSelectionCount(aboveSash);
 
 		// Details area
 		iuDetailsGroup = new IUDetailsGroup(sashForm, availableIUGroup.getStructuredViewer(), SWT.DEFAULT, true);
@@ -184,6 +186,24 @@
 		Dialog.applyDialogFont(composite);
 	}
 
+	private void createSelectionCount(Composite parentComposite) {
+		Composite selectionCountComposite = new Composite(parentComposite, SWT.NONE);
+		GridLayout layout = new GridLayout();
+		layout.marginWidth = 0;
+		layout.verticalSpacing = 10;
+		selectionCountComposite.setLayout(layout);
+		selectionCountComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
+
+		selectionCount = new Label(selectionCountComposite, SWT.NONE);
+		GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+		selectionCount.setLayoutData(data);
+
+		// separator underneath
+		Label sep = new Label(selectionCountComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
+		GridData separatorGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+		sep.setLayoutData(separatorGridData);
+	}
+
 	private Composite createProgressBar(Composite parent) {
 		final Composite progressBarComposite = new Composite(parent, SWT.NONE);
 		Label progressBarLabel = new Label(progressBarComposite, SWT.NONE);
@@ -227,12 +247,14 @@
 	private void createSelectButtons(Composite parent) {
 		Composite buttonParent = new Composite(parent, SWT.NONE);
 		GridLayout gridLayout = new GridLayout();
-		gridLayout.numColumns = 3;
+		gridLayout.numColumns = 1;
+		gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+		gridLayout.marginHeight = 0;
 		gridLayout.marginWidth = 0;
 		gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
 		buttonParent.setLayout(gridLayout);
 
-		GridData data = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+		GridData data = new GridData(SWT.FILL, SWT.DEFAULT, false, false);
 		buttonParent.setLayoutData(data);
 
 		Button selectAll = new Button(buttonParent, SWT.PUSH);
@@ -244,18 +266,6 @@
 		deselectAll.setText(ProvUIMessages.SelectableIUsPage_Deselect_All);
 		setButtonLayoutData(deselectAll);
 		deselectAll.addListener(SWT.Selection, event -> setAllChecked(false));
-
-		// dummy to take extra space
-		selectionCount = new Label(buttonParent, SWT.NONE);
-		data = new GridData(SWT.FILL, SWT.CENTER, true, true);
-		data.horizontalIndent = 20; // breathing room
-		selectionCount.setLayoutData(data);
-
-		// separator underneath
-		Label sep = new Label(buttonParent, SWT.HORIZONTAL | SWT.SEPARATOR);
-		data = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
-		data.horizontalSpan = 3;
-		sep.setLayoutData(data);
 	}
 
 	// The viewer method is deprecated because it only applies to visible items,
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
index d4cbbfb..dd485c4 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
@@ -106,6 +106,7 @@
 		layout.marginTop = 0;
 		layout.marginBottom = IDialogConstants.VERTICAL_SPACING;
 		layout.numColumns = 4;
+		layout.marginWidth = 0;
 		comboComposite.setLayout(layout);
 		GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
 		comboComposite.setLayoutData(gd);