Java Code Examples for com.intellij.openapi.keymap.KeymapUtil#createTooltipText()

The following examples show how to use com.intellij.openapi.keymap.KeymapUtil#createTooltipText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionButton.java    From consulo with Apache License 2.0 6 votes vote down vote up
public boolean update() {
  AnActionEvent event = createAnEvent(null, 0);

  if (event == null) return false;

  myAction.update(event);
  Presentation p = event.getPresentation();
  boolean changed = !areEqual(p, myPrevPresentation);

  setIcons(p.getIcon(), p.getDisabledIcon(), p.getHoveredIcon());

  if (changed) {
    myButton.setIcons(this);
    String tooltipText = KeymapUtil.createTooltipText(p.getText(), myAction);
    myButton.setToolTipText(tooltipText.length() > 0 ? tooltipText : null);
    myButton.setVisible(p.isEnabled() && p.isVisible());
  }

  myPrevPresentation = p;

  return changed;
}
 
Example 2
Source File: LightToolWindow.java    From consulo with Apache License 2.0 6 votes vote down vote up
public ActionButton(AnAction action) {
  myAction = action;

  Presentation presentation = action.getTemplatePresentation();
  InplaceButton button = new InplaceButton(KeymapUtil.createTooltipText(presentation.getText(), action), EmptyIcon.ICON_16, this) {
    @Override
    public boolean isActive() {
      return LightToolWindow.this.isActive();
    }
  };
  button.setHoveringEnabled(!SystemInfo.isMac);
  setContent(button);

  Icon icon = presentation.getIcon();
  Icon hoveredIcon = presentation.getHoveredIcon();
  button.setIcons(icon, icon, hoveredIcon == null ? icon : hoveredIcon);
}
 
Example 3
Source File: ToolbarComboBoxAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void updateTooltipText(String description) {
  String tooltip = KeymapUtil.createTooltipText(description, ToolbarComboBoxAction.this);
  if (Registry.is("ide.helptooltip.enabled") && StringUtil.isNotEmpty(tooltip)) {
    HelpTooltip.dispose(this);
    new HelpTooltip().setDescription(tooltip).setLocation(HelpTooltip.Alignment.BOTTOM).installOn(this);
  }
  else {
    setToolTipText(!tooltip.isEmpty() ? tooltip : null);
  }
}
 
Example 4
Source File: ToolbarComboBoxAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void updateTooltipText(String description) {
  String tooltip = KeymapUtil.createTooltipText(description, ToolbarComboBoxAction.this);
  if (Registry.is("ide.helptooltip.enabled") && StringUtil.isNotEmpty(tooltip)) {
    HelpTooltip.dispose(this);
    new HelpTooltip().setDescription(tooltip).setLocation(HelpTooltip.Alignment.BOTTOM).installOn(this);
  }
  else {
    setToolTipText(!tooltip.isEmpty() ? tooltip : null);
  }
}
 
Example 5
Source File: ComboBoxButtonImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void updateTooltipText(String description) {
  String tooltip = KeymapUtil.createTooltipText(description, myComboBoxAction);
  setToolTipText(!tooltip.isEmpty() ? tooltip : null);
}
 
Example 6
Source File: ActionButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setToolTipText(String s) {
  String tooltipText = KeymapUtil.createTooltipText(s, myAction);
  super.setToolTipText(tooltipText.length() > 0 ? tooltipText : null);
}
 
Example 7
Source File: TextFieldAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected void onSetActive(final boolean active) {
  final String tooltip = KeymapUtil
    .createTooltipText(ActionsBundle.message("action.FileChooser.TogglePathShowing.text"),
                       ActionManager.getInstance().getAction("FileChooser.TogglePathShowing"));
  setToolTipText(tooltip);
}