當前位置: 首頁>>代碼示例>>Java>>正文


Java Presentation.getDescription方法代碼示例

本文整理匯總了Java中com.intellij.openapi.actionSystem.Presentation.getDescription方法的典型用法代碼示例。如果您正苦於以下問題:Java Presentation.getDescription方法的具體用法?Java Presentation.getDescription怎麽用?Java Presentation.getDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.actionSystem.Presentation的用法示例。


在下文中一共展示了Presentation.getDescription方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public static void update(@NotNull Presentation presentation,
                          @NotNull Presentation templatePresentation,
                          @Nullable ProcessHandler processHandler) {
  boolean enable = false;
  Icon icon = templatePresentation.getIcon();
  String description = templatePresentation.getDescription();
  if (processHandler != null && !processHandler.isProcessTerminated()) {
    enable = true;
    if (processHandler.isProcessTerminating() && processHandler instanceof KillableProcess) {
      KillableProcess killableProcess = (KillableProcess) processHandler;
      if (killableProcess.canKillProcess()) {
        // 'force quite' action presentation
        icon = AllIcons.Debugger.KillProcess;
        description = "Kill process";
      }
    }
  }
  presentation.setEnabled(enable);
  presentation.setIcon(icon);
  presentation.setDescription(description);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:StopProcessAction.java

示例2: updatePopup

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
private void updatePopup(@NotNull JPopupMenu popupMenu, @NotNull String typedStr) {
    popupMenu.removeAll();
    Collection<ActionInfo> foundActions = ActionFinder.findActions(typedStr);
    EditorColorsScheme currScheme = EditorColorsManager.getInstance().getGlobalScheme();
    Color backgroundColor = currScheme.getColor(EditorColors.NOTIFICATION_BACKGROUND);
    Color foregroundColor = currScheme.getDefaultForeground();
    if (backgroundColor == null) backgroundColor = currScheme.getDefaultBackground();
    Color shortcutColor = getShortcutColor(backgroundColor, foregroundColor);
    String shortcutStyle = "color:#" + GuiUtils.colorToHex(shortcutColor);
    String abbrStyle = "font-family:" + currScheme.getConsoleFontName() + ";font-style:oblique;";
    for (ActionInfo actionInfo: foundActions) {
        AnAction action = actionInfo.getAction();
        if (action != null) {
            Presentation presentation = actionInfo.getAction().getTemplatePresentation();
            StringBuilder sb = new StringBuilder();
            sb
                    .append("<html><span style='").append(abbrStyle).append("'>")
                    .append(fillString(actionInfo.getAbbreviation(), ABBR_FIELD_SIZE))
                    .append("</span>");
            String desc = presentation.getDescription();
            if (desc != null && !desc.isEmpty()) {
                sb.append(desc);
            } else {
                String text = presentation.getText();
                if (text != null && !text.isEmpty()) {
                    sb.append(text);
                }
            }
            Shortcut[] shortcuts = action.getShortcutSet().getShortcuts();
            if (shortcuts.length > 0) {
                sb.append("&nbsp;&nbsp;<i style='").append(shortcutStyle).append("'>");
                for (Shortcut shortcut : action.getShortcutSet().getShortcuts()) {
                    if (shortcut != shortcuts[0]) {
                        sb.append(", ");
                    }
                    sb.append(KeymapUtil.getShortcutText(shortcut));
                }
                sb.append("</i>");
            }
            sb.append("</html>");
            JMenuItem menuItem = new JMenuItem(sb.toString());
            menuItem.setForeground(foregroundColor);
            menuItem.setBackground(backgroundColor);
            popupMenu.add(menuItem);
        }
    }
}
 
開發者ID:dyadix,項目名稱:typengo,代碼行數:48,代碼來源:CommandInputForm.java


注:本文中的com.intellij.openapi.actionSystem.Presentation.getDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。