vcs: extract common method for checking if diff preview should open in editor tab

GitOrigin-RevId: 21a118e33dee3b434cc63c360389b1b25701eb75
This commit is contained in:
Dmitry Zhuravlev
2020-02-21 17:31:28 +00:00
committed by intellij-monorepo-bot
parent 2934d61e3d
commit 5cf03f36fe
3 changed files with 8 additions and 7 deletions
@@ -5,7 +5,6 @@ import com.google.common.util.concurrent.SettableFuture;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Conditions;
import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.history.VcsFileRevision;
import com.intellij.openapi.vfs.VirtualFile;
@@ -80,12 +79,10 @@ public class FileHistoryUi extends AbstractVcsLogUi {
}
};
boolean isDiffPreviewAsEditor = Registry.is("vcs.log.show.diff.preview.as.editor.tab");
myFilterUi = new FileHistoryFilterUi(path, revision, root, uiProperties);
myFileHistoryPanel = new FileHistoryPanel(this, myFileHistoryModel, logData, path, !isDiffPreviewAsEditor);
myFileHistoryPanel = new FileHistoryPanel(this, myFileHistoryModel, logData, path, !VcsLogUiUtil.isDiffPreviewInEditor());
if (isDiffPreviewAsEditor) {
if (VcsLogUiUtil.isDiffPreviewInEditor()) {
new FileHistoryEditorDiffPreview(logData.getProject(), myUiProperties, myFileHistoryPanel);
}
@@ -5,7 +5,6 @@ import com.google.common.util.concurrent.SettableFuture;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.NamedRunnable;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
import com.intellij.ui.navigation.History;
import com.intellij.util.Consumer;
@@ -74,7 +73,7 @@ public class VcsLogUiImpl extends AbstractVcsLogUi implements MainVcsLogUi {
@NotNull
protected MainFrame createMainFrame(@NotNull VcsLogData logData,
@NotNull MainVcsLogUiProperties uiProperties, @NotNull VcsLogFilterUiEx filterUi) {
boolean isDiffPreviewAsEditor = Registry.is("vcs.log.show.diff.preview.as.editor.tab");
boolean isDiffPreviewAsEditor = VcsLogUiUtil.isDiffPreviewInEditor();
MainFrame mainFrame = new MainFrame(logData, this, uiProperties, filterUi, !isDiffPreviewAsEditor);
if (isDiffPreviewAsEditor) {
new VcsLogEditorDiffPreview(myProject, myUiProperties, mainFrame);
@@ -11,6 +11,7 @@ import com.intellij.openapi.progress.util.ProgressWindow;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.*;
import com.intellij.ui.components.panels.Wrapper;
@@ -173,6 +174,10 @@ public class VcsLogUiUtil {
appendActionToEmptyText(emptyText, VcsLogBundle.message("vcs.log.action.reset.filters"), () -> filterUi.setFilter(null));
}
public static boolean isDiffPreviewInEditor() {
return Registry.is("vcs.log.show.diff.preview.as.editor.tab");
}
private static class VcsLogPlaceNavigator implements Place.Navigator {
@NonNls private static final String PLACE_KEY = "Vcs.Log.Ui.History.PlaceKey";
@NotNull private final VcsLogUiEx myUi;