mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff viewer: allow passing custom DirDiffSettings
This is needed for example to disable file choosers in a particular DiffRequestPanel.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ide.diff;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PatternUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -30,6 +31,8 @@ import java.util.regex.Pattern;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class DirDiffSettings {
|
||||
public static final Key<DirDiffSettings> KEY = Key.create("Diff.DirDiffSettings");
|
||||
|
||||
public boolean showSize = true;
|
||||
public boolean showDate = true;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.intellij.openapi.diff.impl.dir.DirDiffWindow;
|
||||
import com.intellij.openapi.project.DefaultProjectFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -69,7 +70,8 @@ class DirDiffViewer implements FrameDiffTool.DiffViewer {
|
||||
Project project = context.getProject();
|
||||
if (project == null) project = DefaultProjectFactory.getInstance().getDefaultProject();
|
||||
|
||||
DirDiffTableModel model = new DirDiffTableModel(project, element1, element2, new DirDiffSettings());
|
||||
DirDiffSettings settings = ObjectUtils.notNull(context.getUserData(DirDiffSettings.KEY), new DirDiffSettings());
|
||||
DirDiffTableModel model = new DirDiffTableModel(project, element1, element2, settings);
|
||||
|
||||
myDirDiffPanel = new DirDiffPanel(model, new DirDiffWindow((DirDiffFrame)null) {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user