mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SVN 1.7: old -> new: IDEA-53015 Ask for subversion credentials right away!
This commit is contained in:
@@ -18,7 +18,9 @@ package org.jetbrains.idea.svn17;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
@@ -95,7 +97,7 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica
|
||||
|
||||
final Ref<Boolean> resultRef = new Ref<Boolean>();
|
||||
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
final Runnable checker = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -106,11 +108,20 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica
|
||||
if (result) {
|
||||
onStateChangedToSuccess(obj);
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
myVerificationInProgress = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
final ApplicationEx application = (ApplicationEx)ApplicationManager.getApplication();
|
||||
// also do not show auth if thread does not have progress indicator
|
||||
if (application.holdsReadLock() || application.isDispatchThread() || ! ProgressManager.getInstance().hasProgressIndicator()) {
|
||||
application.executeOnPooledThread(checker);
|
||||
} else {
|
||||
checker.run();
|
||||
return resultRef.get();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -164,6 +175,15 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica
|
||||
return super.ensureNotify(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onFirstNotification(AuthenticationRequest obj) {
|
||||
if (ProgressManager.getInstance().hasProgressIndicator()) {
|
||||
return ask(obj, null);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public SVNURL getKey(final AuthenticationRequest obj) {
|
||||
|
||||
@@ -265,7 +265,7 @@ public class SvnConfiguration17 implements PersistentStateComponent<Element> {
|
||||
myAuthManager = new SvnAuthenticationManager(myProject, new File(getConfigurationDirectory()));
|
||||
getInteractiveManager(svnVcs);
|
||||
// to init
|
||||
myAuthManager.setAuthenticationProvider(new SvnAuthenticationProvider(svnVcs, myInteractiveProvider));
|
||||
myAuthManager.setAuthenticationProvider(new SvnAuthenticationProvider(svnVcs, myInteractiveProvider, RUNTIME_AUTH_CACHE));
|
||||
myAuthManager.setRuntimeStorage(RUNTIME_AUTH_CACHE);
|
||||
}
|
||||
return myAuthManager;
|
||||
|
||||
+8
-2
@@ -27,6 +27,7 @@ import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
|
||||
import org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider;
|
||||
import org.tmatesoft.svn.core.auth.SVNAuthentication;
|
||||
import org.tmatesoft.svn.core.auth.SVNUserNameAuthentication;
|
||||
import org.tmatesoft.svn.core.internal.wc.ISVNAuthenticationStorage;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -39,9 +40,12 @@ public class SvnAuthenticationProvider implements ISVNAuthenticationProvider {
|
||||
private final Project myProject;
|
||||
private final SvnAuthenticationNotifier myAuthenticationNotifier;
|
||||
private final ISVNAuthenticationProvider mySvnInteractiveAuthenticationProvider;
|
||||
private final ISVNAuthenticationStorage myAuthenticationStorage;
|
||||
private static final Set<Thread> ourForceInteractive = new HashSet<Thread>();
|
||||
|
||||
public SvnAuthenticationProvider(final SvnVcs17 svnVcs, final ISVNAuthenticationProvider provider) {
|
||||
public SvnAuthenticationProvider(final SvnVcs17 svnVcs, final ISVNAuthenticationProvider provider,
|
||||
final ISVNAuthenticationStorage authenticationStorage) {
|
||||
myAuthenticationStorage = authenticationStorage;
|
||||
myProject = svnVcs.getProject();
|
||||
myAuthenticationNotifier = svnVcs.getAuthNotifier();
|
||||
mySvnInteractiveAuthenticationProvider = provider;
|
||||
@@ -68,7 +72,9 @@ public class SvnAuthenticationProvider implements ISVNAuthenticationProvider {
|
||||
// outside-project url
|
||||
return mySvnInteractiveAuthenticationProvider.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
|
||||
} else {
|
||||
myAuthenticationNotifier.ensureNotify(obj);
|
||||
if (myAuthenticationNotifier.ensureNotify(obj)) {
|
||||
return (SVNAuthentication) myAuthenticationStorage.getData(kind, realm);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class SvnAuthenticationTest extends PlatformTestCase {
|
||||
myAuthenticationManager = new SvnAuthenticationManager(myProject, configFile);
|
||||
|
||||
myInteractiveProvider = new SvnTestInteractiveAuthentication(myAuthenticationManager);
|
||||
myAuthenticationManager.setAuthenticationProvider(new SvnAuthenticationProvider(vcs, myInteractiveProvider));
|
||||
myAuthenticationManager.setAuthenticationProvider(new SvnAuthenticationProvider(vcs, myInteractiveProvider, SvnConfiguration17.RUNTIME_AUTH_CACHE));
|
||||
myAuthenticationManager.setRuntimeStorage(SvnConfiguration17.RUNTIME_AUTH_CACHE);
|
||||
|
||||
myTestInteraction = new TestInteraction();
|
||||
|
||||
Reference in New Issue
Block a user