Skip to main content
diff options
authorThomas Wolf2019-06-24 16:27:21 -0400
committerThomas Wolf2019-06-24 17:04:18 -0400
commit58ba9fb83ae041fabed390261a79a7f34f40f9f3 (patch)
treed6cb213b3766cac4fed51e0e09e2f8959b1002e2 /org.eclipse.egit.ui.test/src
parent2a6d24376833d10036f81a79d8423be4a5c59b3c (diff)
Enable the "Switch To..." menu for submodule folders
Commits 1f69fad3 and e4dc3eaf from the multi-repository branch switch had the effect that the "Switch To..." menu didn't work anymore for submodule folders in the package or project explorer. Add a new operation SelectionUtils.getAllRepositories() and use it in SwitchToMenu. Changing the existing SelectionUtils.getRepositories() to also return repositories for folders was deemed too risky since that would have changed the behavior of the multi-repository pull, which has always worked only for folders. Enabling that to also handle submodule folders might be an idea for a future commit, but might need more tests. Add a new test. The test only verifies that the menu has content by trying to invoke "New Branch..." and then closing the resulting "Create Branch" dialog. Interestingly this test succeeds even without the fix, which matches the experience described in the bug report: the problem could only be observed in official packages, but not in my development setup. Change verified manually by actually building EGit and installing it into standard Eclipse packages. Bug: 548158 Change-Id: Ic67578b46a89687a6bcfe73ef3d2d3d71d2a39e0 Signed-off-by: Thomas Wolf <>
Diffstat (limited to 'org.eclipse.egit.ui.test/src')
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/
index 26ee2031a..97a42f4b3 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/
@@ -39,6 +39,7 @@ import org.eclipse.egit.core.project.GitProjectData;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.core.test.TestRepository;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
+import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.clone.ProjectRecord;
import org.eclipse.egit.ui.internal.clone.ProjectUtils;
import org.eclipse.egit.ui.internal.resources.IResourceState;
@@ -52,6 +53,7 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.submodule.SubmoduleWalk;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.ui.IEditorReference;
@@ -230,6 +232,27 @@ public class SubmoduleFolderTest extends LocalRepositoryTestCase {
+ * Tests that the Team->Switch To... menu item has content by clicking on
+ * "New Branch..." and then closing the resulting "Create Branch" dialog.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testSwitchToMenu() throws Exception {
+ SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
+ SWTBotTreeItem node = TestUtil.navigateTo(projectExplorerTree,
+ childFolder.getFullPath().segments());
+ TestUtil.waitForDecorations();
+ ContextMenuHelper.clickContextMenu(projectExplorerTree, "Team",
+ util.getPluginLocalizedValue("SwitchToMenu.label"),
+ UIText.SwitchToMenu_NewBranchMenuLabel);
+ SWTBotShell shell =;
+ shell.close();
+ }
+ /**
* Tests that a CompareWithHeadAction on a file from a submodule folder does
* open the right compare editor, comparing against the version from the
* submodule (as opposed to the version from the parent repo).

Back to the top