From ba4d5bcebaefee1d48948543d9778e59a557c4e6 Mon Sep 17 00:00:00 2001 From: irengrig Date: Wed, 14 Jul 2010 16:06:53 +0400 Subject: [PATCH] SVN: one-click merge: show working copies -> to changes tool window tab (cherry picked from commit 835743433991efc6330617fd3c0907e61a355744) --- .../src/org/jetbrains/idea/svn/SvnVcs.java | 4 ++ .../idea/svn/WorkingCopiesContent.java | 49 +++++++++++++++++++ .../idea/svn/dialogs/CopiesPanel.java | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopiesContent.java diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java index 1a8fdaeb9d5d..74205cb4a57c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java @@ -132,6 +132,7 @@ public class SvnVcs extends AbstractVcs { private ChangeProvider myChangeProvider; private MergeProvider myMergeProvider; + private final WorkingCopiesContent myWorkingCopiesContent; @NonNls public static final String LOG_PARAMETER_NAME = "javasvn.log"; public static final String pathToEntries = SvnUtil.SVN_ADMIN_DIR_NAME + File.separatorChar + SvnUtil.ENTRIES_FILE_NAME; @@ -221,6 +222,7 @@ public class SvnVcs extends AbstractVcs { } myFrameStateListener = new MyFrameStateListener(changeListManager, vcsDirtyScopeManager); + myWorkingCopiesContent = new WorkingCopiesContent(this); } public void postStartup() { @@ -228,6 +230,7 @@ public class SvnVcs extends AbstractVcs { myCopiesRefreshManager = new SvnCopiesRefreshManager(myProject, (SvnFileUrlMappingImpl) getSvnFileUrlMapping()); invokeRefreshSvnRoots(true); + myWorkingCopiesContent.activate(); } public void invokeRefreshSvnRoots(final boolean asynchronous) { @@ -472,6 +475,7 @@ public class SvnVcs extends AbstractVcs { myAuthNotifier.clear(); mySvnBranchPointsCalculator = null; + myWorkingCopiesContent.deactivate(); } public VcsShowConfirmationOption getAddConfirmation() { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopiesContent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopiesContent.java new file mode 100644 index 000000000000..aa8d6e37ee98 --- /dev/null +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopiesContent.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2010 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. + */ +package org.jetbrains.idea.svn; + +import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager; +import com.intellij.ui.content.Content; +import com.intellij.ui.content.ContentFactory; +import org.jetbrains.idea.svn.dialogs.CopiesPanel; + +public class WorkingCopiesContent { + private final SvnVcs myVcs; + private Content myShownContent; + + public WorkingCopiesContent(SvnVcs vcs) { + myVcs = vcs; + } + + public void activate() { + final ChangesViewContentManager cvcm = ChangesViewContentManager.getInstance(myVcs.getProject()); + final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); + + final CopiesPanel copiesPanel = new CopiesPanel(myVcs.getProject()); + myShownContent = contentFactory.createContent(copiesPanel.getComponent(), SvnBundle.message("dialog.show.svn.map.title"), true); + myShownContent.setCloseable(false); + cvcm.addContent(myShownContent); + myShownContent.setPreferredFocusableComponent(copiesPanel.getPrefferedFocusComponent()); + } + + public void deactivate() { + if (myShownContent != null) { + final ChangesViewContentManager cvcm = ChangesViewContentManager.getInstance(myVcs.getProject()); + cvcm.removeContent(myShownContent); + myShownContent = null; + } + } +} diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java index 32b6a379f4a8..56dd39975013 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java @@ -114,7 +114,7 @@ public class CopiesPanel { myRefreshLabel = new LinkLabel("Refresh", null, new LinkListener() { public void linkSelected(LinkLabel aSource, Object aLinkData) { if (myRefreshLabel.isEnabled()) { - myVcs.invokeRefreshSvnRoots(false); + myVcs.invokeRefreshSvnRoots(true); myRefreshLabel.setEnabled(false); } }