@Override protected void update(@NotNull Presentation presentation, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext, @Nullable String actionPlace) { super.update(presentation, project, editor, file, dataContext, actionPlace); if (myHandler instanceof ContextAwareActionHandler && presentation.isEnabled()) { presentation.setEnabled(((ContextAwareActionHandler)myHandler).isAvailableForQuickList(editor, file, dataContext)); } }
@Override protected void update(@NotNull Presentation presentation, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext, @Nullable String actionPlace) { // avoid evaluating isValidFor several times unnecessary CodeInsightActionHandler handler = getValidHandler(editor, file); presentation.setEnabled(handler != null); if (handler instanceof ContextAwareActionHandler && !ActionPlaces.isMainMenuOrActionSearch(actionPlace)) { presentation.setVisible(((ContextAwareActionHandler)handler).isAvailableForQuickList(editor, file, dataContext)); } if (presentation.isVisible() && handler instanceof PresentableCodeInsightActionHandler) { ((PresentableCodeInsightActionHandler)handler).update(editor, file, presentation); } }
protected boolean hasAvailableHandler(@NotNull DataContext dataContext) { final RefactoringActionHandler handler = getHandler(dataContext); if (handler != null) { if (handler instanceof ContextAwareActionHandler) { final Editor editor = CommonDataKeys.EDITOR.getData(dataContext); final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext); if (editor != null && file != null && !((ContextAwareActionHandler)handler).isAvailableForQuickList(editor, file, dataContext)) { return false; } } return true; } return false; }
protected boolean hasAvailableHandler(@Nonnull DataContext dataContext) { final RefactoringActionHandler handler = getHandler(dataContext); if (handler != null) { if (handler instanceof ContextAwareActionHandler) { final Editor editor = dataContext.getData(CommonDataKeys.EDITOR); final PsiFile file = dataContext.getData(CommonDataKeys.PSI_FILE); if (editor != null && file != null && !((ContextAwareActionHandler)handler).isAvailableForQuickList(editor, file, dataContext)) { return false; } } return true; } return false; }
@Override protected void update(@NotNull Presentation presentation, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext, @Nullable String actionPlace) { super.update(presentation, project, editor, file, dataContext, actionPlace); if(myHandler instanceof ContextAwareActionHandler && presentation.isEnabled()) { presentation.setEnabled(((ContextAwareActionHandler) myHandler).isAvailableForQuickList(editor, file, dataContext)); } }