Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Kinzler2010-05-18 06:53:56 +0000
committerMathias Kinzler2010-05-18 06:53:56 +0000
commit3813c0d8461221ad482270369791cd79a89d4c1a (patch)
treee1b9a6e2d8a169ab1a81642bdc9b4fdc51b38233
parent114eefd782f99147e1cec381437950c4de2f43ac (diff)
downloadegit-3813c0d8461221ad482270369791cd79a89d4c1a.tar.gz
egit-3813c0d8461221ad482270369791cd79a89d4c1a.tar.xz
egit-3813c0d8461221ad482270369791cd79a89d4c1a.zip
BranchSelectionDialog: allow check-out of tags
Since tags can now be checked out properly, this offers the checkout for tags on the Branch Selection dialog. Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java
index 171d2c6c4d..a987115527 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java
@@ -124,8 +124,6 @@ public class BranchSelectionDialog extends Dialog {
String refName = refNameFromDialog();
- boolean headSelected = Constants.HEAD.equals(refName);
-
boolean tagSelected = refName != null
&& refName.startsWith(Constants.R_TAGS);
@@ -133,14 +131,15 @@ public class BranchSelectionDialog extends Dialog {
&& (refName.startsWith(Constants.R_HEADS) || refName
.startsWith(Constants.R_REMOTES));
- // TODO add support for checkout of tags
- confirmationBtn.setEnabled(branchSelected && !headSelected
- && !tagSelected);
+ // we don't allow reset on tags, but checkout
+ if (showResetType)
+ confirmationBtn.setEnabled(branchSelected);
+ else
+ confirmationBtn.setEnabled(branchSelected || tagSelected);
if (!showResetType) {
// we don't support rename on tags
- renameButton.setEnabled(branchSelected && !headSelected
- && !tagSelected);
+ renameButton.setEnabled(branchSelected && !tagSelected);
// new branch can not be based on a tag
newButton.setEnabled(branchSelected && !tagSelected);
@@ -215,6 +214,8 @@ public class BranchSelectionDialog extends Dialog {
RepositoryTreeNode<Repository> parentNode;
if (refName.startsWith(Constants.R_HEADS)) {
parentNode = localBranches;
+ // TODO fix this: if we are on a local branch or tag, we must do the
+ // indirection through the commit
} else if (refName.startsWith(Constants.R_REMOTES)) {
parentNode = remoteBranches;
} else if (refName.startsWith(Constants.R_TAGS)) {
@@ -297,7 +298,8 @@ public class BranchSelectionDialog extends Dialog {
if (sel.size() != 1)
return null;
RepositoryTreeNode node = (RepositoryTreeNode) sel.getFirstElement();
- if (node.getType() == RepositoryTreeNodeType.REF) {
+ if (node.getType() == RepositoryTreeNodeType.REF
+ || node.getType() == RepositoryTreeNodeType.TAG) {
return ((Ref) node.getObject()).getName();
}
return null;

Back to the top