mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: calculate diff synchronously in color settings
this should fix blinking DiffColorSettingsTest
This commit is contained in:
@@ -31,8 +31,8 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
@@ -141,10 +141,7 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
|
||||
fireEvent(EventType.BEFORE_REDIFF);
|
||||
onBeforeRediff();
|
||||
|
||||
// most of performRediff implementations take ReadLock inside. If EDT is holding write lock - this will never happen,
|
||||
// and diff will not be calculated. This could happen for diff from FileDocumentManager.
|
||||
boolean forceEDT = ApplicationManager.getApplication().isWriteAccessAllowed();
|
||||
|
||||
boolean forceEDT = forceRediffSynchronously();
|
||||
int waitMillis = trySync || tryRediffSynchronously() ? ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS : 0;
|
||||
|
||||
myTaskExecutor.executeAndTryWait(
|
||||
@@ -204,6 +201,13 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
|
||||
return myContext.isWindowFocused();
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
protected boolean forceRediffSynchronously() {
|
||||
// most of performRediff implementations take ReadLock inside. If EDT is holding write lock - this will never happen,
|
||||
// and diff will not be calculated. This could happen for diff from FileDocumentManager.
|
||||
return ApplicationManager.getApplication().isWriteAccessAllowed();
|
||||
}
|
||||
|
||||
protected List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
ContainerUtil.addAll(group, ((ActionGroup)ActionManager.getInstance().getAction(IdeActions.DIFF_VIEWER_TOOLBAR)).getChildren(null));
|
||||
|
||||
+6
-1
@@ -59,7 +59,12 @@ public class DiffPreviewPanel implements PreviewPanel {
|
||||
private final EventDispatcher<ColorAndFontSettingsListener> myDispatcher = EventDispatcher.create(ColorAndFontSettingsListener.class);
|
||||
|
||||
public DiffPreviewPanel(@NotNull Disposable parent) {
|
||||
myViewer = new SimpleThreesideDiffViewer(new SampleContext(), new SampleRequest());
|
||||
myViewer = new SimpleThreesideDiffViewer(new SampleContext(), new SampleRequest()) {
|
||||
@Override
|
||||
protected boolean forceRediffSynchronously() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
myViewer.init();
|
||||
Disposer.register(parent, myViewer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user