From 8e9f566357fe1ee0f48b874db299b48b366d83ff Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Mon, 27 Jul 2015 11:15:49 +0300 Subject: [PATCH] EditTaskAction --- .../tasks/tasks-core/src/META-INF/plugin.xml | 1 + .../tasks/actions/EditTaskAction.java | 46 +++++++++++++++++++ .../tasks/actions/EditTaskDialog.java | 4 +- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 plugins/tasks/tasks-core/src/com/intellij/tasks/actions/EditTaskAction.java diff --git a/plugins/tasks/tasks-core/src/META-INF/plugin.xml b/plugins/tasks/tasks-core/src/META-INF/plugin.xml index 8ea064939adc..8c5b9e25be00 100644 --- a/plugins/tasks/tasks-core/src/META-INF/plugin.xml +++ b/plugins/tasks/tasks-core/src/META-INF/plugin.xml @@ -31,6 +31,7 @@ + diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/EditTaskAction.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/EditTaskAction.java new file mode 100644 index 000000000000..86fb0931e03b --- /dev/null +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/EditTaskAction.java @@ -0,0 +1,46 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.tasks.actions; + +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.Presentation; +import com.intellij.openapi.project.Project; +import com.intellij.tasks.TaskManager; +import com.intellij.tasks.impl.LocalTaskImpl; + +/** + * @author Dmitry Avdeev + */ +public class EditTaskAction extends BaseTaskAction { + @Override + public void actionPerformed(AnActionEvent e) { + Project project = getEventProject(e); + if (project != null) { + LocalTaskImpl task = (LocalTaskImpl)TaskManager.getManager(project).getActiveTask(); + new EditTaskDialog(project, task).show(); + } + } + + @Override + public void update(AnActionEvent event) { + super.update(event); + Presentation presentation = event.getPresentation(); + Project project = getEventProject(event); + if (project != null && presentation.isEnabled()) { + presentation.setText("Edit '" + TaskManager.getManager(project).getActiveTask().getPresentableName()); + } + } +} diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/EditTaskDialog.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/EditTaskDialog.java index 79362bdec5be..86c8a4e43b65 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/EditTaskDialog.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/EditTaskDialog.java @@ -107,9 +107,9 @@ public class EditTaskDialog extends DialogWrapper { if (myChangelist.isVisible()) { List changeLists = myTask.getChangeLists(); changeLists.clear(); - ChangeListInfo item = (ChangeListInfo)myChangelist.getSelectedItem(); + LocalChangeList item = (LocalChangeList)myChangelist.getSelectedItem(); if (item != null) { - changeLists.add(item); + changeLists.add(new ChangeListInfo(item)); } } if (myBranch.isVisible()) {