mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: Replace "DeleteUnversionedFilesAction" with common "DeleteAction"
This commit is contained in:
@@ -123,7 +123,7 @@
|
||||
<reference ref="Diff.ShowDiff"/>
|
||||
<reference ref="EditSource"/>
|
||||
<separator/>
|
||||
<action id="ChangesView.DeleteUnversioned" class="com.intellij.openapi.vcs.changes.actions.DeleteUnversionedFilesAction"/>
|
||||
<action id="ChangesView.DeleteUnversioned" class="com.intellij.ide.actions.DeleteAction" icon="AllIcons.General.Remove"/>
|
||||
<action id="ChangesView.AddUnversioned" class="com.intellij.openapi.vcs.changes.actions.ScheduleForAdditionAction">
|
||||
<keyboard-shortcut first-keystroke="control alt A" keymap="$default"/>
|
||||
</action>
|
||||
|
||||
-41
@@ -1,41 +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.
|
||||
*/
|
||||
|
||||
package com.intellij.openapi.vcs.changes.actions;
|
||||
|
||||
import com.intellij.ide.DeleteProvider;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.util.IconUtil;
|
||||
|
||||
public class DeleteUnversionedFilesAction extends DumbAwareAction {
|
||||
public DeleteUnversionedFilesAction() {
|
||||
super("Delete", "Delete", IconUtil.getRemoveIcon());
|
||||
}
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
DeleteProvider deleteProvider = e.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
|
||||
if (deleteProvider == null) return;
|
||||
deleteProvider.deleteElement(e.getDataContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
DeleteProvider deleteProvider = e.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
|
||||
e.getPresentation().setEnabled(deleteProvider != null && deleteProvider.canDeleteElement(e.getDataContext()));
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,16 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// 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.ui;
|
||||
|
||||
import com.intellij.ide.DeleteProvider;
|
||||
import com.intellij.ide.actions.DeleteAction;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.fileChooser.actions.VirtualFileDeleteProvider;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.VcsShowConfirmationOption;
|
||||
import com.intellij.openapi.vcs.changes.actions.DeleteUnversionedFilesAction;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -31,6 +18,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.actionSystem.EmptyAction.setupAction;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
@@ -105,15 +94,15 @@ public class SelectFilesDialog extends AbstractSelectFilesDialog {
|
||||
protected DefaultActionGroup createToolbarActions() {
|
||||
DefaultActionGroup defaultGroup = super.createToolbarActions();
|
||||
if (myDeletableFiles) {
|
||||
AnAction deleteAction = new DeleteUnversionedFilesAction() {
|
||||
AnAction deleteAction = new DeleteAction(null, null, IconUtil.getRemoveIcon()) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
super.actionPerformed(e);
|
||||
myFileList.refresh();
|
||||
}
|
||||
};
|
||||
setupAction(deleteAction, IdeActions.ACTION_DELETE, getFileList());
|
||||
defaultGroup.add(deleteAction);
|
||||
deleteAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), this.getFileList());
|
||||
}
|
||||
return defaultGroup;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user