RunDashboard: update re(run/debug) actions text and icons

This commit is contained in:
Konstantin Aleev
2017-05-16 19:48:26 +03:00
parent 5b413e8de3
commit 4c41e8655a
6 changed files with 44 additions and 29 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

@@ -19,27 +19,32 @@ import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.Executor;
import com.intellij.execution.ExecutorRegistry;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.wm.ToolWindowId;
import javax.swing.*;
import org.jetbrains.annotations.NotNull;
/**
* @author konstantin.aleev
*/
public class DebugAction extends ExecutorAction {
public DebugAction() {
super(ExecutionBundle.message("run.dashboard.debug.action.name"),
ExecutionBundle.message("run.dashboard.debug.action.description"),
AllIcons.Toolwindows.ToolWindowDebugger);
}
@Override
protected Executor getExecutor() {
return ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG);
}
@Override
protected Icon getIcon(boolean running) {
return AllIcons.Toolwindows.ToolWindowDebugger;
protected void update(@NotNull AnActionEvent e, boolean running) {
Presentation presentation = e.getPresentation();
if (running) {
presentation.setText(ExecutionBundle.message("run.dashboard.restart.debugger.action.name"));
presentation.setDescription(ExecutionBundle.message("run.dashboard.restart.debugger.action.description"));
presentation.setIcon(AllIcons.Actions.RestartDebugger);
}
else {
presentation.setText(ExecutionBundle.message("run.dashboard.debug.action.name"));
presentation.setDescription(ExecutionBundle.message("run.dashboard.debug.action.description"));
presentation.setIcon(AllIcons.Actions.StartDebugger);
}
}
}
@@ -39,8 +39,8 @@ import java.util.List;
* @author konstantin.aleev
*/
public abstract class ExecutorAction extends RunDashboardTreeLeafAction<DashboardRunConfigurationNode> {
protected ExecutorAction(String text, String description, Icon icon) {
super(text, description, icon);
protected ExecutorAction() {
super(null, null, null);
}
@Override
@@ -59,11 +59,11 @@ public abstract class ExecutorAction extends RunDashboardTreeLeafAction<Dashboar
Content content = node.getContent();
return content != null && !RunContentManagerImpl.isTerminated(content);
});
e.getPresentation().setIcon(getIcon(running));
update(e, running);
}
else {
Content content = RunDashboardManager.getInstance(e.getProject()).getDashboardContentManager().getSelectedContent();
e.getPresentation().setIcon(getIcon(content != null && !RunContentManagerImpl.isTerminated(content)));
update(e, content != null && !RunContentManagerImpl.isTerminated(content));
}
}
@@ -114,5 +114,5 @@ public abstract class ExecutorAction extends RunDashboardTreeLeafAction<Dashboar
protected abstract Executor getExecutor();
protected abstract Icon getIcon(boolean running);
protected abstract void update(@NotNull AnActionEvent e, boolean running);
}
@@ -19,26 +19,31 @@ import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.Executor;
import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.icons.AllIcons;
import javax.swing.*;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import org.jetbrains.annotations.NotNull;
/**
* @author konstantin.aleev
*/
public class RunAction extends ExecutorAction {
public RunAction() {
super(ExecutionBundle.message("run.dashboard.run.action.name"),
ExecutionBundle.message("run.dashboard.run.action.description"),
AllIcons.Toolwindows.ToolWindowRun);
}
@Override
protected Executor getExecutor() {
return DefaultRunExecutor.getRunExecutorInstance();
}
@Override
protected Icon getIcon(boolean running) {
return running ? AllIcons.Actions.Restart : AllIcons.Toolwindows.ToolWindowRun;
protected void update(@NotNull AnActionEvent e, boolean running) {
Presentation presentation = e.getPresentation();
if (running) {
presentation.setText(ExecutionBundle.message("run.dashboard.rerun.action.name"));
presentation.setDescription(ExecutionBundle.message("run.dashboard.rerun.action.description"));
presentation.setIcon(AllIcons.Actions.Restart);
}
else {
presentation.setText(ExecutionBundle.message("run.dashboard.run.action.name"));
presentation.setDescription(ExecutionBundle.message("run.dashboard.run.action.description"));
presentation.setIcon(AllIcons.Actions.Execute);
}
}
}
@@ -381,10 +381,14 @@ run.dashboard.not.started.configuration.message=Run configuration not started
run.dashboard.group.by.type.action.name=Group by Type
run.dashboard.group.by.status.action.name=Group by Status
run.dashboard.group.by.folder.action.name=Group by Folder
run.dashboard.run.action.name=(Re)run
run.dashboard.run.action.description=(Re)run selected run configuration(s)
run.dashboard.debug.action.name=(Re)run in Debug Mode
run.dashboard.debug.action.description=(Re)run selected run configuration(s) in Debug Mode
run.dashboard.run.action.name=Run
run.dashboard.run.action.description=Run selected run configuration(s)
run.dashboard.rerun.action.name=Rerun
run.dashboard.rerun.action.description=Rerun selected run configuration(s)
run.dashboard.debug.action.name=Debug
run.dashboard.debug.action.description=Debug selected run configuration(s)
run.dashboard.restart.debugger.action.name=Rerun in Debug Mode
run.dashboard.restart.debugger.action.description=Rerun selected run configuration(s) in Debug Mode
run.dashboard.stop.action.name=Stop
run.dashboard.stop.action.description=Stop selected run configuration(s)
run.dashboard.edit.configuration.action.name=Edit Configuration
@@ -145,6 +145,7 @@ public class AllIcons {
public static final Icon Reset = IconLoader.getIcon("/actions/reset.png"); // 16x16
public static final Icon Reset_to_empty = IconLoader.getIcon("/actions/Reset_to_empty.png"); // 16x16
public static final Icon Restart = IconLoader.getIcon("/actions/restart.png"); // 16x16
public static final Icon RestartDebugger = IconLoader.getIcon("/actions/restartDebugger.png"); // 16x16
public static final Icon Resume = IconLoader.getIcon("/actions/resume.png"); // 16x16
public static final Icon Right = IconLoader.getIcon("/actions/right.png"); // 16x16
public static final Icon Rollback = IconLoader.getIcon("/actions/rollback.png"); // 16x16