/*
 * Copyright 2000-2013 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 org.jetbrains.idea.maven.navigator.actions;

import com.intellij.execution.RunManager;
import com.intellij.execution.RunManagerEx;
import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.project.Project;
import org.jetbrains.idea.maven.utils.MavenDataKeys;

import javax.swing.*;

/**
 * @author Sergey Evdokimov
 */
public class RemoveMavenRunConfigurationAction extends AnAction {
  @Override
  public void actionPerformed(AnActionEvent e) {
    Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
    RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());

    assert settings != null && project != null;

    int res = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
                                            "Delete \"" + settings.getName() + "\"?",
                                            "Confirmation", JOptionPane.YES_NO_OPTION);

    if (res == JOptionPane.YES_OPTION) {
      ((RunManagerEx)RunManager.getInstance(project)).removeConfiguration(settings);
    }
  }

  @Override
  public void update(AnActionEvent e) {
    Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
    RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());

    boolean enabled = settings != null && project != null;
    e.getPresentation().setEnabledAndVisible(enabled);
  }
}

@@ -1004,16 +1004,57 @@
 roject;%0A
+import com.intellij.openapi.ui.Messages;%0A
 import o
@@ -1103,31 +1103,8 @@
 s;%0A%0A
-import javax.swing.*;%0A%0A
 /**%0A
@@ -1511,241 +1511,129 @@
 s = 
-JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),%0A                                            %22Delete %5C%22%22 + settings.getName() + %22%5C%22?%22,%0A                                            %22Confirmation%22, JOptionPane.YES_NO_OPTION
+Messages.showYesNoDialog(project, %22Delete %5C%22%22 + settings.getName() + %22%5C%22?%22, %22Confirmation%22, Messages.getQuestionIcon()
 );%0A
-%0A
     
@@ -1647,30 +1647,9 @@
  == 
-JOptionPane.YES_OPTION
+0
 ) %7B%0A

Use Messages instead of JOptionPane.