aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-04-27 14:38:22 (EDT)
committersefftinge2009-04-27 14:38:22 (EDT)
commit4b984c5a3975818cf0d04c188fbdffd1865ec240 (patch)
tree30d9ff02e65f4fe2decfd18bc311aac2bd48de3e
parent4650eb66f86ac86be7c66dbd4813b2cb5ac445c6 (diff)
downloadorg.eclipse.xtext-4b984c5a3975818cf0d04c188fbdffd1865ec240.zip
org.eclipse.xtext-4b984c5a3975818cf0d04c188fbdffd1865ec240.tar.gz
org.eclipse.xtext-4b984c5a3975818cf0d04c188fbdffd1865ec240.tar.bz2
Feature: ContentAssistant restores previously stored layout
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/DefaultContentAssistantFactory.java18
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/service/UIPluginModule.java2
2 files changed, 20 insertions, 0 deletions
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/DefaultContentAssistantFactory.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/DefaultContentAssistantFactory.java
index c8db99b..63bd731 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/DefaultContentAssistantFactory.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/DefaultContentAssistantFactory.java
@@ -7,6 +7,7 @@
*******************************************************************************/
package org.eclipse.xtext.ui.common.editor.contentassist;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
@@ -25,6 +26,9 @@ public class DefaultContentAssistantFactory implements IContentAssistantFactory
@Inject(optional = true)
private IContentAssistProcessor contentAssistProcessor;
+ @Inject(optional=true)
+ private IDialogSettings dialogSettings;
+
public IContentAssistant createConfiguredAssistant(SourceViewerConfiguration configuration,
ISourceViewer sourceViewer) {
ContentAssistant assistant = createAssistant();
@@ -50,6 +54,12 @@ public class DefaultContentAssistantFactory implements IContentAssistantFactory
setAutoInsert(assistant);
setContentAssistProcessor(assistant);
setInformationControlCreator(assistant, configuration, sourceViewer);
+ setDialogSettings(assistant);
+ }
+
+ private void setDialogSettings(ContentAssistant assistant) {
+ if (dialogSettings != null)
+ assistant.setRestoreCompletionProposalSize(dialogSettings);
}
private void setInformationControlCreator(ContentAssistant assistant, SourceViewerConfiguration configuration,
@@ -67,4 +77,12 @@ public class DefaultContentAssistantFactory implements IContentAssistantFactory
assistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
}
+ public void setDialogSettings(IDialogSettings dialogSettings) {
+ this.dialogSettings = dialogSettings;
+ }
+
+ public IDialogSettings getDialogSettings() {
+ return dialogSettings;
+ }
+
}
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/service/UIPluginModule.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/service/UIPluginModule.java
index c42462f..1f88db9 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/service/UIPluginModule.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/service/UIPluginModule.java
@@ -7,6 +7,7 @@
*******************************************************************************/
package org.eclipse.xtext.ui.common.service;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.xtext.service.AbstractGenericModule;
import org.eclipse.xtext.ui.core.IImageHelper;
@@ -29,6 +30,7 @@ public class UIPluginModule extends AbstractGenericModule {
public void configure(Binder binder) {
super.configure(binder);
binder.bind(AbstractUIPlugin.class).toInstance(plugin);
+ binder.bind(IDialogSettings.class).toInstance(plugin.getDialogSettings());
}
public Class<? extends IImageHelper> bindIImageHelper() {