Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2019-07-20 10:51:13 -0400
committerMichael Keppler2019-08-27 12:27:58 -0400
commitafe4fddbb3bf7d523fba637ad7e523d837aef9e9 (patch)
tree0900e3bc03104f25376d1aa5236643471522490a /org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test
parent478756d3a953d31ad0bb3912a50a21a5dc2e2243 (diff)
downloadegit-afe4fddbb3bf7d523fba637ad7e523d837aef9e9.tar.gz
egit-afe4fddbb3bf7d523fba637ad7e523d837aef9e9.tar.xz
egit-afe4fddbb3bf7d523fba637ad7e523d837aef9e9.zip
History view: shorten view toolbar
Combine the four filter buttons into one single button with a drop-down menu. Selecting the button itself cycles though the filters. Use the new FilterAction also in the view menu; to be able to do so implement ToolBarMenuAction.getMenu(Menu) and rename the class to DropDownMenuAction. Also, as long as one only updates the image of an action it isn't necessary to update the whole toolbar. The framework listens for such changes and updates the corresponding ToolItem or Menu entry already. Change-Id: If7fb1e3199cd1721a4455bac10925fc2922c5ba8 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java54
1 files changed, 38 insertions, 16 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
index 268ce7b83..994286b55 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
@@ -43,11 +43,13 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
@@ -56,6 +58,8 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.team.ui.history.IHistoryView;
import org.eclipse.ui.PlatformUI;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -185,33 +189,51 @@ public class HistoryViewTest extends GitRepositoriesViewTestBase {
getHistoryViewTable(PROJ1);
SWTBotView view = bot
.viewById(IHistoryView.VIEW_ID);
- SWTBotToolbarToggleButton folder = (SWTBotToolbarToggleButton) view
- .toolbarButton(UIText.GitHistoryPage_AllInParentTooltip);
- SWTBotToolbarToggleButton project = (SWTBotToolbarToggleButton) view
- .toolbarButton(UIText.GitHistoryPage_AllInProjectTooltip);
- SWTBotToolbarToggleButton repo = (SWTBotToolbarToggleButton) view
- .toolbarButton(UIText.GitHistoryPage_AllInRepoTooltip);
+ SWTBotMenu filterMenu = view
+ .viewMenu(UIText.GitHistoryPage_FilterSubMenuLabel);
switch (filter) {
- case 0:
- if (folder.isChecked())
- folder.click();
- if (project.isChecked())
- project.click();
- if (repo.isChecked())
- repo.click();
+ case 0: {
+ SWTBotMenu checkedChild = filterMenu
+ .menu(new BaseMatcher<MenuItem>() {
+
+ @Override
+ public boolean matches(Object item) {
+ return item instanceof MenuItem
+ && ((MenuItem) item).getSelection();
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("Checked menu item");
+
+ }
+ }, true, 0);
+ if (checkedChild != null) {
+ checkedChild.click();
+ }
break;
- case 1:
+ }
+ case 1: {
+ SWTBotMenu repo = filterMenu
+ .menu(UIText.GitHistoryPage_AllInRepoMenuLabel);
if (!repo.isChecked())
repo.click();
break;
- case 2:
+ }
+ case 2: {
+ SWTBotMenu project = filterMenu
+ .menu(UIText.GitHistoryPage_AllInProjectMenuLabel);
if (!project.isChecked())
project.click();
break;
- case 3:
+ }
+ case 3: {
+ SWTBotMenu folder = filterMenu
+ .menu(UIText.GitHistoryPage_AllInParentMenuLabel);
if (!folder.isChecked())
folder.click();
break;
+ }
default:
break;
}

Back to the top