Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2009-03-05 09:52:15 +0000
committerMarkus Keller2009-03-05 09:52:15 +0000
commitc5c906d22b0fc7a3114a406040717606a4101217 (patch)
tree82dd74cac1159ce76bb3ab39a44485496632682c
parentc2080c2f40d294285dc1ce01694a62a9c214302b (diff)
downloadeclipse.platform.text-c5c906d22b0fc7a3114a406040717606a4101217.tar.gz
eclipse.platform.text-c5c906d22b0fc7a3114a406040717606a4101217.tar.xz
eclipse.platform.text-c5c906d22b0fc7a3114a406040717606a4101217.zip
work around Bug 245569: Use platform native or reasonable default for Combo's visibleItemCount
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java28
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java2
2 files changed, 29 insertions, 1 deletions
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java
index fe8f5d79075..4cd9aa808a0 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2009 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
@@ -13,6 +13,7 @@ package org.eclipse.ui.internal.texteditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.core.runtime.Assert;
@@ -28,6 +29,16 @@ import org.eclipse.jface.resource.JFaceResources;
public class SWTUtil {
/**
+ * The default visible item count for {@link Combo}s.
+ * Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=245569 .
+ *
+ * @see Combo#setVisibleItemCount(int)
+ *
+ * @since 3.5
+ */
+ public static final int COMBO_VISIBLE_ITEM_COUNT= 30;
+
+ /**
* Returns a width hint for the given button.
*
* @param button the button
@@ -55,4 +66,19 @@ public class SWTUtil {
((GridData)gd).horizontalAlignment = GridData.FILL;
}
}
+
+ /**
+ * Sets the default visible item count for {@link Combo}s.
+ * Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=7845 .
+ *
+ * @param combo the combo
+ *
+ * @see Combo#setVisibleItemCount(int)
+ * @see #COMBO_VISIBLE_ITEM_COUNT
+ *
+ * @since 3.5
+ */
+ public static void setDefaultVisibleItemCount(Combo combo) {
+ combo.setVisibleItemCount(COMBO_VISIBLE_ITEM_COUNT);
+ }
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java
index 236e277be90..1672191bd46 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java
@@ -119,6 +119,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.internal.texteditor.NLSUtility;
+import org.eclipse.ui.internal.texteditor.SWTUtil;
import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
@@ -330,6 +331,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
}
fContextCombo.addModifyListener(listener);
+ SWTUtil.setDefaultVisibleItemCount(fContextCombo);
fAutoInsertCheckbox= createCheckbox(composite, TemplatesMessages.EditTemplateDialog_autoinsert);
fAutoInsertCheckbox.setSelection(fOriginalTemplate.isAutoInsertable());

Back to the top