in src/main/java/idea/plugin/psiviewer/controller/actions/BaseGlobalAction.java [25:51]
public void update(AnActionEvent event)
{
Presentation presentation = event.getPresentation();
Project project = ActionEventUtil.getProject(event);
if (project == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(PsiViewerConstants.ID_TOOL_WINDOW);
if (toolWindow == null)
{ // tool window isn't registered
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
VirtualFile file = ActionEventUtil.getVirtualFile(event);
if (file == null)
{
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
presentation.setEnabled(toolWindow.isAvailable());
presentation.setVisible(true);
}