Git: no sence in getting component under read action

(cherry picked from commit 13f18862574b393492bd68c3872ac9f0ef8f8a37)
This commit is contained in:
irengrig
2010-07-14 16:17:04 +04:00
parent 20ca7667b2
commit 14b675c324
2 changed files with 1 additions and 19 deletions
@@ -152,7 +152,7 @@ public abstract class GitHandler {
protected GitHandler(@NotNull Project project, @NotNull File directory, @NotNull GitCommand command) {
myProject = project;
myCommand = command;
mySettings = GitVcsSettings.getInstanceChecked(project);
mySettings = GitVcsSettings.getInstance(project);
myEnv = new HashMap<String, String>(System.getenv());
if (!myEnv.containsKey("HOME")) {
String home = System.getProperty("user.home");
@@ -15,14 +15,11 @@
*/
package git4idea.config;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
@@ -281,21 +278,6 @@ public class GitVcsSettings implements PersistentStateComponent<GitVcsSettings.S
return ServiceManager.getService(project, GitVcsSettings.class);
}
/**
* Get instance with checked read action
*
* @param project the project to get setting for
* @return the settings object
*/
public static GitVcsSettings getInstanceChecked(final Project project) {
return ApplicationManager.getApplication().runReadAction(new Computable<GitVcsSettings>() {
public GitVcsSettings compute() {
if (project.isDisposed()) throw new ProcessCanceledException();
return ServiceManager.getService(project, GitVcsSettings.class);
}
});
}
/**
* @return true if IDEA ssh should be used
*/