From b11e14ce5a080fa6ab969ab83d56e47072f4094a Mon Sep 17 00:00:00 2001 From: irengrig Date: Tue, 3 Apr 2012 17:45:02 +0400 Subject: [PATCH] IDEA-83509 IntelliJ does not respond when comparing svn revision without connection --- .../jetbrains/idea/svn/SvnBundle.properties | 1 + .../SvnLazyPropertyContentRevision.java | 37 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties index 77dccb5ac9af..e113fad95cc5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties @@ -220,6 +220,7 @@ label.working.copy.root.outside.text=Working copy root is outside the directory progress.text.loading.contents=Loading contents of ''{0}'' progress.text2.revision.information=Revision {0} progress.title.loading.file.content=Loading Remote File Content +progress.title.loading.file.properties=Loading Remote File Properties exception.text.file.miss.svn=File ''{0}'' is readonly, but miss svn:needs-lock property confirmation.text.edit.file=File(s) you're are going to edit needs to be locked before editing diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java index 4806ac16747f..141858d4d11b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java @@ -15,12 +15,17 @@ */ package org.jetbrains.idea.svn.history; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Computable; +import com.intellij.openapi.util.Ref; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.ContentRevision; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import org.jetbrains.annotations.NotNull; +import org.jetbrains.idea.svn.SvnBundle; import org.jetbrains.idea.svn.SvnRevisionNumber; import org.jetbrains.idea.svn.SvnVcs; import org.jetbrains.idea.svn.actions.AbstractShowPropertiesDiffAction; @@ -59,18 +64,30 @@ public class SvnLazyPropertyContentRevision implements ContentRevision { private String loadContent() { final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient client = vcs.createWCClient(); - String list; - try { - list = AbstractShowPropertiesDiffAction.getPropertyList(myUrl, ((SvnRevisionNumber) myNumber).getRevision(), client); + final Ref ref = new Ref(); + final Runnable runnable = new Runnable() { + @Override + public void run() { + try { + ref.set(AbstractShowPropertiesDiffAction.getPropertyList(myUrl, ((SvnRevisionNumber) myNumber).getRevision(), client)); + } + catch (SVNException e) { + // unknown node kind (node deleted) + /*if (e.getErrorMessage().getErrorCode().getCode() == 145000) { + return ""; + }*/ + ref.set("Can not get properties: " + e.getMessage()); + } + } + }; + if (ApplicationManager.getApplication().isDispatchThread()) { + ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, SvnBundle.message("progress.title.loading.file.properties"), + false, myProject); } - catch (SVNException e) { - // unknown node kind (node deleted) - /*if (e.getErrorMessage().getErrorCode().getCode() == 145000) { - return ""; - }*/ - list = "Can not get properties: " + e.getMessage(); + else { + runnable.run(); } - return list; + return ref.get(); } @NotNull