mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] move log ui creation to VcsLogContentProvider
When addLogUi is called, we already know that log manager exists, so it can be passed to the method as a parameter. This way we are getting rid of getValue call that creates a new log manager when it does not exist.
This commit is contained in:
@@ -33,6 +33,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.vcs.log.ui.AbstractVcsLogUi;
|
||||
import com.intellij.vcs.log.ui.VcsLogPanel;
|
||||
import com.intellij.vcs.log.ui.VcsLogUiImpl;
|
||||
import org.jetbrains.annotations.CalledInAwt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -61,7 +62,7 @@ public class VcsLogContentProvider implements ChangesViewContentProvider {
|
||||
connection.subscribe(VcsProjectLog.VCS_PROJECT_LOG_CHANGED, new VcsProjectLog.ProjectLogListener() {
|
||||
@Override
|
||||
public void logCreated(@NotNull VcsLogManager logManager) {
|
||||
addLogUi();
|
||||
addLogUi(logManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,14 +72,17 @@ public class VcsLogContentProvider implements ChangesViewContentProvider {
|
||||
}
|
||||
});
|
||||
|
||||
if (myProjectLog.getLogManager() != null) {
|
||||
addLogUi();
|
||||
VcsLogManager manager = myProjectLog.getLogManager();
|
||||
if (manager != null) {
|
||||
addLogUi(manager);
|
||||
}
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
private void addLogUi() {
|
||||
myContainer.add(myProjectLog.initMainLog(TAB_NAME), BorderLayout.CENTER);
|
||||
private void addLogUi(@NotNull VcsLogManager logManager) {
|
||||
VcsLogUiImpl ui = logManager.createLogUi(VcsLogTabsProperties.MAIN_LOG_ID, TAB_NAME);
|
||||
myProjectLog.setMainUi(ui);
|
||||
myContainer.add(new VcsLogPanel(logManager, ui), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,7 +94,7 @@ public class VcsLogContentProvider implements ChangesViewContentProvider {
|
||||
@Override
|
||||
public void disposeContent() {
|
||||
myContainer.removeAll();
|
||||
|
||||
|
||||
VcsLogManager logManager = myProjectLog.getLogManager();
|
||||
if (logManager != null) {
|
||||
closeLogTabs(logManager);
|
||||
|
||||
@@ -32,14 +32,12 @@ import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.messages.Topic;
|
||||
import com.intellij.vcs.log.data.VcsLogData;
|
||||
import com.intellij.vcs.log.ui.VcsLogPanel;
|
||||
import com.intellij.vcs.log.ui.VcsLogUiImpl;
|
||||
import org.jetbrains.annotations.CalledInAny;
|
||||
import org.jetbrains.annotations.CalledInAwt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -77,10 +75,8 @@ public class VcsProjectLog implements Disposable {
|
||||
return Arrays.asList(ProjectLevelVcsManager.getInstance(myProject).getAllVcsRoots());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JComponent initMainLog(@NotNull String contentTabName) {
|
||||
myUi = myLogManager.getValue().createLogUi(VcsLogTabsProperties.MAIN_LOG_ID, contentTabName);
|
||||
return new VcsLogPanel(myLogManager.getValue(), myUi);
|
||||
void setMainUi(@NotNull VcsLogUiImpl ui) {
|
||||
myUi = ui;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user