Bug 538594 - [Content assist] Default size is too small

This change makes proposal window more suitable for displaying long API
names. Minimum height increased from 10 to 15 elements (width is
depending on that as before, so it is increased accordingly).

Both dimensions will be checked to be not bigger than 1/4 of the
appropriate dimension of the current monitor.

Change-Id: I7a00aecc6eafe70d24d00dcec691198a11aefd97
Signed-off-by: Mykola Zakharchuk <zakharchuk.vn@gmail.com>
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/org.eclipse.jface.text/META-INF/MANIFEST.MF b/org.eclipse.jface.text/META-INF/MANIFEST.MF
index 50aad03..e58985b 100644
--- a/org.eclipse.jface.text/META-INF/MANIFEST.MF
+++ b/org.eclipse.jface.text/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jface.text
-Bundle-Version: 3.15.0.qualifier
+Bundle-Version: 3.15.100.qualifier
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Export-Package: 
diff --git a/org.eclipse.jface.text/pom.xml b/org.eclipse.jface.text/pom.xml
index 60b2b67..511c081 100644
--- a/org.eclipse.jface.text/pom.xml
+++ b/org.eclipse.jface.text/pom.xml
@@ -18,6 +18,6 @@
   </parent>
   <groupId>org.eclipse.jface</groupId>
   <artifactId>org.eclipse.jface.text</artifactId>
-  <version>3.15.0-SNAPSHOT</version>
+  <version>3.15.100-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
index c60a3ec..94ce3d8 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
@@ -57,6 +57,7 @@
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Monitor;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableItem;
@@ -81,6 +82,7 @@
 import org.eclipse.jface.resource.JFaceColors;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.util.Geometry;
+import org.eclipse.jface.util.Util;
 import org.eclipse.jface.viewers.StyledString;
 
 import org.eclipse.jface.text.AbstractInformationControlManager;
@@ -637,10 +639,17 @@
 			fProposalTable.setLayoutData(data);
 			fProposalShell.setSize(size);
 		} else {
-			int height= fProposalTable.getItemHeight() * 10;
+			int height= fProposalTable.getItemHeight() * 15;
 			// use golden ratio as default aspect ratio
 			final double aspectRatio= (1 + Math.sqrt(5)) / 2;
 			int width= (int) (height * aspectRatio);
+
+			// Make sure our bounds still fit to the screen
+			Monitor monitor= Util.getClosestMonitor(fProposalShell.getDisplay(), getLocation());
+			Rectangle bounds= monitor.getClientArea();
+			width= Math.min(width, bounds.width / 4);
+			height= Math.min(height, bounds.height / 4);
+
 			Rectangle trim= fProposalTable.computeTrim(0, 0, width, height);
 			data.heightHint= trim.height;
 			data.widthHint= trim.width;
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
index 2e3ed84..f4c66bf 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
@@ -2399,8 +2399,8 @@
 			}
 
 			// Enforce an absolute minimal size
-			size.x= Math.max(size.x, 30);
-			size.y= Math.max(size.y, 30);
+			size.x= Math.max(size.x, 50);
+			size.y= Math.max(size.y, 50);
 		}
 
 		return size;