mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Use dispose-aware bg-aware syncPublisher in svn
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
package org.jetbrains.idea.svn;
|
||||
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
@@ -157,7 +158,7 @@ public class SvnConfiguration implements PersistentStateComponent<SvnConfigurati
|
||||
final boolean changed = myState.IGNORE_SPACES_IN_ANNOTATE != value;
|
||||
myState.IGNORE_SPACES_IN_ANNOTATE = value;
|
||||
if (changed) {
|
||||
getProject().getMessageBus().syncPublisher(VcsAnnotationRefresher.LOCAL_CHANGES_CHANGED).configurationChanged(SvnVcs.getKey());
|
||||
BackgroundTaskUtil.syncPublisher(getProject(), VcsAnnotationRefresher.LOCAL_CHANGES_CHANGED).configurationChanged(SvnVcs.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.jetbrains.idea.svn;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.changes.VcsAnnotationRefresher;
|
||||
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
|
||||
@@ -54,7 +55,7 @@ public class SvnEntriesFileListener implements VirtualFileListener {
|
||||
}
|
||||
|
||||
private void refreshAnnotationsUnder(VirtualFile parent) {
|
||||
myProject.getMessageBus().syncPublisher(VcsAnnotationRefresher.LOCAL_CHANGES_CHANGED).dirtyUnder(parent);
|
||||
BackgroundTaskUtil.syncPublisher(myProject, VcsAnnotationRefresher.LOCAL_CHANGES_CHANGED).dirtyUnder(parent);
|
||||
}
|
||||
|
||||
public void contentsChanged(@NotNull VirtualFileEvent event) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.DumbAwareRunnable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -28,7 +29,6 @@ import com.intellij.openapi.vcs.impl.VcsInitObject;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.svn.info.Info;
|
||||
@@ -284,14 +284,13 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
|
||||
}
|
||||
|
||||
private void notifyRootsReloaded(boolean mappingsChanged) {
|
||||
final MessageBus bus = myProject.getMessageBus();
|
||||
if (mappingsChanged || ! myInitedReloaded) {
|
||||
myInitedReloaded = true;
|
||||
// all listeners are asynchronous
|
||||
bus.syncPublisher(SvnVcs.ROOTS_RELOADED).consume(true);
|
||||
bus.syncPublisher(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN).directoryMappingChanged();
|
||||
BackgroundTaskUtil.syncPublisher(myProject, SvnVcs.ROOTS_RELOADED).consume(true);
|
||||
BackgroundTaskUtil.syncPublisher(myProject, ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN).directoryMappingChanged();
|
||||
} else {
|
||||
bus.syncPublisher(SvnVcs.ROOTS_RELOADED).consume(false);
|
||||
BackgroundTaskUtil.syncPublisher(myProject, SvnVcs.ROOTS_RELOADED).consume(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
@@ -185,10 +186,8 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager
|
||||
SVNAuthentication previousAuth, boolean authMayBeStored) {
|
||||
final SVNAuthentication authentication =
|
||||
myDelegate.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
|
||||
if (myProject != null && !myProject.isDisposed()) {
|
||||
myProject.getMessageBus().syncPublisher(AUTHENTICATION_PROVIDER_LISTENER)
|
||||
.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored, authentication);
|
||||
}
|
||||
BackgroundTaskUtil.syncPublisher(myProject, AUTHENTICATION_PROVIDER_LISTENER)
|
||||
.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored, authentication);
|
||||
return authentication;
|
||||
}
|
||||
|
||||
@@ -198,10 +197,8 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager
|
||||
Object certificate,
|
||||
boolean resultMayBeStored) {
|
||||
final int result = myDelegate.acceptServerAuthentication(url, realm, certificate, resultMayBeStored);
|
||||
if (myProject != null && !myProject.isDisposed()) {
|
||||
myProject.getMessageBus().syncPublisher(AUTHENTICATION_PROVIDER_LISTENER)
|
||||
.acceptServerAuthentication(url, realm, certificate, resultMayBeStored, result);
|
||||
}
|
||||
BackgroundTaskUtil.syncPublisher(myProject, AUTHENTICATION_PROVIDER_LISTENER)
|
||||
.acceptServerAuthentication(url, realm, certificate, resultMayBeStored, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -22,6 +22,7 @@ import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
@@ -31,7 +32,6 @@ import com.intellij.openapi.vcs.impl.VcsInitObject;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.vcs.ProgressManagerQueue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.svn.SvnVcs;
|
||||
@@ -111,8 +111,7 @@ public class SvnBranchConfigurationManager implements PersistentStateComponent<S
|
||||
|
||||
SvnBranchMapperManager.getInstance().notifyBranchesChanged(myProject, vcsRoot, configuration);
|
||||
|
||||
final MessageBus messageBus = myProject.getMessageBus();
|
||||
messageBus.syncPublisher(VcsConfigurationChangeListener.BRANCHES_CHANGED).execute(myProject, vcsRoot);
|
||||
BackgroundTaskUtil.syncPublisher(myProject, VcsConfigurationChangeListener.BRANCHES_CHANGED).execute(myProject, vcsRoot);
|
||||
}
|
||||
|
||||
public ConfigurationBean getState() {
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.FileIndexFacade;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
@@ -302,7 +303,7 @@ public class SvnCheckoutProvider implements CheckoutProvider {
|
||||
|
||||
final WorkingCopyFormat result = displayUpgradeDialog();
|
||||
|
||||
getApplication().getMessageBus().syncPublisher(SvnVcs.WC_CONVERTED).run();
|
||||
BackgroundTaskUtil.syncPublisher(SvnVcs.WC_CONVERTED).run();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.jetbrains.idea.svn.dialogs;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.AbstractVcsHelper;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
@@ -127,7 +127,7 @@ public class SvnFormatWorker extends Task.Backgroundable {
|
||||
SvnVcs.getInstance(myProject).processChangeLists(myBeforeChangeLists);
|
||||
}
|
||||
|
||||
ApplicationManager.getApplication().getMessageBus().syncPublisher(SvnVcs.WC_CONVERTED).run();
|
||||
BackgroundTaskUtil.syncPublisher(SvnVcs.WC_CONVERTED).run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MultiLineLabelUI;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
@@ -271,8 +272,7 @@ public class RootsAndBranches implements CommittedChangeListDecorator {
|
||||
myDataLoader.reloadInfo(wcInfoWithBranches);
|
||||
if (newInfo == null) {
|
||||
// reload all items
|
||||
myProject.getMessageBus()
|
||||
.syncPublisher(SvnVcs.WC_CONVERTED).run();
|
||||
BackgroundTaskUtil.syncPublisher(myProject, SvnVcs.WC_CONVERTED).run();
|
||||
// do not reload right now
|
||||
return wcInfoWithBranches;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.jetbrains.idea.svn.integrate;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
|
||||
@@ -223,7 +224,7 @@ public class Merger implements IMerger {
|
||||
? ContainerUtil.newArrayList(myMergeChunk.chunkAndBeforeLists())
|
||||
: ContainerUtil.emptyList();
|
||||
|
||||
myProject.getMessageBus().syncPublisher(COMMITTED_CHANGES_MERGED_STATE).event(processed);
|
||||
BackgroundTaskUtil.syncPublisher(myProject, COMMITTED_CHANGES_MERGED_STATE).event(processed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
@@ -142,8 +143,8 @@ public class SvnMergeInfoCache {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (!vcs.getProject().isDisposed() && myData != null && myData.getCopySourceRevision() != -1) {
|
||||
vcs.getProject().getMessageBus().syncPublisher(SVN_MERGE_INFO_CACHE).copyRevisionUpdated();
|
||||
if (myData != null && myData.getCopySourceRevision() != -1) {
|
||||
BackgroundTaskUtil.syncPublisher(vcs.getProject(), SVN_MERGE_INFO_CACHE).copyRevisionUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user