[EGIT PATCH 10/10] Enable a tooltip in the history view

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This tooltip show the comment in full rather than the first line only.

Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
---

 .../src/org/spearce/egit/ui/GitHistoryPage.java    |   27 +++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
index 57fefcc..e5d92fe 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
@@ -48,9 +48,11 @@ import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseMoveListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
@@ -136,6 +138,31 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
 		
 		});
 
+		tree.addMouseMoveListener(new MouseMoveListener() {
+			TreeItem lastItem;
+			public void mouseMove(MouseEvent e) {
+				TreeItem item = tree.getItem(new Point(e.x,e.y));
+				if (item != null && item!=lastItem) {
+					IFileRevision rev = (IFileRevision) item.getData();
+					String commitStr=null;
+					if (appliedPatches!=null) {
+						String id = rev.getContentIdentifier();
+						if (!id.equals("Workspace")) {
+							StGitPatch patch = (StGitPatch) appliedPatches.get(new ObjectId(id));
+							if (patch!=null)
+								commitStr = "Patch: "+patch.getName();
+						} else {
+							commitStr = "Workspace:";
+						}
+					}
+					if (commitStr == null)
+						commitStr = "Commit: "+rev.getContentIdentifier();
+					tree.setToolTipText(commitStr+"\nAuthor:\t"+rev.getAuthor()+"\nDate:\t"+new Date(rev.getTimestamp())+"\n\n"+rev.getComment());
+				}
+				lastItem = item;
+			}
+		});
+
 		tree.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent e) {
 				// update the current

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]