Merge branch 'master' of git.labs.intellij.net:idea/community
authorirengrig <Irina.Chernushina@jetbrains.com>
Wed, 24 Mar 2010 06:55:43 +0000 (09:55 +0300)
committerirengrig <Irina.Chernushina@jetbrains.com>
Wed, 24 Mar 2010 06:55:43 +0000 (09:55 +0300)
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UnversionedViewDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/DeleteUnversionedFilesAction.java
plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java

index de9998327e489e5cae81cd1e1d02cc9e84a006b3..1cd4f44c372208aad0330e15b487da60215be9aa 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.vcs.VcsBundle;
+import com.intellij.openapi.vcs.changes.actions.DeleteUnversionedFilesAction;
 import com.intellij.openapi.vcs.changes.actions.IgnoreUnversionedAction;
 import com.intellij.openapi.vcs.changes.actions.MoveChangesToAnotherListAction;
 import com.intellij.openapi.vcs.changes.actions.ScheduleForAdditionAction;
@@ -132,6 +133,15 @@ public class UnversionedViewDialog extends DialogWrapper {
     myPanel.add(actionToolbar.getComponent(), BorderLayout.WEST);
     myPanel.add(new JScrollPane(myView), BorderLayout.CENTER);
 
+    final DeleteUnversionedFilesAction deleteUnversionedFilesAction = new DeleteUnversionedFilesAction() {
+      @Override
+      public void actionPerformed(AnActionEvent e) {
+        super.actionPerformed(e);
+        refreshView();
+      }
+    };
+    actions.add(deleteUnversionedFilesAction);
+    deleteUnversionedFilesAction.registerCustomShortcutSet(CommonShortcuts.DELETE, myView);
     actions.add(new ScheduleForAdditionAction() {
       @Override
       public void actionPerformed(AnActionEvent e) {
index 3eea449d2182e2ffc50bd30bc18b8b11d2099a9d..44888b2b12ec7e0bbba61b6dbc0acda5f3318662 100644 (file)
@@ -26,8 +26,13 @@ import com.intellij.ide.DeleteProvider;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.PlatformDataKeys;
+import com.intellij.openapi.util.IconLoader;
 
 public class DeleteUnversionedFilesAction extends AnAction {
+  public DeleteUnversionedFilesAction() {
+    super("Delete", "Delete", IconLoader.getIcon("/actions/cancel.png"));
+  }
+
   public void actionPerformed(AnActionEvent e) {
     DeleteProvider deleteProvider = e.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
     assert deleteProvider != null;
index 1c3515d6f70ac23c5113ff29afac9f6b16a7a69e..07e187ddf113eefdee6b3ae4904ee3c988715445 100644 (file)
@@ -60,18 +60,10 @@ public class SvnCheckoutProvider implements CheckoutProvider {
       target.mkdirs();
     }
     final SVNException[] exception = new SVNException[1];
-    final Ref<Boolean> actionStarted = new Ref<Boolean>(Boolean.TRUE);
 
     final Task.Backgroundable checkoutBackgroundTask = new Task.Backgroundable(project,
                      SvnBundle.message("message.title.check.out"), true, VcsConfiguration.getInstance(project).getCheckoutOption()) {
       public void run(@NotNull final ProgressIndicator indicator) {
-        // allow to select working copy format
-        if (! promptForWCopyFormat(target, project)) {
-          // cancelled
-          actionStarted.set(Boolean.FALSE);
-          return;
-        }
-
         final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
         final SVNUpdateClient client = SvnVcs.getInstance(project).createUpdateClient();
         client.setEventHandler(new CheckoutEventHandler(SvnVcs.getInstance(project), false, progressIndicator));
@@ -99,9 +91,6 @@ public class SvnCheckoutProvider implements CheckoutProvider {
       }
 
       public void onSuccess() {
-        if (! Boolean.TRUE.equals(actionStarted.get())) {
-          return;
-        }
         if (exception[0] != null) {
           Messages.showErrorDialog(SvnBundle.message("message.text.cannot.checkout", exception[0].getMessage()), SvnBundle.message("message.title.check.out"));
         }
@@ -134,6 +123,12 @@ public class SvnCheckoutProvider implements CheckoutProvider {
       }
     };
 
+    // allow to select working copy format
+    if (! promptForWCopyFormat(target, project)) {
+      // cancelled
+      SvnWorkingCopyFormatHolder.setPresetFormat(null);
+      return;
+    }
     ProgressManager.getInstance().run(checkoutBackgroundTask);
   }