Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.egit.ui/plugin.properties10
-rw-r--r--org.eclipse.egit.ui/plugin.xml61
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java12
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/command/CopyHandler.java42
4 files changed, 113 insertions, 12 deletions
diff --git a/org.eclipse.egit.ui/plugin.properties b/org.eclipse.egit.ui/plugin.properties
index 7282027428..aee95cf538 100644
--- a/org.eclipse.egit.ui/plugin.properties
+++ b/org.eclipse.egit.ui/plugin.properties
@@ -347,8 +347,8 @@ ShowInReflog = Reflog
ReflogView = Git Reflog
ShowIn = Show In
ReflogCommand = Reflog
-RefLogViewCheckout.label = Checkout
-RefLogViewOpenInCommitViewer.label = Open in Commit Viewer
+RefLogViewCheckout.label = C&heckout
+RefLogViewOpenInCommitViewer.label = &Open in Commit Viewer
RepositoryConfigPropertyPage = Configuration
CloneUri.label = URI
@@ -357,3 +357,9 @@ AssumeUnchangedCommand = Assume Unchanged
NoAssumeUnchangedCommand = No Assume Unchanged
ConfigurBranchCommand.label = C&onfigure Branch...
+
+ReflogCopyCommand.label = &Copy
+RepoViewConfigurBranchCommand.name = Configure Branch
+ReflogViewContext = In Git Reflog View
+ReflogViewCommands = Reflog View Commands
+ReflogCopyCommandName = Copy \ No newline at end of file
diff --git a/org.eclipse.egit.ui/plugin.xml b/org.eclipse.egit.ui/plugin.xml
index bb3b5f5320..d8fabc32cb 100644
--- a/org.eclipse.egit.ui/plugin.xml
+++ b/org.eclipse.egit.ui/plugin.xml
@@ -1679,6 +1679,24 @@
</and>
</activeWhen>
</handler>
+ <handler
+ commandId="org.eclipse.egit.ui.internal.reflog.CopyCommand">
+ <class
+ class="org.eclipse.egit.ui.internal.reflog.command.CopyHandler">
+ </class>
+ <activeWhen>
+ <and>
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <adapt
+ type="org.eclipse.jgit.storage.file.ReflogEntry">
+ </adapt>
+ </iterate>
+ </and>
+ </activeWhen>
+ </handler>
</extension>
<extension
point="org.eclipse.ui.views">
@@ -1837,6 +1855,11 @@
label="%RefLogViewOpenInCommitViewer.label"
style="push">
</command>
+ <command
+ commandId="org.eclipse.egit.ui.internal.reflog.CopyCommand"
+ label="%ReflogCopyCommand.label"
+ style="push">
+ </command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.egit.ui.RepositoriesView">
@@ -3990,7 +4013,7 @@
categoryId="org.eclipse.egit.ui.commandCategory"
defaultHandler="org.eclipse.egit.ui.internal.repository.tree.command.ConfigureBranchCommand"
id="org.eclipse.egit.ui.RepositoriesViewConfigureBranch"
- name="Configure Branch">
+ name="%RepoViewConfigurBranchCommand.name">
</command>
</extension>
<extension
@@ -4523,6 +4546,12 @@
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+C">
</key>
+ <key
+ commandId="org.eclipse.egit.ui.internal.reflog.CopyCommand"
+ contextId="org.eclipse.egit.ui.ReflogView"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+C">
+ </key>
</extension>
<extension
name="%HistoryViewCommands.extension.name"
@@ -4613,14 +4642,6 @@
name="%CheckoutCommand.name">
</command>
<command
- id="org.eclipse.egit.ui.internal.reflog.CheckoutCommand"
- name="%CheckoutCommand.name">
- </command>
- <command
- id="org.eclipse.egit.ui.internal.reflog.OpenInCommitViewerCommand"
- name="%OpenInCommitViewerCommand.name">
- </command>
- <command
defaultHandler="org.eclipse.egit.ui.internal.history.command.OpenInTextEditorHandler"
id="org.eclipse.egit.ui.history.OpenInTextEditorCommand"
name="%OpenInTextEditorCommand.name">
@@ -4702,6 +4723,12 @@
name="%RepositoriesViewContext.name"
parentId="org.eclipse.ui.contexts.window">
</context>
+ <context
+ id="org.eclipse.egit.ui.ReflogView"
+ name="%ReflogViewContext"
+ parentId="org.eclipse.ui.contexts.window">
+ parentId="org.eclipse.ui.contexts.window">
+ </context>
</extension>
<extension
point="org.eclipse.ui.editors">
@@ -4845,4 +4872,20 @@
<repositorySearchPage
class="org.eclipse.egit.ui.internal.components.RepositorySelectionPage"></repositorySearchPage>
</extension>
+ <extension
+ name="%ReflogViewCommands"
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.eclipse.egit.ui.internal.reflog.OpenInCommitViewerCommand"
+ name="%OpenInCommitViewerCommand.name">
+ </command>
+ <command
+ id="org.eclipse.egit.ui.internal.reflog.CheckoutCommand"
+ name="%CheckoutCommand.name">
+ </command>
+ <command
+ id="org.eclipse.egit.ui.internal.reflog.CopyCommand"
+ name="%ReflogCopyCommandName">
+ </command>
+ </extension>
</plugin>
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java
index 6ce3c26a56..c0dbfe4916 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java
@@ -81,6 +81,7 @@ import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;
import org.eclipse.ui.forms.IFormColors;
@@ -150,7 +151,7 @@ public class ReflogView extends ViewPart implements RefsChangedListener {
final TreeColumnLayout layout = new TreeColumnLayout();
FilteredTree filteredTree = new FilteredTree(tableComposite, SWT.NONE
- | SWT.BORDER, new PatternFilter(), true) {
+ | SWT.BORDER | SWT.FULL_SELECTION, new PatternFilter(), true) {
@Override
protected void createControl(Composite composite, int treeStyle) {
super.createControl(composite, treeStyle);
@@ -349,6 +350,15 @@ public class ReflogView extends ViewPart implements RefsChangedListener {
@Override
public void setFocus() {
refLogTableTreeViewer.getControl().setFocus();
+ activateContextService();
+ }
+
+ private void activateContextService() {
+ IContextService contextService = (IContextService) getSite()
+ .getService(IContextService.class);
+ if (contextService != null)
+ contextService.activateContext(VIEW_ID);
+
}
@Override
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/command/CopyHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/command/CopyHandler.java
new file mode 100644
index 0000000000..55d3dc4eac
--- /dev/null
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/command/CopyHandler.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (C) 2012, Mathias Kinzler <mathias.kinzler@sap.com>
+ *
+ * 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
+ *******************************************************************************/
+package org.eclipse.egit.ui.internal.reflog.command;
+
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+
+/**
+ * Copy to clipboard handler
+ */
+public class CopyHandler extends AbstractReflogCommandHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Repository repo = getRepository(event);
+ RevCommit commit = getSelectedCommit(event, repo);
+ if (commit != null) {
+ Clipboard clipboard = new Clipboard(null);
+ try {
+ TextTransfer textTransfer = TextTransfer.getInstance();
+ Transfer[] transfers = new Transfer[] { textTransfer };
+ Object[] data = new Object[] { ObjectId.toString(commit) };
+ clipboard.setContents(data, transfers);
+ } finally {
+ clipboard.dispose();
+ }
+ }
+ return null;
+ }
+}

Back to the top