Bug 170385: [correction] Quick Fix autocomplete should remember listbox size
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java
index 7f81993..598d185 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -14,6 +14,8 @@
 
 import org.eclipse.core.commands.IHandler;
 
+import org.eclipse.jface.dialogs.IDialogSettings;
+
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IInformationControlCreator;
 import org.eclipse.jface.text.ITextViewer;
@@ -192,6 +194,30 @@
 	}
 
 	/**
+	 * Tells this assistant to open the proposal popup with the size
+	 * contained in the given dialog settings and to store the control's last valid size in the
+	 * given dialog settings.
+	 * <p>
+	 * Note: This API is only valid if the information control implements
+	 * {@link org.eclipse.jface.text.IInformationControlExtension3}. Not following this restriction
+	 * will later result in an {@link UnsupportedOperationException}.
+	 * </p>
+	 * <p>
+	 * The constants used to store the values are:
+	 * <ul>
+	 * <li>{@link ContentAssistant#STORE_SIZE_X}</li>
+	 * <li>{@link ContentAssistant#STORE_SIZE_Y}</li>
+	 * </ul>
+	 * </p>
+	 *
+	 * @param dialogSettings the dialog settings
+	 * @since 3.7
+	 */
+	public void setRestoreCompletionProposalSize(IDialogSettings dialogSettings) {
+		fQuickAssistAssistantImpl.setRestoreCompletionProposalSize(dialogSettings);
+	}
+	
+	/**
 	 * Callback to signal this quick assist assistant that the presentation of the
 	 * possible completions has been stopped.
 	 */
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
index ae398b7..0360565 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
@@ -400,8 +400,9 @@
 		if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
 			return null;
 
-		IQuickAssistAssistant assistant= new QuickAssistAssistant();
+		QuickAssistAssistant assistant= new QuickAssistAssistant();
 		assistant.setQuickAssistProcessor(new SpellingCorrectionProcessor());
+		assistant.setRestoreCompletionProposalSize(EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); //$NON-NLS-1$
 		assistant.setInformationControlCreator(getQuickAssistAssistantInformationControlCreator());
 
 		return assistant;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java
index 5362bdb..8057494 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -18,6 +18,7 @@
 import org.eclipse.core.runtime.MultiStatus;
 import org.eclipse.core.runtime.Status;
 
+import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
 
@@ -281,4 +282,20 @@
 		return TextEditorMessages.EditorsPlugin_additionalInfo_affordance;
 	}
 
+	/**
+	 * Returns a section in the ui.editors plugin's dialog settings. If the section doesn't exist yet, it is created.
+	 *
+	 * @param name the name of the section
+	 * @return the section of the given name
+	 * @since 3.7
+	 */
+	public IDialogSettings getDialogSettingsSection(String name) {
+		IDialogSettings dialogSettings= getDialogSettings();
+		IDialogSettings section= dialogSettings.getSection(name);
+		if (section == null) {
+			section= dialogSettings.addNewSection(name);
+		}
+		return section;
+	}
+
 }