use of com.intellij.tasks.TaskManager in project intellij-community by JetBrains.
the class AssociateWithTaskAction method isSelected.
@Override
public boolean isSelected(AnActionEvent e) {
ChangeList[] lists = e.getData(VcsDataKeys.CHANGE_LISTS);
if (lists == null) {
return false;
}
Project project = e.getData(CommonDataKeys.PROJECT);
TaskManager manager = TaskManager.getManager(project);
for (ChangeList list : lists) {
if (list instanceof LocalChangeList && manager.getAssociatedTask((LocalChangeList) list) == null) {
return false;
}
}
return true;
}
use of com.intellij.tasks.TaskManager in project intellij-community by JetBrains.
the class CreateChangelistAction method update.
@Override
public void update(AnActionEvent event) {
super.update(event);
if (event.getPresentation().isEnabled()) {
TaskManager manager = getTaskManager(event);
Presentation presentation = event.getPresentation();
if (manager == null || !manager.isVcsEnabled()) {
presentation.setText(getTemplatePresentation().getText());
presentation.setEnabled(false);
} else {
presentation.setEnabled(true);
if (manager.getActiveTask().getChangeLists().size() == 0) {
presentation.setText("Create changelist for '" + TaskUtil.getTrimmedSummary(manager.getActiveTask()) + "'");
} else {
presentation.setText("Add changelist for '" + TaskUtil.getTrimmedSummary(manager.getActiveTask()) + "'");
}
}
}
}
Aggregations