use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class MultiCaretCodeInsightAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
final Presentation presentation = e.getPresentation();
Project project = e.getProject();
if (project == null) {
presentation.setEnabled(false);
return;
}
Editor hostEditor = CommonDataKeys.EDITOR.getData(e.getDataContext());
if (hostEditor == null) {
presentation.setEnabled(false);
return;
}
final Ref<Boolean> enabled = new Ref<>(Boolean.FALSE);
iterateOverCarets(project, hostEditor, new MultiCaretCodeInsightActionHandler() {
@Override
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiFile file) {
if (isValidFor(project, editor, caret, file)) {
enabled.set(Boolean.TRUE);
}
}
});
presentation.setEnabled(enabled.get());
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class ChooseRunConfigurationPopupAction method update.
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
final Project project = e.getData(CommonDataKeys.PROJECT);
presentation.setEnabled(true);
if (project == null || project.isDisposed()) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
if (null == getDefaultExecutor()) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
presentation.setEnabled(true);
presentation.setVisible(true);
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class EditRunConfigurationsAction method update.
@Override
public void update(final AnActionEvent e) {
Presentation presentation = e.getPresentation();
Project project = e.getProject();
presentation.setEnabled(project == null || !DumbService.isDumb(project));
if (ActionPlaces.RUN_CONFIGURATIONS_COMBOBOX.equals(e.getPlace())) {
presentation.setText(ExecutionBundle.message("edit.configuration.action"));
presentation.setDescription(presentation.getText());
}
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class BrowseCallHierarchyAction method update.
@Override
public final void update(final AnActionEvent event) {
final Presentation presentation = event.getPresentation();
if (!ActionPlaces.isMainMenuOrActionSearch(event.getPlace())) {
presentation.setText(IdeBundle.message("action.browse.call.hierarchy"));
}
super.update(event);
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class BrowseTypeHierarchyAction method update.
@Override
public final void update(final AnActionEvent event) {
final Presentation presentation = event.getPresentation();
if (!ActionPlaces.isMainMenuOrActionSearch(event.getPlace())) {
presentation.setText(IdeBundle.message("action.browse.type.hierarchy"));
}
super.update(event);
}
Aggregations