diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesPanel.java index fbb0dbb6e1c1..8f5050e88964 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesPanel.java @@ -224,8 +224,8 @@ public class CommittedChangesPanel extends JPanel implements DataProvider, Dispo myDisposed = true; } - public void passCachedListsToListener(final VcsConfigurationChangeListener.DetailedNotification notification, - final Project project, final VirtualFile root) { + public void passCachedListsToListener(@NotNull VcsConfigurationChangeListener.DetailedNotification notification, + @Nullable VirtualFile root) { final List resultList = new ArrayList<>(); myBrowser.reportLoadedLists(new CommittedChangeListsListener() { @Override @@ -241,7 +241,7 @@ public class CommittedChangesPanel extends JPanel implements DataProvider, Dispo @Override public void onAfterEndReport() { if (!resultList.isEmpty()) { - notification.execute(project, root, resultList); + notification.execute(myProject, root, resultList); } } }); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesViewManager.java index 56b958c0629c..cd3bd12f36eb 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesViewManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesViewManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.committed; import com.intellij.openapi.application.ApplicationManager; @@ -18,6 +18,9 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.List; +import static com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener.BRANCHES_CHANGED; +import static com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener.BRANCHES_CHANGED_RESPONSE; + public class CommittedChangesViewManager implements ChangesViewContentProvider { private final MessageBus myBus; private MessageBusConnection myConnection; @@ -36,12 +39,7 @@ public class CommittedChangesViewManager implements ChangesViewContentProvider { if (myComponent == null) { myComponent = new CommittedChangesPanel(myProject, provider, provider.createDefaultSettings(), null, null); - myConnection.subscribe(VcsConfigurationChangeListener.BRANCHES_CHANGED, new VcsConfigurationChangeListener.Notification() { - @Override - public void execute(final Project project, final VirtualFile vcsRoot) { - sendUpdateCachedListsMessage(vcsRoot); - } - }); + myConnection.subscribe(BRANCHES_CHANGED, (project, vcsRoot) -> sendUpdateCachedListsMessage(vcsRoot)); } else { myComponent.setProvider(provider); @@ -50,10 +48,11 @@ public class CommittedChangesViewManager implements ChangesViewContentProvider { } } - private void sendUpdateCachedListsMessage(final VirtualFile vcsRoot) { + private void sendUpdateCachedListsMessage(@Nullable VirtualFile vcsRoot) { ApplicationManager.getApplication().invokeLater( - () -> myComponent.passCachedListsToListener(myBus.syncPublisher(VcsConfigurationChangeListener.BRANCHES_CHANGED_RESPONSE), - myProject, vcsRoot), o -> (! myProject.isOpen()) || myProject.isDisposed() || myComponent == null); + () -> myComponent.passCachedListsToListener(myBus.syncPublisher(BRANCHES_CHANGED_RESPONSE), vcsRoot), + o -> !myProject.isOpen() || myProject.isDisposed() || myComponent == null + ); } @Override diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/VcsConfigurationChangeListener.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/VcsConfigurationChangeListener.java index 98ed51a60989..df0c9b745f21 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/VcsConfigurationChangeListener.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/VcsConfigurationChangeListener.java @@ -1,24 +1,12 @@ -/* - * Copyright 2000-2009 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.committed; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.messages.Topic; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; @@ -27,10 +15,10 @@ public interface VcsConfigurationChangeListener { Topic BRANCHES_CHANGED_RESPONSE = new Topic<>("branch mapping changed (detailed)", DetailedNotification.class); interface Notification { - void execute(final Project project, final VirtualFile vcsRoot); + void execute(@NotNull Project project, @NotNull VirtualFile vcsRoot); } interface DetailedNotification { - void execute(final Project project, final VirtualFile vcsRoot, final List cachedList); + void execute(@NotNull Project project, @Nullable VirtualFile vcsRoot, @NotNull List cachedList); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfigurationManager.kt b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfigurationManager.kt index ebbc744998b8..95fea939af04 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfigurationManager.kt +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfigurationManager.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.branchConfig @@ -10,7 +10,7 @@ import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.progress.util.BackgroundTaskUtil.syncPublisher import com.intellij.openapi.project.Project import com.intellij.openapi.vcs.ProjectLevelVcsManager -import com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener +import com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener.BRANCHES_CHANGED import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl import com.intellij.openapi.vcs.impl.VcsInitObject import com.intellij.openapi.vfs.LocalFileSystem @@ -65,8 +65,7 @@ class SvnBranchConfigurationManager(private val myProject: Project, svnBranchConfigManager.updateForRoot(vcsRoot, InfoStorage(configuration, InfoReliability.setByUser), true) SvnBranchMapperManager.getInstance().notifyBranchesChanged(myProject, vcsRoot, configuration) - syncPublisher(myProject, VcsConfigurationChangeListener.BRANCHES_CHANGED).execute( - myProject, vcsRoot) + syncPublisher(myProject, BRANCHES_CHANGED).execute(myProject, vcsRoot) } override fun getState(): ConfigurationBean = ConfigurationBean().apply { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeInfoUpdatesListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeInfoUpdatesListener.java index 40787ecde115..53eb201993fa 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeInfoUpdatesListener.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeInfoUpdatesListener.java @@ -1,11 +1,10 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.history; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.ZipperUpdater; import com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser; -import com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener; import com.intellij.util.Consumer; import com.intellij.util.messages.MessageBusConnection; import org.jetbrains.annotations.NotNull; @@ -17,6 +16,7 @@ import java.util.ArrayList; import java.util.List; import static com.intellij.openapi.vcs.ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED; +import static com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener.BRANCHES_CHANGED; public class MergeInfoUpdatesListener { private final static int DELAY = 300; @@ -37,7 +37,7 @@ public class MergeInfoUpdatesListener { myMergeInfoRefreshActions = new ArrayList<>(); myMergeInfoRefreshActions.add(action); - myConnection.subscribe(VcsConfigurationChangeListener.BRANCHES_CHANGED, (project, vcsRoot) -> callReloadMergeInfo()); + myConnection.subscribe(BRANCHES_CHANGED, (project, vcsRoot) -> callReloadMergeInfo()); final Consumer reloadConsumer = aBoolean -> { if (Boolean.TRUE.equals(aBoolean)) { callReloadMergeInfo(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java index 06571c2b93eb..23a943c7ee95 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java @@ -12,7 +12,6 @@ import com.intellij.openapi.vcs.*; import com.intellij.openapi.vcs.changes.committed.DecoratorManager; import com.intellij.openapi.vcs.changes.committed.VcsCommittedListsZipper; import com.intellij.openapi.vcs.changes.committed.VcsCommittedViewAuxiliary; -import com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings; import com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor; @@ -45,6 +44,7 @@ import java.util.*; import static com.intellij.openapi.application.ApplicationManager.getApplication; import static com.intellij.openapi.progress.ProgressManager.progress; import static com.intellij.openapi.progress.ProgressManager.progress2; +import static com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener.BRANCHES_CHANGED_RESPONSE; import static java.util.Collections.singletonList; import static org.jetbrains.idea.svn.SvnBundle.message; @@ -65,7 +65,7 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi myZipper = new SvnCommittedListsZipper(myVcs); myConnection = myVcs.getProject().getMessageBus().connect(); - myConnection.subscribe(VcsConfigurationChangeListener.BRANCHES_CHANGED_RESPONSE, + myConnection.subscribe(BRANCHES_CHANGED_RESPONSE, (project, vcsRoot, cachedList) -> getApplication().invokeLater(() -> { cachedList.stream().filter(SvnChangeList.class::isInstance).map(SvnChangeList.class::cast) .filter(list -> vcsRoot == null || vcsRoot.equals(list.getVcsRoot()))