mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RunDashboard: Move Show Configuration action to the first toolbar
This commit is contained in:
@@ -357,7 +357,6 @@ public class RunDashboardContent extends JPanel implements TreeContent, Disposab
|
||||
|
||||
DefaultActionGroup treeGroup = new DefaultActionGroup();
|
||||
|
||||
treeGroup.addAction(new ShowConfigurationsAction());
|
||||
treeGroup.addAction(new PreviousConfigurationAction());
|
||||
treeGroup.addAction(new NextConfigurationAction());
|
||||
treeGroup.addSeparator();
|
||||
@@ -465,45 +464,6 @@ public class RunDashboardContent extends JPanel implements TreeContent, Disposab
|
||||
}
|
||||
}
|
||||
|
||||
private class ShowConfigurationsAction extends ToggleAction implements DumbAware {
|
||||
ShowConfigurationsAction() {
|
||||
super(ExecutionBundle.message("run.dashboard.show.configurations.action.name"), null, AllIcons.Actions.ShowAsTree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
super.update(e);
|
||||
boolean enabled = true;
|
||||
if (isSelected(e)) {
|
||||
if (myLastSelection instanceof RunDashboardNode) {
|
||||
Content content = ((RunDashboardNode)myLastSelection).getContent();
|
||||
enabled = content != null && content.getManager() == myContentManager;
|
||||
}
|
||||
else {
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
e.getPresentation().setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
if (project == null) return true;
|
||||
|
||||
return RunDashboardManager.getInstance(project).isShowConfigurations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
|
||||
RunDashboardManager.getInstance(project).setShowConfigurations(state);
|
||||
updateContent(false);
|
||||
}
|
||||
}
|
||||
|
||||
private class PreviousConfigurationAction extends AnAction implements DumbAware {
|
||||
PreviousConfigurationAction() {
|
||||
super(ExecutionBundle.message("run.dashboard.previous.configuration.action.name"), null, AllIcons.Actions.PreviousOccurence);
|
||||
|
||||
@@ -257,6 +257,7 @@ public class RunDashboardManagerImpl implements RunDashboardManager, PersistentS
|
||||
public void setShowConfigurations(boolean value) {
|
||||
myShowConfigurations = value;
|
||||
updateToolWindowContent();
|
||||
updateDashboard(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.dashboard.actions;
|
||||
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
import com.intellij.execution.dashboard.RunDashboardContent;
|
||||
import com.intellij.execution.dashboard.RunDashboardManager;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Konstantin Aleev
|
||||
*/
|
||||
public class ShowConfigurationsAction extends ToggleAction implements DumbAware {
|
||||
public ShowConfigurationsAction() {
|
||||
super(ExecutionBundle.message("run.dashboard.show.configurations.action.name"), null, AllIcons.Actions.ShowAsTree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
RunDashboardContent runDashboardContent = e.getData(RunDashboardContent.KEY);
|
||||
if (runDashboardContent == null) {
|
||||
e.getPresentation().setEnabledAndVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
super.update(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
if (project == null) return true;
|
||||
|
||||
return RunDashboardManager.getInstance(project).isShowConfigurations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
|
||||
RunDashboardManager.getInstance(project).setShowConfigurations(state);
|
||||
}
|
||||
}
|
||||
@@ -1058,6 +1058,9 @@
|
||||
<action id="RunDashboard.Stop" class="com.intellij.execution.dashboard.actions.StopAction"/>
|
||||
</group>
|
||||
|
||||
<action id="RunDashboard.ShowConfigurations" class="com.intellij.execution.dashboard.actions.ShowConfigurationsAction">
|
||||
<add-to-group group-id="Runner.Layout" anchor="after" relative-to-action="Runner.RestoreLayout"/>
|
||||
</action>
|
||||
<group id="RunDashboardTreeToolbar"/>
|
||||
<group id="RunDashboardPopup">
|
||||
<action id="RunDashboard.EditConfiguration" class="com.intellij.execution.dashboard.actions.EditConfigurationAction"
|
||||
|
||||
Reference in New Issue
Block a user