From 353a172abd6597c285adc19fc34cffed29037fae Mon Sep 17 00:00:00 2001 From: irengrig Date: Tue, 31 Aug 2010 17:38:40 +0400 Subject: [PATCH] VCS: remove duplicate commit action; always use action that will correctly look for any changed file if nothing is specially selected --- .../src/idea/VcsActions.xml | 2 +- .../vcs/changes/actions/CommitAction.java | 84 ------------------- 2 files changed, 1 insertion(+), 85 deletions(-) delete mode 100644 platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/CommitAction.java diff --git a/platform/platform-resources/src/idea/VcsActions.xml b/platform/platform-resources/src/idea/VcsActions.xml index 5056e12c0d45..dccf8f677f39 100644 --- a/platform/platform-resources/src/idea/VcsActions.xml +++ b/platform/platform-resources/src/idea/VcsActions.xml @@ -70,7 +70,7 @@ - diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/CommitAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/CommitAction.java deleted file mode 100644 index 37111b541722..000000000000 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/CommitAction.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2000-2009 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. - */ - -/* - * Created by IntelliJ IDEA. - * User: yole - * Date: 02.11.2006 - * Time: 21:53:06 - */ -package com.intellij.openapi.vcs.changes.actions; - -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.PlatformDataKeys; -import com.intellij.openapi.project.DumbAware; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.vcs.AbstractVcs; -import com.intellij.openapi.vcs.ProjectLevelVcsManager; -import com.intellij.openapi.vcs.VcsBundle; -import com.intellij.openapi.vcs.VcsDataKeys; -import com.intellij.openapi.vcs.changes.*; -import com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog; - -import java.util.Arrays; -import java.util.List; - -public class CommitAction extends AnAction implements DumbAware { - public void update(AnActionEvent e) { - Project project = e.getData(PlatformDataKeys.PROJECT); - boolean enabled = false; - if (project != null) { - if (ProjectLevelVcsManager.getInstance(project).isBackgroundVcsOperationRunning()) { - e.getPresentation().setEnabled(false); - return; - } - Change[] changes = e.getData(VcsDataKeys.CHANGES); - - if (changes != null && ChangesUtil.allChangesInOneList(project, changes)) { - for(Change c: changes) { - final AbstractVcs vcs = ChangesUtil.getVcsForChange(c, project); - if (vcs != null && vcs.getCheckinEnvironment() != null) { - enabled = true; - break; - } - } - } - } - e.getPresentation().setEnabled(enabled); - } - - public void actionPerformed(AnActionEvent e) { - final Project project = e.getData(PlatformDataKeys.PROJECT); - if (project == null) return; - if (ProjectLevelVcsManager.getInstance(project).isBackgroundVcsOperationRunning()) { - return; - } - - final Change[] changes = e.getData(VcsDataKeys.CHANGES); - final ChangeList list = ChangesUtil.getChangeListIfOnlyOne(project, changes); - if ((list == null) || (! (list instanceof LocalChangeList))) return; - - ChangeListManager.getInstance(project).invokeAfterUpdate(new Runnable() { - public void run() { - final List changesList = Arrays.asList(changes); - final List executors = CommitChangeListDialog.collectExecutors(project, changesList); - CommitChangeListDialog.commitChanges(project, changesList, (LocalChangeList) list, - executors, true, null); - } - }, InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, VcsBundle.message("waiting.changelists.update.for.show.commit.dialog.message"), null); - } -} \ No newline at end of file