mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 09:03:31 +07:00
vcs: Implemented "Ignore..." action for unversioned files in commit dialog
This commit is contained in:
+9
-2
@@ -25,9 +25,9 @@ package com.intellij.openapi.vcs.changes.actions;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesBrowserBase;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesListView;
|
||||
import com.intellij.openapi.vcs.changes.ui.IgnoreUnversionedDialog;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -46,7 +46,14 @@ public class IgnoreUnversionedAction extends AnAction {
|
||||
removeNullFiles(files);
|
||||
if (files.isEmpty()) return;
|
||||
|
||||
IgnoreUnversionedDialog.ignoreSelectedFiles(project, files);
|
||||
ChangesBrowserBase<?> browser = e.getData(ChangesBrowserBase.DATA_KEY);
|
||||
Runnable callback = browser == null ? null : () -> {
|
||||
browser.rebuildList();
|
||||
//noinspection unchecked
|
||||
browser.getViewer().excludeChanges((List)files);
|
||||
};
|
||||
|
||||
IgnoreUnversionedDialog.ignoreSelectedFiles(project, files, callback);
|
||||
}
|
||||
|
||||
private static void removeNullFiles(List<VirtualFile> files) {
|
||||
|
||||
+1
-1
@@ -33,6 +33,6 @@ public class ChangesBrowserIgnoredFilesNode extends ChangesBrowserNode {
|
||||
|
||||
@Override
|
||||
public void acceptDrop(final ChangeListOwner dragOwner, final ChangeListDragBean dragBean) {
|
||||
IgnoreUnversionedDialog.ignoreSelectedFiles(dragOwner.getProject(), dragBean.getUnversionedFiles());
|
||||
IgnoreUnversionedDialog.ignoreSelectedFiles(dragOwner.getProject(), dragBean.getUnversionedFiles(), null);
|
||||
}
|
||||
}
|
||||
+13
-7
@@ -245,15 +245,21 @@ public class IgnoreUnversionedDialog extends DialogWrapper {
|
||||
return "IgnoreUnversionedDialog";
|
||||
}
|
||||
|
||||
public static void ignoreSelectedFiles(final Project project, final List<VirtualFile> files) {
|
||||
public static void ignoreSelectedFiles(@NotNull Project project, @NotNull List<VirtualFile> files, @Nullable Runnable callback) {
|
||||
IgnoreUnversionedDialog dlg = new IgnoreUnversionedDialog(project);
|
||||
dlg.setFilesToIgnore(files);
|
||||
if (!dlg.showAndGet()) {
|
||||
return;
|
||||
}
|
||||
final IgnoredFileBean[] ignoredFiles = dlg.getSelectedIgnoredFiles();
|
||||
if (ignoredFiles.length > 0) {
|
||||
ChangeListManager.getInstance(project).addFilesToIgnore(ignoredFiles);
|
||||
|
||||
if (dlg.showAndGet()) {
|
||||
IgnoredFileBean[] ignoredFiles = dlg.getSelectedIgnoredFiles();
|
||||
|
||||
if (ignoredFiles.length > 0) {
|
||||
ChangeListManager manager = ChangeListManager.getInstance(project);
|
||||
|
||||
manager.addFilesToIgnore(ignoredFiles);
|
||||
if (callback != null) {
|
||||
manager.invokeAfterUpdate(callback, InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, "Ignore unversioned files", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -310,6 +310,7 @@ public class MultipleChangeListBrowser extends ChangesBrowserBase<Object> {
|
||||
});
|
||||
if (Registry.is("vcs.unversioned.files.in.commit")) {
|
||||
toolBarGroup.add(ActionManager.getInstance().getAction("ChangesView.AddUnversioned.From.Dialog"));
|
||||
toolBarGroup.add(ActionManager.getInstance().getAction("ChangesView.Ignore"));
|
||||
}
|
||||
RollbackDialogAction rollback = new RollbackDialogAction();
|
||||
EmptyAction.setupAction(rollback, IdeActions.CHANGES_VIEW_ROLLBACK, this);
|
||||
|
||||
Reference in New Issue
Block a user