diff options
| author | Kevin Sawicki | 2011-04-28 22:48:17 +0000 |
|---|---|---|
| committer | Matthias Sohn | 2011-05-04 13:08:58 +0000 |
| commit | 2820bcfbfc246d0c78dad9f478bae81f18801bb2 (patch) | |
| tree | 68a9279d7282f203d209250ad39f07c4336d26fa | |
| parent | 6a577c370b0881ebda0146ff07003b99bc4636ec (diff) | |
| download | egit-2820bcfbfc246d0c78dad9f478bae81f18801bb2.tar.gz egit-2820bcfbfc246d0c78dad9f478bae81f18801bb2.tar.xz egit-2820bcfbfc246d0c78dad9f478bae81f18801bb2.zip | |
Add action to open commit from graph table.
Change-Id: I34360393a6c04aea4175b18d17fa02d8e11f914c
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 files changed, 56 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/plugin.properties b/org.eclipse.egit.ui/plugin.properties index 72e2daa88a..5a79217eb0 100644 --- a/org.eclipse.egit.ui/plugin.properties +++ b/org.eclipse.egit.ui/plugin.properties @@ -260,6 +260,7 @@ FetchUpstreamCommand.name = Fetch from Upstream ConfigureUpstreamFetchCommand.name = Configure Upstream Fetch ConfigureUpstreamPushCommand.name = Configure Upstream Push OpenInTextEditorCommand.name = Open in Text Editor +OpenInCommitViewerCommand.name = Open in Commit Viewer ConfigureFetchFromUpstreamCommand.label = Configure F&etch from Upstream... ConfigurePushToUpstreamCommand.label = Configure P&ush to Upstream... CommitMessageProviderExtension-point.name = CommitMessageProvider @@ -281,4 +282,4 @@ RenameBranchCommand.name = Rename Branch CompareInTreeCommand.name = Compare in Tree CompareWithPreviousCommand.name = Compare with Previous Revision CompareWithPreviousAction.label = Previous Revision -CommitEditor.name = Git Commit Editor
\ No newline at end of file +CommitEditor.name = Git Commit Editor diff --git a/org.eclipse.egit.ui/plugin.xml b/org.eclipse.egit.ui/plugin.xml index 5a08320494..47490c356f 100644 --- a/org.eclipse.egit.ui/plugin.xml +++ b/org.eclipse.egit.ui/plugin.xml @@ -3450,6 +3450,11 @@ id="org.eclipse.egit.ui.RebaseCurrent" name="%RebaseCurrentCommand.name"> </command> + <command + defaultHandler="org.eclipse.egit.ui.internal.history.command.OpenInCommitViewerHandler" + id="org.eclipse.egit.ui.history.OpenInCommitViewerCommand" + name="%OpenInCommitViewerCommand.name"> + </command> </extension> <extension point="org.eclipse.ui.newWizards"> 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 1db5dc20de..7c38f50508 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 @@ -2978,6 +2978,9 @@ public class UIText extends NLS { public static String CommitGraphTable_CompareWithEachOtherInTreeMenuLabel; /** */ + public static String CommitGraphTable_OpenCommitLabel; + + /** */ public static String GitSynchronizeWizard_synchronize; /** */ diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitGraphTable.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitGraphTable.java index 6e1a372782..5dee2ce50a 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitGraphTable.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitGraphTable.java @@ -652,6 +652,9 @@ class CommitGraphTable { // copy and such after additions popupMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); popupMgr.add(copyAction); + popupMgr.add(getCommandContributionItem( + HistoryViewCommands.OPEN_IN_COMMIT_VIEWER, + UIText.CommitGraphTable_OpenCommitLabel)); popupMgr.add(new Separator()); } diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/HistoryViewCommands.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/HistoryViewCommands.java index 1ced6d892a..9f3b2d7cc7 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/HistoryViewCommands.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/HistoryViewCommands.java @@ -76,4 +76,7 @@ public class HistoryViewCommands { /** rebase on top of commit */ public static final String REBASECURRENT = "org.eclipse.egit.ui.RebaseCurrent"; //$NON-NLS-1$ + + /** Open in Commit Viewer */ + public static final String OPEN_IN_COMMIT_VIEWER = "org.eclipse.egit.ui.history.OpenInCommitViewerCommand"; //$NON-NLS-1$ } diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/OpenInCommitViewerHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/OpenInCommitViewerHandler.java new file mode 100644 index 0000000000..9202c1ab06 --- /dev/null +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/OpenInCommitViewerHandler.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2011 GitHub Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *******************************************************************************/ +package org.eclipse.egit.ui.internal.history.command; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.egit.ui.Activator; +import org.eclipse.egit.ui.internal.commit.CommitEditor; +import org.eclipse.egit.ui.internal.commit.RepositoryCommit; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.ui.PartInitException; + +/** + * Opens a {@link RevCommit} in the commit editor + */ +public class OpenInCommitViewerHandler extends AbstractHistoryCommandHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + Repository repository = getRepository(event); + if (repository != null) + for (Object selected : getSelection(getPage()).toList()) + try { + CommitEditor.open(new RepositoryCommit(repository, + (RevCommit) selected)); + } catch (PartInitException e) { + Activator.showError("Error opening commit viewer", e); //$NON-NLS-1$ + } + return null; + } +} 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 12e533dfea..20d0bc835a 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 @@ -1036,6 +1036,7 @@ CommitFileDiffViewer_SelectOneCommitMessage=Please select exactly one commit CommitGraphTable_CommitId=Id CommitGraphTable_Committer=Committer CommitGraphTable_CompareWithEachOtherInTreeMenuLabel=Compare with each other in &Tree +CommitGraphTable_OpenCommitLabel=Open in commit viewer CommitSearchQuery_Label=Git Commit Search CommitSearchQuery_TaskSearchCommits=Searching commits in {0} CommitSearchResult_LabelPlural=Git Commit Search - {0} matches |
