mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
svn: Utilized "changesViewContent" extension point (instead of duplicating similar logic) for registering and managing life cycle of "Subversion Working Copies Information" tab
This commit is contained in:
@@ -144,6 +144,9 @@
|
||||
|
||||
<statistics.usagesCollector implementation="org.jetbrains.idea.svn.statistics.SvnWorkingCopyFormatUsagesCollector"/>
|
||||
|
||||
<changesViewContent tabName="Subversion Working Copies Information" className="org.jetbrains.idea.svn.WorkingCopiesContent"
|
||||
predicateClassName="org.jetbrains.idea.svn.WorkingCopiesContent$VisibilityPredicate"/>
|
||||
|
||||
<openapi.vcs.changes.actions.diff.ChangeDiffViewerWrapperProvider
|
||||
implementation="org.jetbrains.idea.svn.difftool.SvnChangeDiffViewerProvider"/>
|
||||
<openapi.vcs.changes.actions.diff.ChangeDiffRequestProvider
|
||||
|
||||
@@ -128,7 +128,6 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
|
||||
|
||||
private ChangeProvider myChangeProvider;
|
||||
private MergeProvider myMergeProvider;
|
||||
private final WorkingCopiesContent myWorkingCopiesContent;
|
||||
|
||||
private final SvnChangelistListener myChangeListListener;
|
||||
|
||||
@@ -193,8 +192,6 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
|
||||
|
||||
myFrameStateListener = project.isDefault() ? null : new MyFrameStateListener(ChangeListManager.getInstance(project),
|
||||
VcsDirtyScopeManager.getInstance(project));
|
||||
myWorkingCopiesContent = new WorkingCopiesContent(this);
|
||||
|
||||
myChecker = new SvnExecutableChecker(this);
|
||||
|
||||
Application app = ApplicationManager.getApplication();
|
||||
@@ -216,8 +213,6 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
|
||||
else {
|
||||
invokeRefreshSvnRoots();
|
||||
}
|
||||
|
||||
myWorkingCopiesContent.activate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -433,7 +428,6 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
|
||||
|
||||
mySvnBranchPointsCalculator.deactivate();
|
||||
mySvnBranchPointsCalculator = null;
|
||||
myWorkingCopiesContent.deactivate();
|
||||
myLoadedBranchesStorage.deactivate();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,44 +16,36 @@
|
||||
package org.jetbrains.idea.svn;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentI;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentProvider;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentFactory;
|
||||
import com.intellij.ui.content.ContentManager;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.svn.dialogs.CopiesPanel;
|
||||
|
||||
public class WorkingCopiesContent {
|
||||
import javax.swing.*;
|
||||
|
||||
public class WorkingCopiesContent implements ChangesViewContentProvider {
|
||||
|
||||
public static final String TAB_NAME = SvnBundle.message("dialog.show.svn.map.title");
|
||||
|
||||
private final SvnVcs myVcs;
|
||||
private Content myShownContent;
|
||||
@NotNull private final Project myProject;
|
||||
|
||||
public WorkingCopiesContent(SvnVcs vcs) {
|
||||
myVcs = vcs;
|
||||
public WorkingCopiesContent(@NotNull Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
final ChangesViewContentI cvcm = ChangesViewContentManager.getInstance(myVcs.getProject());
|
||||
final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
|
||||
|
||||
final CopiesPanel copiesPanel = new CopiesPanel(myVcs.getProject());
|
||||
myShownContent = contentFactory.createContent(copiesPanel.getComponent(), TAB_NAME, true);
|
||||
myShownContent.setCloseable(false);
|
||||
cvcm.addContent(myShownContent);
|
||||
myShownContent.setPreferredFocusableComponent(copiesPanel.getPreferredFocusedComponent());
|
||||
@Override
|
||||
public JComponent initContent() {
|
||||
return new CopiesPanel(myProject).getComponent();
|
||||
}
|
||||
|
||||
public void deactivate() {
|
||||
if (myShownContent != null) {
|
||||
final ChangesViewContentI cvcm = ChangesViewContentManager.getInstance(myVcs.getProject());
|
||||
cvcm.removeContent(myShownContent);
|
||||
myShownContent = null;
|
||||
}
|
||||
@Override
|
||||
public void disposeContent() {
|
||||
}
|
||||
|
||||
public static void show(@NotNull Project project) {
|
||||
@@ -70,4 +62,13 @@ public class WorkingCopiesContent {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class VisibilityPredicate implements NotNullFunction<Project, Boolean> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Boolean fun(@NotNull Project project) {
|
||||
return ProjectLevelVcsManager.getInstance(project).checkVcsIsActive(SvnVcs.VCS_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user