List of usage examples for org.eclipse.jface.action IAction DESCRIPTION
String DESCRIPTION
To view the source code for org.eclipse.jface.action IAction DESCRIPTION.
Click Source Link
"description"). From source file:org.eclipse.ui.internal.handlers.CommandLegacyActionWrapper.java
License:Open Source License
public final void setActionDefinitionId(final String id) { // Get the old values. final boolean oldChecked = isChecked(); final String oldDescription = getDescription(); final boolean oldEnabled = isEnabled(); final boolean oldHandled = isHandled(); final ImageDescriptor oldDefaultImage = getImageDescriptor(); final ImageDescriptor oldDisabledImage = getDisabledImageDescriptor(); final ImageDescriptor oldHoverImage = getHoverImageDescriptor(); final String oldText = getText(); // Update the command. final Command oldBaseCommand = command.getCommand(); oldBaseCommand.removeCommandListener(commandListener); final ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class); final Command newBaseCommand = commandService.getCommand(id); command = new ParameterizedCommand(newBaseCommand, null); newBaseCommand.addCommandListener(commandListener); // Get the new values. final boolean newChecked = isChecked(); final String newDescription = getDescription(); final boolean newEnabled = isEnabled(); final boolean newHandled = isHandled(); final ImageDescriptor newDefaultImage = getImageDescriptor(); final ImageDescriptor newDisabledImage = getDisabledImageDescriptor(); final ImageDescriptor newHoverImage = getHoverImageDescriptor(); final String newText = getText(); // Fire property change events, as necessary. if (newChecked != oldChecked) { if (oldChecked) { firePropertyChange(IAction.CHECKED, Boolean.TRUE, Boolean.FALSE); } else {// w w w . j av a2 s . c o m firePropertyChange(IAction.CHECKED, Boolean.FALSE, Boolean.TRUE); } } if (!Util.equals(oldDescription, newDescription)) { firePropertyChange(IAction.DESCRIPTION, oldDescription, newDescription); firePropertyChange(IAction.TOOL_TIP_TEXT, oldDescription, newDescription); } if (newEnabled != oldEnabled) { if (oldEnabled) { firePropertyChange(IAction.ENABLED, Boolean.TRUE, Boolean.FALSE); } else { firePropertyChange(IAction.ENABLED, Boolean.FALSE, Boolean.TRUE); } } if (newHandled != oldHandled) { if (oldHandled) { firePropertyChange(IAction.HANDLED, Boolean.TRUE, Boolean.FALSE); } else { firePropertyChange(IAction.HANDLED, Boolean.FALSE, Boolean.TRUE); } } if (!Util.equals(oldDefaultImage, newDefaultImage)) { firePropertyChange(IAction.IMAGE, oldDefaultImage, newDefaultImage); } if (!Util.equals(oldDisabledImage, newDisabledImage)) { firePropertyChange(IAction.IMAGE, oldDisabledImage, newDisabledImage); } if (!Util.equals(oldHoverImage, newHoverImage)) { firePropertyChange(IAction.IMAGE, oldHoverImage, newHoverImage); } if (!Util.equals(oldText, newText)) { firePropertyChange(IAction.TEXT, oldText, newText); } }