EditTaskAction

This commit is contained in:
Dmitry Avdeev
2015-07-27 11:22:01 +03:00
parent bbcbbef51f
commit 8e9f566357
3 changed files with 49 additions and 2 deletions
@@ -31,6 +31,7 @@
<keyboard-shortcut keymap="$default" first-keystroke="alt shift W"/>
</action>
<separator/>
<action id="tasks.edit" class="com.intellij.tasks.actions.EditTaskAction" text="Edit Task..."/>
<action id="tasks.create.changelist" class="com.intellij.tasks.actions.CreateChangelistAction" text="Create Change_list..."/>
<action id="tasks.show.task.description" class="com.intellij.tasks.actions.ShowTaskDescription" text="Show Description"/>
<action id="tasks.open.in.browser" class="com.intellij.tasks.actions.OpenTaskInBrowserAction" text="Open in _Browser">
@@ -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());
}
}
}
@@ -107,9 +107,9 @@ public class EditTaskDialog extends DialogWrapper {
if (myChangelist.isVisible()) {
List<ChangeListInfo> 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()) {