Real refresh progress not needed in tests

This commit is contained in:
Roman Shevchenko
2013-07-16 14:49:15 +02:00
parent 8ad899774b
commit 258f7450cc
2 changed files with 18 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -15,12 +15,16 @@
*/
package com.intellij.openapi.vfs.newvfs;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.progress.EmptyProgressIndicator;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.ex.StatusBarEx;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -28,9 +32,20 @@ import javax.swing.*;
* @author max
*/
public class RefreshProgress extends ProgressIndicatorBase {
@NotNull
public static ProgressIndicator create(@NotNull String message) {
Application app = ApplicationManager.getApplication();
if (app == null || app.isUnitTestMode()) {
return new EmptyProgressIndicator();
}
else {
return new RefreshProgress(message);
}
}
private final String myMessage;
public RefreshProgress(final String message) {
private RefreshProgress(@NotNull String message) {
myMessage = message;
}
@@ -59,7 +74,6 @@ public class RefreshProgress extends ProgressIndicatorBase {
}
}
});
}
@Override

View File

@@ -40,7 +40,7 @@ public class RefreshQueueImpl extends RefreshQueue {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vfs.newvfs.RefreshQueueImpl");
private final ExecutorService myQueue = ConcurrencyUtil.newSingleThreadExecutor("FS Synchronizer");
private final ProgressIndicator myRefreshIndicator = new RefreshProgress(VfsBundle.message("file.synchronize.progress"));
private final ProgressIndicator myRefreshIndicator = RefreshProgress.create(VfsBundle.message("file.synchronize.progress"));
private final TLongObjectHashMap<RefreshSession> mySessions = new TLongObjectHashMap<RefreshSession>();
public void execute(@NotNull RefreshSessionImpl session) {