Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2017-01-12 04:43:30 -0500
committerMatthias Sohn2017-03-09 16:09:02 -0500
commit6179a9b8865d6f2c3bd842f2be4d0a4751a4e930 (patch)
tree7e25222a03c97efbf5514ddb30ad25ed1c0ae883 /org.eclipse.egit.ui.test/src/org/eclipse/egit
parente7792e720fdc12108c0f1d8f2071a88d61fde78d (diff)
downloadegit-6179a9b8865d6f2c3bd842f2be4d0a4751a4e930.tar.gz
egit-6179a9b8865d6f2c3bd842f2be4d0a4751a4e930.tar.xz
egit-6179a9b8865d6f2c3bd842f2be4d0a4751a4e930.zip
[duplicate code] Refactor SimpleConfigure(Fetch|Push)Dialog
These two classes were a bad case of copy-paste programming. Resolve code duplication by factoring out common things into a common super class, give dialogs an image to make them look better in the dark theme, and catch exceptions in RefSpecDialog. Use actions instead of buttons for the, well, _actions_ available on refspecs, use them in a context menu, and register the actions. Thus copy/paste/etc. can be handled the standard way without having to add a key listener to the table. Make the buttons use these actions, and make the buttons respect the action enablement. Remove the last remnants of the ADVANCED_MODE preference. Originally these dialogs had an expandable section for advanced configuration, and that preference recorded whether it was expanded. However, in commit 6514813 on 2012-03-15, this whole expandable section was removed and thus there was no way anymore to set that preference to any value. But the dialogs still tested it... which means the "Modify..." button would basically never appear. Now it is always present. Note that there is more not so obvious "duplication" regarding RefSpecDialog and SimpleFetchRefSpecWizard. It seems to me these are two different implementations for basically the same functionality. I plan to clean that up in a later commit, which is why in RefSpecDialog I only added catching (and ignoring) exceptions, but didn't add some mechanism to display warnings or errors. Thus the current behavior is unchanged, except for not logging exceptions during typing. Change-Id: Ice317a210461e71f71b633227f39907ca651b86d Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java
index 4992147b2c..26ea7050be 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java
@@ -147,15 +147,15 @@ public class GitRepositoriesViewRemoteHandlingTest extends
// configure fetch dialog
shell = bot.shell(UIText.SimpleConfigureFetchDialog_WindowTitle);
// change uri
- shell.bot().button(UIText.SimpleConfigureFetchDialog_ChangeUriButton)
+ shell.bot().button(UIText.AbstractConfigureRemoteDialog_ChangeUriLabel)
.click();
- shell = bot.shell(UIText.SelectUriWiazrd_Title);
+ shell = bot.shell(UIText.SelectUriWizard_Title);
shell.bot().text().setText("file:///" + remoteRepositoryFile.getPath());
shell.bot().button(IDialogConstants.FINISH_LABEL).click();
// now we have the fetch URI
// back to dialog
shell = bot.shell(UIText.SimpleConfigureFetchDialog_WindowTitle);
- shell.bot().button(UIText.SimpleConfigureFetchDialog_AddRefSpecButton)
+ shell.bot().button(UIText.AbstractConfigureRemoteDialog_AddRefSpecLabel)
.click();
shell = bot.shell(UIText.SimpleFetchRefSpecWizard_WizardTitle);
shell.bot().textWithLabel(UIText.FetchSourcePage_SourceLabel).setText(
@@ -167,7 +167,7 @@ public class GitRepositoriesViewRemoteHandlingTest extends
// back to dialog
shell = bot.shell(UIText.SimpleConfigureFetchDialog_WindowTitle);
// save
- shell.bot().button(UIText.SimpleConfigureFetchDialog_SaveButton)
+ shell.bot().button(UIText.AbstractConfigureRemoteDialog_SaveButton)
.click();
refreshAndWait();
@@ -184,7 +184,8 @@ public class GitRepositoriesViewRemoteHandlingTest extends
shell = bot.shell(UIText.SimpleConfigurePushDialog_WindowTitle);
shell.bot()
- .button(UIText.SimpleConfigurePushDialog_AddRefSpecButton, 1)
+ .button(UIText.AbstractConfigureRemoteDialog_AddRefSpecLabel,
+ 1)
.click();
// add push spec
@@ -206,7 +207,7 @@ public class GitRepositoriesViewRemoteHandlingTest extends
});
shell.bot().button(IDialogConstants.OK_LABEL).click();
shell = bot.shell(UIText.SimpleConfigurePushDialog_WindowTitle);
- shell.bot().button(UIText.SimpleConfigurePushDialog_SaveButton).click();
+ shell.bot().button(UIText.AbstractConfigureRemoteDialog_SaveButton).click();
refreshAndWait();
// assert 2 children
@@ -246,15 +247,15 @@ public class GitRepositoriesViewRemoteHandlingTest extends
String shellText = UIText.SimpleConfigureFetchDialog_WindowTitle;
shell = bot.shell(shellText);
// change uri
- shell.bot().button(UIText.SimpleConfigureFetchDialog_ChangeUriButton)
+ shell.bot().button(UIText.AbstractConfigureRemoteDialog_ChangeUriLabel)
.click();
- shell = bot.shell(UIText.SelectUriWiazrd_Title);
+ shell = bot.shell(UIText.SelectUriWizard_Title);
shell.bot().text().setText("file:///" + remoteRepositoryFile.getPath());
shell.bot().button(IDialogConstants.FINISH_LABEL).click();
// back to dialog
shell = bot.shell(shellText);
// add refSpec
- shell.bot().button(UIText.SimpleConfigureFetchDialog_AddRefSpecButton)
+ shell.bot().button(UIText.AbstractConfigureRemoteDialog_AddRefSpecLabel)
.click();
shell = bot.shell(UIText.SimpleFetchRefSpecWizard_WizardTitle);
shell.bot().textWithLabel(UIText.FetchSourcePage_SourceLabel).setText(
@@ -266,7 +267,7 @@ public class GitRepositoriesViewRemoteHandlingTest extends
// back to dialog
shell = bot.shell(shellText);
// save
- shell.bot().button(UIText.SimpleConfigureFetchDialog_SaveButton)
+ shell.bot().button(UIText.AbstractConfigureRemoteDialog_SaveButton)
.click();
refreshAndWait();
// assert 1 children
@@ -301,13 +302,14 @@ public class GitRepositoriesViewRemoteHandlingTest extends
// back to dialog
shell = bot.shell(shellText);
- shell = bot.shell(UIText.SelectUriWiazrd_Title);
+ shell = bot.shell(UIText.SelectUriWizard_Title);
shell.bot().text().setText("file:///" + remoteRepositoryFile.getPath());
shell.bot().button(IDialogConstants.FINISH_LABEL).click();
shell = bot.shell(shellText);
// Add is on two buttons
shell.bot()
- .button(UIText.SimpleConfigurePushDialog_AddRefSpecButton, 1)
+ .button(UIText.AbstractConfigureRemoteDialog_AddRefSpecLabel,
+ 1)
.click();
// add push spec
shell = bot.shell(UIText.RefSpecDialog_WindowTitle);
@@ -332,7 +334,7 @@ public class GitRepositoriesViewRemoteHandlingTest extends
// back to dialog
shell = bot.shell(shellText);
- shell.bot().button(UIText.SimpleConfigurePushDialog_SaveButton).click();
+ shell.bot().button(UIText.AbstractConfigureRemoteDialog_SaveButton).click();
refreshAndWait();
// assert 2 children
item = TestUtil.expandAndWait(

Back to the top