Add "Edit Run Configuration" action to Maven Tool Window.
authorSergey Evdokimov <sergey.evdokimov@jetbrains.com>
Mon, 30 Sep 2013 16:50:16 +0000 (20:50 +0400)
committerSergey Evdokimov <sergey.evdokimov@jetbrains.com>
Mon, 30 Sep 2013 16:50:37 +0000 (20:50 +0400)
plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/EditMavenRunConfigurationAction.java [new file with mode: 0644]
plugins/maven/src/main/resources/META-INF/plugin.xml

diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/EditMavenRunConfigurationAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/EditMavenRunConfigurationAction.java
new file mode 100644 (file)
index 0000000..7a6b9f5
--- /dev/null
@@ -0,0 +1,28 @@
+package org.jetbrains.idea.maven.navigator.actions;
+
+import com.intellij.execution.RunManager;
+import com.intellij.execution.RunnerAndConfigurationSettings;
+import com.intellij.execution.impl.EditConfigurationsDialog;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.PlatformDataKeys;
+import com.intellij.openapi.project.Project;
+import org.jetbrains.idea.maven.utils.MavenDataKeys;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public class EditMavenRunConfigurationAction extends AnAction {
+  @Override
+  public void actionPerformed(AnActionEvent e) {
+    Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
+    RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());
+
+    if (settings == null || project == null) return;
+
+    RunManager.getInstance(project).setSelectedConfiguration(settings);
+
+    EditConfigurationsDialog dialog = new EditConfigurationsDialog(project);
+    dialog.show();
+  }
+}
index e8105687d6a6cf9e18827ee5667c8aad9185c0ef..8a578d8290b2f2739f4a3b8c4bd55197361ea8de 100644 (file)
 
     <group id="Maven.RunConfigurationMenu" popup="true" class="org.jetbrains.idea.maven.navigator.actions.MavenRunConfigurationMenu">
       <separator/>
+      <action id="Maven.EditRunConfiguration"
+              text="Edit Run Configuration..." icon="AllIcons.Actions.Edit" use-shortcut-of="EditSource"
+              class="org.jetbrains.idea.maven.navigator.actions.EditMavenRunConfigurationAction" />
       <action id="Maven.RemoveRunConfiguration"
               text="Remove Run Configuration" icon="AllIcons.General.Remove" use-shortcut-of="$Delete"
               class="org.jetbrains.idea.maven.navigator.actions.RemoveMavenRunConfigurationAction" />