.getStyle() == IAction.AS_RADIO_BUTTON)
&& (propertyName == null || propertyName
.equals(IAction.CHECKED));
if (widget instanceof ToolItem) {
ToolItem ti = (ToolItem) widget;
String text = action.getText();
// the set text is shown only if there is no image or if forced
// by MODE_FORCE_TEXT
boolean showText = text != null
&& ((getMode() & MODE_FORCE_TEXT) != 0 || !hasImages(action));
// only do the trimming if the text will be used
if (showText && text != null) {
text = Action.removeAcceleratorText(text);
text = Action.removeMnemonics(text);
}
if (textChanged) {
String textToSet = showText ? text : ""; //$NON-NLS-1$
boolean rightStyle = (ti.getParent().getStyle() & SWT.RIGHT) != 0;
if (rightStyle || !ti.getText().equals(textToSet)) {
// In addition to being required to update the text if
// it
// gets nulled out in the action, this is also a
// workaround
// for bug 50151: Using SWT.RIGHT on a ToolBar leaves
// blank space
ti.setText(textToSet);
}
}
if (imageChanged) {
// only substitute a missing image if it has no text
updateImages(!showText);
}
if (tooltipTextChanged || textChanged) {
String toolTip = action.getToolTipText();
if ((toolTip == null) || (toolTip.length() == 0)) {
toolTip = text;
}
ExternalActionManager.ICallback callback = ExternalActionManager
.getInstance().getCallback();
String commandId = action.getActionDefinitionId();
if ((callback != null) && (commandId != null)
&& (toolTip != null)) {
String acceleratorText = callback
.getAcceleratorText(commandId);
if (acceleratorText != null
&& acceleratorText.length() != 0) {
toolTip = JFaceResources.format(
"Toolbar_Tooltip_Accelerator", //$NON-NLS-1$
new Object[] { toolTip, acceleratorText });
}
}
// if the text is showing, then only set the tooltip if
// different
if (!showText || toolTip != null && !toolTip.equals(text)) {
ti.setToolTipText(toolTip);
} else {
ti.setToolTipText(null);
}
}
if (enableStateChanged) {
boolean shouldBeEnabled = action.isEnabled()
&& isEnabledAllowed();
if (ti.getEnabled() != shouldBeEnabled) {
ti.setEnabled(shouldBeEnabled);
}
}
if (checkChanged) {
boolean bv = action.isChecked();
if (ti.getSelection() != bv) {
ti.setSelection(bv);
}
}
return;
}