aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorD. Spiridenok2014-03-07 16:26:21 (EST)
committerLars Vogel2014-03-10 08:44:03 (EDT)
commit74fd99e788df5a0366286b6b72682b71cbe7a990 (patch)
tree27e987dfbae2b0ce5bf19ecfe8100a9c38541e0f
parent0507511d9a830c6ec3f7644c01437c559ff862d3 (diff)
downloadeclipse.platform.ui-74fd99e788df5a0366286b6b72682b71cbe7a990.zip
eclipse.platform.ui-74fd99e788df5a0366286b6b72682b71cbe7a990.tar.gz
eclipse.platform.ui-74fd99e788df5a0366286b6b72682b71cbe7a990.tar.bz2
Bug 429756 - Handled Tool Item should use Command's name if no Label isrefs/changes/71/23071/6
specified Change-Id: I21291f339018fe30c326217a22109d77b18b6380 Signed-off-by: D. Spiridenok <spiridenok@tut.by>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
index 8df8a61..4668b90 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
@@ -10,6 +10,7 @@
* Joseph Carroll <jdsalingerjr@gmail.com> - Bug 385414 Contributing wizards to toolbar always displays icon and text
* Snjezana Peco <snjezana.peco@redhat.com> - Memory leaks in Juno when opening and closing XML Editor - http://bugs.eclipse.org/397909
* Marco Descher <marco@descher.at> - Bug 397677
+ * Dmitry Spiridenok - Bug 429756
******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
@@ -38,6 +39,7 @@ import org.eclipse.e4.ui.internal.workbench.Policy;
import org.eclipse.e4.ui.internal.workbench.RenderedElementUtil;
import org.eclipse.e4.ui.internal.workbench.renderers.swt.IUpdateService;
import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer;
+import org.eclipse.e4.ui.model.application.commands.MCommand;
import org.eclipse.e4.ui.model.application.commands.MParameter;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
@@ -471,14 +473,24 @@ public class HandledContributionItem extends ContributionItem {
private void updateToolItem() {
ToolItem item = (ToolItem) widget;
- final String text = model.getLocalizedLabel();
- Image icon = item.getImage();
- boolean mode = model.getTags().contains(FORCE_TEXT);
- if ((icon == null || mode) && text != null) {
- item.setText(text);
+
+ if (item.getImage() == null || model.getTags().contains(FORCE_TEXT)) {
+ final String text = model.getLocalizedLabel();
+ if (text == null || text.length() == 0) {
+ final MCommand command = model.getCommand();
+ if (command == null) {
+ // Set some text so that the item stays visible in the menu
+ item.setText("UnLabled"); //$NON-NLS-1$
+ } else {
+ item.setText(command.getCommandName());
+ }
+ } else {
+ item.setText(text);
+ }
} else {
item.setText(""); //$NON-NLS-1$
}
+
final String tooltip = getToolTipText();
item.setToolTipText(tooltip);
item.setSelection(model.isSelected());