use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class StudyCheckAction method updateDescription.
private static void updateDescription(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
final Project project = e.getProject();
if (project != null) {
final StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
if (studyEditor != null) {
final Task task = studyEditor.getTaskFile().getTask();
if (task.isTheoryTask()) {
presentation.setText(getTextWithShortcuts("Get Next Recommendation"));
} else {
presentation.setText(getTextWithShortcuts(TEXT));
}
}
}
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class StudyFillPlaceholdersAction method update.
@Override
public void update(AnActionEvent e) {
StudyUtils.updateAction(e);
final Project project = e.getProject();
if (project != null) {
Course course = StudyTaskManager.getInstance(project).getCourse();
Presentation presentation = e.getPresentation();
if (course != null && !EduNames.STUDY.equals(course.getCourseMode())) {
presentation.setEnabled(false);
presentation.setVisible(true);
return;
}
StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
StudyState studyState = new StudyState(studyEditor);
if (!studyState.isValid()) {
presentation.setEnabledAndVisible(false);
return;
}
TaskFile taskFile = studyState.getTaskFile();
if (taskFile.getActivePlaceholders().isEmpty()) {
presentation.setEnabledAndVisible(false);
}
}
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class ThumbnailViewActionUtil method setEnabled.
/**
* Enable or disable current action from event.
*
* @param e Action event
* @return Enabled value
*/
public static boolean setEnabled(AnActionEvent e) {
ThumbnailView thumbnailView = getVisibleThumbnailView(e);
Presentation presentation = e.getPresentation();
presentation.setEnabled(thumbnailView != null);
return presentation.isEnabled();
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class InterruptThreadAction method update.
public void update(AnActionEvent e) {
final DebuggerTreeNodeImpl[] selectedNodes = getSelectedNodes(e.getDataContext());
boolean visible = false;
boolean enabled = false;
if (selectedNodes != null && selectedNodes.length > 0) {
visible = true;
enabled = true;
for (DebuggerTreeNodeImpl selectedNode : selectedNodes) {
final NodeDescriptorImpl threadDescriptor = selectedNode.getDescriptor();
if (!(threadDescriptor instanceof ThreadDescriptorImpl)) {
visible = false;
break;
}
}
if (visible) {
for (DebuggerTreeNodeImpl selectedNode : selectedNodes) {
final ThreadDescriptorImpl threadDescriptor = (ThreadDescriptorImpl) selectedNode.getDescriptor();
if (threadDescriptor.isFrozen() || threadDescriptor.isSuspended()) {
enabled = false;
break;
}
}
}
}
final Presentation presentation = e.getPresentation();
presentation.setText(DebuggerBundle.message("action.interrupt.thread.text"));
presentation.setEnabledAndVisible(visible && enabled);
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class ThreadDumpAction method update.
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
Project project = e.getProject();
if (project == null) {
presentation.setEnabled(false);
return;
}
DebuggerSession debuggerSession = (DebuggerManagerEx.getInstanceEx(project)).getContext().getDebuggerSession();
presentation.setEnabled(debuggerSession != null && debuggerSession.isAttached());
}
Aggregations