本文整理匯總了Java中com.intellij.openapi.actionSystem.AnAction.getTemplatePresentation方法的典型用法代碼示例。如果您正苦於以下問題:Java AnAction.getTemplatePresentation方法的具體用法?Java AnAction.getTemplatePresentation怎麽用?Java AnAction.getTemplatePresentation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.actionSystem.AnAction
的用法示例。
在下文中一共展示了AnAction.getTemplatePresentation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPresentation
import com.intellij.openapi.actionSystem.AnAction; //導入方法依賴的package包/類
@NotNull
public final Presentation getPresentation(@NotNull AnAction action){
Presentation presentation = myAction2Presentation.get(action);
if (presentation == null || !action.isDefaultIcon()){
Presentation templatePresentation = action.getTemplatePresentation();
if (presentation == null) {
presentation = templatePresentation.clone();
myAction2Presentation.put(action, presentation);
}
if (!action.isDefaultIcon()) {
presentation.setIcon(templatePresentation.getIcon());
presentation.setDisabledIcon(templatePresentation.getDisabledIcon());
}
processPresentation(presentation);
}
return presentation;
}
示例2: createPopupActionGroup
import com.intellij.openapi.actionSystem.AnAction; //導入方法依賴的package包/類
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
DefaultActionGroup actionGroup = new DefaultActionGroup();
for (final T item : myItems) {
if (addSeparator(actionGroup, item)) {
continue;
}
AnAction action = new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
if (mySelection != item && selectionChanged(item)) {
mySelection = item;
AbstractComboBoxAction.this.update(item, myPresentation, false);
}
}
};
actionGroup.add(action);
Presentation presentation = action.getTemplatePresentation();
presentation.setIcon(mySelection == item ? CHECKED : null);
update(item, presentation, true);
}
return actionGroup;
}