use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class HideToolWindowAction method update.
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
Project project = event.getProject();
if (project == null) {
presentation.setEnabled(false);
return;
}
ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
String id = toolWindowManager.getActiveToolWindowId();
if (id == null) {
id = toolWindowManager.getLastActiveToolWindowId();
}
presentation.setEnabled(shouldBeHiddenByShortCut(toolWindowManager, id));
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class OpenSelectedProjectsAction method update.
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
List<AnAction> selectedElements = getSelectedElements(e);
boolean hasProject = false;
boolean hasGroup = false;
for (AnAction element : selectedElements) {
if (element instanceof ReopenProjectAction) {
hasProject = true;
}
if (element instanceof ProjectGroupActionGroup) {
hasGroup = true;
}
if (hasGroup && hasProject) {
e.getPresentation().setEnabled(false);
return;
}
}
if (ActionPlaces.WELCOME_SCREEN.equals(e.getPlace())) {
presentation.setEnabledAndVisible(true);
if (selectedElements.size() == 1 && selectedElements.get(0) instanceof ProjectGroupActionGroup) {
presentation.setText("Open All Projects in Group");
} else {
presentation.setText("Open Selected");
}
} else {
presentation.setEnabledAndVisible(false);
}
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class StartUseVcsAction method update.
@Override
public void update(final AnActionEvent e) {
final VcsDataWrapper data = new VcsDataWrapper(e);
final boolean enabled = data.enabled();
final Presentation presentation = e.getPresentation();
presentation.setEnabled(enabled);
presentation.setVisible(enabled);
if (enabled) {
presentation.setText(VcsBundle.message("action.enable.version.control.integration.text"));
}
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class ShowHideRecycledAction method update.
@Override
public void update(@NotNull final AnActionEvent e) {
super.update(e);
final Project project = getEventProject(e);
final Presentation presentation = e.getPresentation();
presentation.setEnabledAndVisible(project != null);
if (project != null) {
final boolean fromContextMenu = ShelvedChangesViewManager.SHELF_CONTEXT_MENU.equals(e.getPlace());
presentation.setText(ShelveChangesManager.getInstance(project).isShowRecycled() && !fromContextMenu ? "Hide Already Unshelved" : "Show Already Unshelved");
presentation.setIcon(fromContextMenu ? null : AllIcons.Vcs.Patch_applied);
}
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class CleanUnshelvedAction method update.
@Override
public void update(@NotNull final AnActionEvent e) {
super.update(e);
final Project project = getEventProject(e);
final Presentation presentation = e.getPresentation();
if (project == null) {
presentation.setEnabledAndVisible(false);
return;
}
presentation.setVisible(true);
presentation.setEnabled(!ShelveChangesManager.getInstance(project).getRecycledShelvedChangeLists().isEmpty());
}
Aggregations