aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2012-03-26 10:43:34 (EDT)
committerBogdan Gheorghe2012-04-26 17:00:11 (EDT)
commit787093e736756adf2ce791103e7e4e3ae474e60e (patch)
treea04618cf8a02a925b49e529cf729b1da5e332322
parent492726616c45a959b34fa911e50eb2c45674ed67 (diff)
downloadeclipse.platform.swt-787093e736756adf2ce791103e7e4e3ae474e60e.zip
eclipse.platform.swt-787093e736756adf2ce791103e7e4e3ae474e60e.tar.gz
eclipse.platform.swt-787093e736756adf2ce791103e7e4e3ae474e60e.tar.bz2
cleanup ToolItem.setText/setImage
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index 3577a52..296fb75 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -1009,16 +1009,14 @@ public void setImage (Image image) {
}
OS.gtk_tool_button_set_icon_widget (handle, imageHandle);
/*
- * If Text/Image of a tool-item changes, then it is
- * required to reset the proxy menu. Otherwise, the
- * old menuItem appears in the overflow menu.
- */
- if ((style & SWT.CHECK | SWT.RADIO | SWT.DROP_DOWN) != 0) {
+ * If Text/Image of a tool-item changes, then it is
+ * required to reset the proxy menu. Otherwise, the
+ * old menuItem appears in the overflow menu.
+ */
+ if ((style & SWT.DROP_DOWN) != 0) {
proxyMenuItem = 0;
- if ((style & SWT.DROP_DOWN) != 0) {
- proxyMenuItem = OS.gtk_tool_item_retrieve_proxy_menu_item (handle);
- OS.g_signal_connect(proxyMenuItem, OS.activate, ToolBar.menuItemSelectedFunc.getAddress(), handle);
- }
+ proxyMenuItem = OS.gtk_tool_item_retrieve_proxy_menu_item (handle);
+ OS.g_signal_connect(proxyMenuItem, OS.activate, ToolBar.menuItemSelectedFunc.getAddress(), handle);
}
parent.relayout ();
}
@@ -1094,20 +1092,25 @@ boolean setTabItemFocus (boolean next) {
public void setText (String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (((style & SWT.SEPARATOR) != 0) || text.equals(string)) return;
+ if ((style & SWT.SEPARATOR) != 0) return;
if (string.equals(this.text)) return;
super.setText (string);
+ if (labelHandle == 0) return;
char [] chars = fixMnemonic (string);
byte [] buffer = Converter.wcsToMbcs (null, chars, true);
+ OS.gtk_label_set_text_with_mnemonic (labelHandle, buffer);
if ((style & SWT.DROP_DOWN) != 0 && OS.GTK_VERSION < OS.VERSION (2, 6, 0)) {
- OS.gtk_label_set_text_with_mnemonic (labelHandle, buffer);
if (string.length () != 0) {
OS.gtk_widget_show (labelHandle);
} else {
OS.gtk_widget_hide (labelHandle);
}
}
- OS.gtk_label_set_text(labelHandle, buffer) ;
+ /*
+ * If Text/Image of a tool-item changes, then it is
+ * required to reset the proxy menu. Otherwise, the
+ * old menuItem appears in the overflow menu.
+ */
if ((style & SWT.DROP_DOWN) != 0) {
proxyMenuItem = 0;
proxyMenuItem = OS.gtk_tool_item_retrieve_proxy_menu_item (handle);