| author | Jens Baumgart | 2010-08-20 11:30:24 (EDT) |
|---|---|---|
| committer | Chris Aniszczyk | 2010-08-20 16:08:43 (EDT) |
| commit | 2bbc7cd3f17ba0c6fc90a6b7d3adf72fba54f1a6 (patch) (side-by-side diff) | |
| tree | 758314953a45b3b7703a680c63bbf493f5f2f48f | |
| parent | 8b3445bb79b77f1c5be4c3684510f5a6c43127f7 (diff) | |
| download | egit-2bbc7cd3f17ba0c6fc90a6b7d3adf72fba54f1a6.zip egit-2bbc7cd3f17ba0c6fc90a6b7d3adf72fba54f1a6.tar.gz egit-2bbc7cd3f17ba0c6fc90a6b7d3adf72fba54f1a6.tar.bz2 | |
Add show all branches toggle in history viewrefs/changes/55/1355/3
History view was extended to show all branches of the repository.
Showing all branches can be activated by selecting the new toggle
button in the view's toolbar.
Change-Id: I0156b7f8b595a19a222664f3c1daa80ea1582581
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
3 files changed, 42 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java index d88938a..27b6020 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java @@ -232,6 +232,9 @@ public class UIText extends NLS { public static String GitHistoryPage_compareMode; /** */ + public static String GitHistoryPage_showAllBranches; + + /** */ public static String GitHistoryPage_CheckoutMenuLabel; /** */ diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java index 14830eb..b7c4595 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java @@ -16,6 +16,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import org.eclipse.core.commands.Command; import org.eclipse.core.commands.IParameter; @@ -60,6 +61,7 @@ import org.eclipse.jgit.events.RefsChangedEvent; import org.eclipse.jgit.events.RefsChangedListener; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revplot.PlotCommit; import org.eclipse.jgit.revwalk.RevCommit; @@ -128,6 +130,11 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener { private boolean compareMode = false; + /** Show all branches toggle */ + private IAction showAllBranchesAction; + + private boolean showAllBranches = false; + // we need to keep track of these actions so that we can // dispose them when the page is disposed (the history framework // does not do this for us) @@ -364,6 +371,24 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener { barManager.add(compareModeAction); } + private void createShowAllBranchesAction() { + final IToolBarManager barManager = getSite().getActionBars() + .getToolBarManager(); + showAllBranchesAction = new Action(UIText.GitHistoryPage_showAllBranches, + IAction.AS_CHECK_BOX) { + public void run() { + showAllBranches = !showAllBranches; + setChecked(showAllBranches); + refresh(); + } + }; + showAllBranchesAction.setImageDescriptor(UIIcons.BRANCH); + showAllBranchesAction.setChecked(showAllBranches); + showAllBranchesAction.setToolTipText(UIText.GitHistoryPage_showAllBranches); + barManager.add(showAllBranchesAction); + } + + /** * @param compareMode * switch compare mode button of the view on / off @@ -446,6 +471,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener { createLocalToolbarActions(); createResourceFilterActions(); createCompareModeAction(); + createShowAllBranchesAction(); createStandardActions(); getSite().registerContextMenu(POPUP_ID, popupMgr, graph.getTableView()); @@ -1029,8 +1055,19 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener { if (headId == null) return false; + try { - currentWalk.markStart(currentWalk.parseCommit(headId)); + if (showAllBranches) { + for (Entry<String, Ref> refEntry : db.getRefDatabase() + .getRefs(Constants.R_HEADS).entrySet()) { + Ref ref = refEntry.getValue(); + if (ref.isSymbolic()) + continue; + currentWalk.markStart(currentWalk.parseCommit(ref + .getObjectId())); + } + } else + currentWalk.markStart(currentWalk.parseCommit(headId)); } catch (IOException e) { Activator.logError(NLS.bind( UIText.GitHistoryPage_errorReadingHeadCommit, headId, db diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties index e667b32..0db01ad 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties @@ -88,6 +88,7 @@ GitHistoryPage_CreateBranchMenuLabel=Create &Branch... GitHistoryPage_CreatePatchMenuLabel=Create &Patch... GitHistoryPage_CreateTagMenuLabel=Create &Tag... GitHistoryPage_compareMode=Compare Mode +GitHistoryPage_showAllBranches=Show all Branches GitHistoryPage_errorLookingUpPath=IO error looking up path {0} in {1}. GitHistoryPage_errorParsingHead=Cannot parse HEAD in: {0} GitHistoryPage_errorReadingHeadCommit=Cannot read HEAD commit {0} in: {1} |

