vcs: Replace "ChangesView.DeleteUnversioned" action with common "$Delete" action

This commit is contained in:
Konstantin Kolosovsky
2018-07-24 18:46:02 +03:00
parent 7627ae197b
commit c4f3bd954f
5 changed files with 13 additions and 30 deletions
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 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.
*/
// Copyright 2000-2018 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.ide.actions;
import com.intellij.ide.DeleteProvider;
@@ -23,6 +9,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.util.IconUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -66,6 +53,9 @@ public class DeleteAction extends AnAction implements DumbAware {
else {
presentation.setText(IdeBundle.message("action.delete"));
}
if (e.isFromActionToolbar() && e.getPresentation().getIcon() == null) {
e.getPresentation().setIcon(IconUtil.getRemoveIcon());
}
if (e.getProject() == null) {
presentation.setEnabled(false);
@@ -1288,8 +1288,6 @@ action.ChangesView.Move.text=Move to Another Changelist...
action.ChangesView.Move.description=Move selected changes to another changelist
action.ChangesView.Diff.text=Show Diff
action.ChangesView.Diff.description=Compare files or revisions
action.ChangesView.DeleteUnversioned.text=Delete...
action.ChangesView.DeleteUnversioned.description=
action.ChangesView.AddUnversioned.text=Add to VCS
action.ChangesView.AddUnversioned.description=Schedule selected files to be added to VCS
action.ChangesView.RemoveDeleted.text=Remove from VCS
@@ -123,7 +123,7 @@
<reference ref="Diff.ShowDiff"/>
<reference ref="EditSource"/>
<separator/>
<action id="ChangesView.DeleteUnversioned" class="com.intellij.ide.actions.DeleteAction" icon="AllIcons.General.Remove"/>
<reference ref="$Delete"/>
<action id="ChangesView.AddUnversioned" class="com.intellij.openapi.vcs.changes.actions.ScheduleForAdditionAction">
<keyboard-shortcut first-keystroke="control alt A" keymap="$default"/>
</action>
@@ -147,12 +147,12 @@
<group id="Unversioned.Files.Dialog">
<reference ref="ChangesView.AddUnversioned"/>
<reference ref="ChangesView.DeleteUnversioned"/>
<reference ref="$Delete"/>
</group>
<group id="Unversioned.Files.Dialog.Popup">
<reference ref="ChangesView.AddUnversioned"/>
<reference ref="ChangesView.Move"/>
<reference ref="ChangesView.DeleteUnversioned"/>
<reference ref="$Delete"/>
<reference ref="ChangesView.Ignore"/>
</group>
@@ -409,7 +409,7 @@
<reference ref="ChangesView.SetDefault"/>
<reference ref="ChangesView.Move"/>
<reference ref="Diff.ShowDiff"/>
<reference ref="ChangesView.DeleteUnversioned"/>
<reference ref="$Delete"/>
<reference ref="ChangesView.AddUnversioned"/>
<reference ref="ChangesView.Ignore"/>
<reference ref="ChangesView.RemoveDeleted"/>
@@ -1,10 +1,10 @@
// Copyright 2000-2018 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.openapi.vcs.changes;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.EmptyAction;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.ui.ChangesListView;
import com.intellij.openapi.vfs.VirtualFile;
@@ -20,8 +20,8 @@ public class IgnoredViewDialog extends SpecificFilesViewDialog {
@Override
protected void addCustomActions(@NotNull DefaultActionGroup group) {
AnAction deleteAction =
EmptyAction.registerWithShortcutSet("ChangesView.DeleteUnversioned", CommonShortcuts.getDelete(), myView);
AnAction deleteAction = ActionManager.getInstance().getAction(IdeActions.ACTION_DELETE);
deleteAction.registerCustomShortcutSet(myView, null);
group.add(deleteAction);
myView.installPopupHandler(new DefaultActionGroup(deleteAction));
}
@@ -3,7 +3,6 @@ package com.intellij.openapi.vcs.changes;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.ui.ChangesListView;
@@ -13,7 +12,6 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import static com.intellij.openapi.actionSystem.EmptyAction.registerWithShortcutSet;
import static com.intellij.openapi.actionSystem.ex.ActionUtil.recursiveRegisterShortcutSet;
public class UnversionedViewDialog extends SpecificFilesViewDialog {
@@ -44,10 +42,7 @@ public class UnversionedViewDialog extends SpecificFilesViewDialog {
@NotNull
public static ActionGroup registerUnversionedPopupGroup(@NotNull JComponent component) {
ActionGroup popupGroup = getUnversionedPopupGroup();
recursiveRegisterShortcutSet(popupGroup, component, null);
registerWithShortcutSet("ChangesView.DeleteUnversioned", CommonShortcuts.getDelete(), component);
return popupGroup;
}