diff options
author | Thomas Wolf | 2019-11-20 13:10:23 +0000 |
---|---|---|
committer | Michael Keppler | 2019-11-22 07:07:05 +0000 |
commit | 05039da1aeb7fee99633432758632c956caabaa8 (patch) | |
tree | 2142450848c6dd0067306d6699c72f831ae1c92a | |
parent | 45bc68761130dda2ddbd806ab23f8922d932b74b (diff) | |
download | egit-05039da1aeb7fee99633432758632c956caabaa8.tar.gz egit-05039da1aeb7fee99633432758632c956caabaa8.tar.xz egit-05039da1aeb7fee99633432758632c956caabaa8.zip |
Branch selection dialog improvements
This dialog can be invoked via the BranchActionHandler, which is
a default handler. Make sure the dialogs say in which repository
they operate; it may not be obvious if invoked via Quick Access.
Pre-select the current branch, if any, in the dialog, so that when
clicking "New branch..." there is a default base set.
Also give the BranchActionHandler a description.
Bug: 553223
Change-Id: I0aaf4a6788382201310dbcd1ff4f154577720db6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
7 files changed, 23 insertions, 10 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java index 11c05b3059..245d49ad3c 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java @@ -494,7 +494,7 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase { throws IOException, Exception { SWTBotShell dialog = openCheckoutBranchDialog(); TableCollection tc = dialog.bot().tree().selection(); - assertEquals("Wrong selection count", 0, tc.rowCount()); + assertEquals("Wrong selection count", 1, tc.rowCount()); TestUtil.navigateTo(dialog.bot().tree(), nodeTexts).select(); tc = dialog.bot().tree().selection(); diff --git a/org.eclipse.egit.ui/plugin.properties b/org.eclipse.egit.ui/plugin.properties index f59ae3afb8..f75f533338 100644 --- a/org.eclipse.egit.ui/plugin.properties +++ b/org.eclipse.egit.ui/plugin.properties @@ -270,6 +270,7 @@ RepoViewCollapseWorktreeCommand.description = Collapse the complete Working Tree AddToIndexCommand.name = Add to Index RemoveFromIndexCommand.name = Remove from Index BranchCommand.name = Branch +BranchCommand.description = Check out, rename, create, or delete a branch in a git repository CommitCommand.name = Commit... CompareWithHeadCommand.name = Compare with HEAD Revision CompareIndexWithHeadCommand.name = Compare File in Index with HEAD Revision diff --git a/org.eclipse.egit.ui/plugin.xml b/org.eclipse.egit.ui/plugin.xml index b99ce978a4..81fd8cd8e5 100644 --- a/org.eclipse.egit.ui/plugin.xml +++ b/org.eclipse.egit.ui/plugin.xml @@ -6647,7 +6647,8 @@ categoryId="org.eclipse.egit.ui.commandCategory" defaultHandler="org.eclipse.egit.ui.internal.actions.BranchActionHandler" id="org.eclipse.egit.ui.team.Branch" - name="%BranchCommand.name"> + name="%BranchCommand.name" + description="%BranchCommand.description"> </command> <command categoryId="org.eclipse.egit.ui.commandCategory" diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionAndEditDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionAndEditDialog.java index 80c4afe003..b6642f1b93 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionAndEditDialog.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionAndEditDialog.java @@ -16,6 +16,7 @@ import static org.eclipse.jgit.lib.Constants.R_HEADS; import static org.eclipse.jgit.lib.Constants.R_REMOTES; import java.io.IOException; +import java.text.MessageFormat; import java.util.Iterator; import org.eclipse.egit.ui.Activator; @@ -91,7 +92,9 @@ public class BranchSelectionAndEditDialog extends @Override protected String getTitle() { - return UIText.BranchSelectionAndEditDialog_Title; + return MessageFormat.format(UIText.BranchSelectionAndEditDialog_Title, + Activator.getDefault().getRepositoryUtil() + .getRepositoryName(repo)); } @Override diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CheckoutDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CheckoutDialog.java index 68c6d08356..71d8f43663 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CheckoutDialog.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CheckoutDialog.java @@ -12,6 +12,9 @@ *******************************************************************************/ package org.eclipse.egit.ui.internal.dialogs; +import java.text.MessageFormat; + +import org.eclipse.egit.ui.Activator; import org.eclipse.egit.ui.internal.UIText; import org.eclipse.egit.ui.internal.branch.BranchOperationUI; import org.eclipse.jface.window.Window; @@ -30,14 +33,16 @@ public class CheckoutDialog extends BranchSelectionAndEditDialog { * @param repo */ public CheckoutDialog(Shell parentShell, Repository repo) { - super(parentShell, repo, SHOW_LOCAL_BRANCHES | SHOW_REMOTE_BRANCHES + super(parentShell, repo, + SELECT_CURRENT_REF | SHOW_LOCAL_BRANCHES | SHOW_REMOTE_BRANCHES | SHOW_TAGS | SHOW_REFERENCES | EXPAND_LOCAL_BRANCHES_NODE | ALLOW_MULTISELECTION); } @Override protected String getTitle() { - return UIText.CheckoutDialog_Title; + return MessageFormat.format(UIText.CheckoutDialog_Title, Activator + .getDefault().getRepositoryUtil().getRepositoryName(repo)); } @Override diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/CreateBranchPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/CreateBranchPage.java index f18841824c..d4fc8b3613 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/CreateBranchPage.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/CreateBranchPage.java @@ -17,6 +17,7 @@ package org.eclipse.egit.ui.internal.repository; import java.io.IOException; +import java.text.MessageFormat; import java.util.concurrent.atomic.AtomicReference; import org.eclipse.core.runtime.CoreException; @@ -163,7 +164,8 @@ class CreateBranchPage extends WizardPage { } else { this.upstreamConfig = null; } - setTitle(UIText.CreateBranchPage_Title); + setTitle(MessageFormat.format(UIText.CreateBranchPage_Title, Activator + .getDefault().getRepositoryUtil().getRepositoryName(repo))); setMessage(UIText.CreateBranchPage_ChooseBranchAndNameMessage); } @@ -185,7 +187,8 @@ class CreateBranchPage extends WizardPage { this.myValidator = ValidationUtils.getRefNameInputValidator( myRepository, Constants.R_HEADS, false); this.upstreamConfig = null; - setTitle(UIText.CreateBranchPage_Title); + setTitle(MessageFormat.format(UIText.CreateBranchPage_Title, Activator + .getDefault().getRepositoryUtil().getRepositoryName(repo))); setMessage(UIText.CreateBranchPage_ChooseNameMessage); } diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties index a882aceb2b..e130691b74 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties @@ -317,7 +317,7 @@ CleanWizard_title=Clean ''{0}'' ClearCredentialsCommand_clearingCredentialsFailed=Clearing credentials failed. CheckoutCommand_CheckoutLabel=Chec&k Out CheckoutCommand_CheckoutLabelWithQuestion=Chec&k Out... -CheckoutDialog_Title=Check out a ref or work with branches +CheckoutDialog_Title=Check out a ref or work with branches in repository {0} CheckoutDialog_OkCheckout=Chec&k Out CheckoutDialog_OkCheckoutWithQuestion=Chec&k Out... CheckoutHandler_CheckoutBranchDialogButton=Chec&kout @@ -943,7 +943,7 @@ CreateBranchPage_SourceSelectButton=&Select... CreateBranchPage_SourceSelectionDialogMessage=Select source for creating branch. CreateBranchPage_SourceSelectionDialogTitle=Select Source CreateBranchPage_SourceTooltip=The new branch will start at this point -CreateBranchPage_Title=Create a new branch +CreateBranchPage_Title=Create a new branch in repository {0} CreateBranchWizard_CreationFailed=Branch could not be created CreateBranchWizard_NewBranchTitle=Create Branch CreateRepositoryCommand_CreateButtonLabel=&Create @@ -1207,7 +1207,7 @@ BranchResultDialog_buttonStash=&Stash... BranchResultDialog_CheckoutConflictsTitle=Checkout Conflicts BranchResultDialog_DetachedHeadWarningDontShowAgain=Don't show this dialog again BranchSelectionAndEditDialog_Message=Select a ref and choose action to execute -BranchSelectionAndEditDialog_Title=Select a branch or work with branches +BranchSelectionAndEditDialog_Title=Select a branch or work with branches in repository {0} BranchSelectionAndEditDialog_WindowTitle=Branches BranchSelectionAndEditDialog_OkClose=&Close BranchSelectionAndEditDialog_ErrorCouldNotCreateNewRef=Could not create new ref {0} |