diff options
Diffstat (limited to 'org.eclipse.jface.text/src/org')
2 files changed, 12 insertions, 3 deletions
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 c60a3ec6f16..94ce3d8b8b4 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.Display; 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.preference.JFacePreferences; 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 @@ class CompletionProposalPopup implements IContentAssistListener { 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 2e3ed84a799..f4c66bf62c2 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 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt } // 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; |