{"thread":{"id":"11611","subject":"[EGIT PATCH] Showing commit info similar to the CVS plugin.","startedAt":"2008-01-13T21:08:30Z","lastAt":"2008-01-13T23:06:35Z","messageCount":2,"participants":["Roger C. Soares","Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"65271","messageId":"1200258510-15235-1-git-send-email-rogersoares@intelinet.com.br","threadId":"11611","inReplyTo":null,"subject":"[EGIT PATCH] Showing commit info similar to the CVS plugin.","fromName":"Roger C. Soares","fromEmail":"rogersoares@intelinet.com.br","sentAt":"2008-01-13T21:08:30Z","receivedAt":"2008-01-13T21:08:30Z","isPatch":true,"sender":{"key":"rogersoares@intelinet.com.br","avatar":null},"body":"Tooltips for the info were annoying, especially on MacOS where the tooltip center is your pointer location.\nIt is now possible to copy&paste data.\nLike the CVS plugin, there's a menu to show/hide views.\nTooltips can still be enabled via a menu option.\n\nSigned-off-by: Roger C. Soares <rogersoares@intelinet.com.br>\n---\nIt now has a preference to enable/disable tooltips and the\npreference is persisted across eclipse restarts.\nI already merged this with the pu branch so I could test it while working on this one.\n\n org.spearce.egit.ui/plugin.xml                     |    4 +\n .../src/org/spearce/egit/ui/GitHistoryPage.java    |  327 +++++++++++++++++++-\n .../egit/ui/PluginPreferenceInitializer.java       |   46 +++\n .../src/org/spearce/egit/ui/UIPreferences.java     |   32 ++\n .../src/org/spearce/egit/ui/UIText.java            |    9 +\n .../src/org/spearce/egit/ui/uitext.properties      |    5 +\n 6 files changed, 406 insertions(+), 17 deletions(-)\n create mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java\n create mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/UIPreferences.java\n\ndiff --git a/org.spearce.egit.ui/plugin.xml b/org.spearce.egit.ui/plugin.xml\nindex 60519b0..b62c9d7 100644\n--- a/org.spearce.egit.ui/plugin.xml\n+++ b/org.spearce.egit.ui/plugin.xml\n@@ -1,6 +1,10 @@\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <?eclipse version=\"3.0\"?>\n <plugin>\n+   <extension point=\"org.eclipse.core.runtime.preferences\">\n+      <initializer class=\"org.spearce.egit.ui.PluginPreferenceInitializer\"/>\n+   </extension>\n+\n    <extension point=\"org.eclipse.team.ui.configurationWizards\">\n       <wizard name=\"%SharingWizard_name\"\n             icon=\"icons/sharing.gif\"\ndiff --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\nindex 45d5903..803adc5 100644\n--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java\n@@ -17,6 +17,7 @@\n package org.spearce.egit.ui;\n \n import java.io.IOException;\n+import java.text.SimpleDateFormat;\n import java.util.Date;\n import java.util.HashMap;\n import java.util.List;\n@@ -34,13 +35,18 @@ import org.eclipse.core.resources.ResourcesPlugin;\n import org.eclipse.core.runtime.IAdaptable;\n import org.eclipse.core.runtime.IProgressMonitor;\n import org.eclipse.core.runtime.IStatus;\n+import org.eclipse.core.runtime.Preferences;\n import org.eclipse.core.runtime.Status;\n import org.eclipse.core.runtime.jobs.Job;\n import org.eclipse.jface.action.Action;\n+import org.eclipse.jface.action.IAction;\n import org.eclipse.jface.action.IMenuListener;\n import org.eclipse.jface.action.IMenuManager;\n import org.eclipse.jface.action.MenuManager;\n+import org.eclipse.jface.action.Separator;\n import org.eclipse.jface.resource.JFaceResources;\n+import org.eclipse.jface.text.Document;\n+import org.eclipse.jface.text.TextViewer;\n import org.eclipse.jface.viewers.ColumnWeightData;\n import org.eclipse.jface.viewers.ILazyContentProvider;\n import org.eclipse.jface.viewers.StructuredSelection;\n@@ -48,6 +54,7 @@ import org.eclipse.jface.viewers.TableLayout;\n import org.eclipse.jface.viewers.TableViewer;\n import org.eclipse.jface.viewers.Viewer;\n import org.eclipse.swt.SWT;\n+import org.eclipse.swt.custom.SashForm;\n import org.eclipse.swt.events.MouseAdapter;\n import org.eclipse.swt.events.MouseEvent;\n import org.eclipse.swt.events.MouseMoveListener;\n@@ -72,6 +79,8 @@ import org.eclipse.team.internal.ui.history.DialogHistoryPageSite;\n import org.eclipse.team.ui.history.HistoryPage;\n import org.eclipse.team.ui.history.IHistoryCompareAdapter;\n import org.eclipse.team.ui.history.IHistoryPageSite;\n+import org.eclipse.ui.IActionBars;\n+import org.eclipse.ui.part.IPageSite;\n import org.spearce.egit.core.GitProvider;\n import org.spearce.egit.core.internal.mapping.GitCommitFileRevision;\n import org.spearce.egit.core.internal.mapping.GitFileHistory;\n@@ -98,14 +107,26 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \tprivate static final String PREF_SHOWALLREPOVERSIONS = \"org.spearce.egit.ui.githistorypage.showallrepoversions\";\n \tprivate static final String PREF_SHOWALLPROJECTVERSIONS = \"org.spearce.egit.ui.githistorypage.showallprojectversions\";\n \tprivate static final String PREF_SHOWALLFOLDERVERSIONS = \"org.spearce.egit.ui.githistorypage.showallfolderversions\";\n+\t/* private */static final SimpleDateFormat DATETIME_FORMAT = new SimpleDateFormat(\"yyyy-MM-dd HH:mm\");\n+\t/* private */static final SimpleDateFormat DATETIMETZ_FORMAT = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss z\");\n \n-\tprivate Composite localComposite;\n+\tprivate SashForm localComposite;\n+\tprivate SashForm revisionInfoComposite;\n \n-\tprivate TableViewer viewer;\n+\t/* private */Preferences prefs = Activator.getDefault().getPluginPreferences();\n \n-\tprivate Table table;\n+\t/* private */TableViewer viewer;\n+\t/* private */TextViewer revDetailTextViewer;\n+\t/* private */TextViewer revCommentTextViewer;\n+\t/* private */IAction toggleCommentWrapAction;\n+\t/* private */IAction toggleRevDetailAction;\n+\t/* private */IAction toggleRevCommentAction;\n+\t/* private */IAction toggleTooltipsAction;\n \n-\tprivate List<IFileRevision> fileRevisions;\n+\t/* private */Table table;\n+\tprivate MouseMoveListener tableMouseMoveListener;\n+\n+\t/* private */List<IFileRevision> fileRevisions;\n \n \tprivate boolean hintShowDiffNow;\n \n@@ -139,7 +160,8 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t}\n \n \tpublic void createControl(Composite parent) {\n-\t\tlocalComposite = new Composite(parent, SWT.NONE);\n+\t\tlocalComposite = new SashForm(parent, SWT.VERTICAL);\n+\n \t\tGridLayout layout = new GridLayout();\n \t\tlayout.marginHeight = 0;\n \t\tlayout.marginWidth = 0;\n@@ -150,6 +172,10 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \n \t\tcreateTable(localComposite);\n \n+\t\trevisionInfoComposite = new SashForm(localComposite, SWT.HORIZONTAL);\n+\t\tcreateRevDetailTextViewer(revisionInfoComposite);\n+\t\tcreateRevCommentTextViewer(revisionInfoComposite);\n+\n \t\tIHistoryPageSite parentSite = getHistoryPageSite();\n \t\tif (parentSite != null && parentSite instanceof DialogHistoryPageSite)\n \t\t\tparentSite.setSelectionProvider(viewer);\n@@ -158,6 +184,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\t\"Compare\");\n \t\tfinal GitCompareRevisionAction compareActionPrev = new GitCompareRevisionAction(\n \t\t\t\t\"Show commit\");\n+\n \t\ttable.addMouseListener(new MouseAdapter() {\n \t\t\n \t\t\tpublic void mouseDown(MouseEvent e) {\n@@ -166,7 +193,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \n \t\t});\n \n-\t\ttable.addMouseMoveListener(new MouseMoveListener() {\n+\t\ttableMouseMoveListener = new MouseMoveListener() {\n \t\t\tTableItem lastItem;\n \t\t\tpublic void mouseMove(MouseEvent e) {\n \t\t\t\tTableItem item = table.getItem(new Point(e.x,e.y));\n@@ -179,7 +206,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\t}\n \t\t\t\tlastItem = item;\n \t\t\t}\n-\t\t});\n+\t\t};\n \n \t\ttable.addSelectionListener(new SelectionAdapter() {\n \t\t\tpublic void widgetSelected(SelectionEvent e) {\n@@ -190,6 +217,19 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\t\tselection2[i] = (IFileRevision) selection[i].getData();\n \t\t\t\t}\n \n+\t\t\t\t// Updates the revision info text viewers\n+\t\t\t\tcleanRevisionInfoTextViewers();\n+\t\t\t\tif(selection2.length == 1) {\n+\t\t\t\t\t// if the table item is not visible in the UI and it's selected via keyboard\n+\t\t\t\t\t// this listener is called before the listener that sets the item data.\n+\t\t\t\t\tif(selection2[0] == null) {\n+\t\t\t\t\t\tint ix = table.getSelectionIndex();\n+\t\t\t\t\t\tGitFileRevision revision = (GitFileRevision) fileRevisions.get(ix);\n+\t\t\t\t\t\tselection2[0] = revision;\n+\t\t\t\t\t}\n+\t\t\t\t\tsetRevisionInfoTextViewers(selection2[0]);\n+\t\t\t\t}\n+\n \t\t\t\tcompareAction.setCurrentFileRevision(fileRevisions.get(0));\n \t\t\t\tcompareAction.selectionChanged(new StructuredSelection(\n \t\t\t\t\t\tselection2));\n@@ -286,9 +326,99 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\tshowAllFolderVersionsAction.setChecked(isShowAllFolderVersions());\n \t\tgetSite().getActionBars().getToolBarManager().add(\n \t\t\t\tshowAllFolderVersionsAction);\n+\n+\t\ttoggleCommentWrapAction = new Action(UIText.ResourceHistory_toggleCommentWrap) {\n+\t\t\tpublic void run() {\n+\t\t\t\tupdateResourceHistoryComposites();\n+\t\t\t\tprefs.setValue(UIPreferences.RESOURCEHISTORY_SHOW_COMMENT_WRAP, toggleCommentWrapAction.isChecked());\n+\t\t\t\tActivator.getDefault().savePluginPreferences();\n+\t\t\t}\n+\t\t};\n+\t\ttoggleCommentWrapAction.setChecked(prefs.getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_COMMENT_WRAP));\n+\n+\t\ttoggleRevDetailAction = new Action(UIText.ResourceHistory_toggleRevDetail) {\n+\t\t\tpublic void run() {\n+\t\t\t\tupdateResourceHistoryComposites();\n+\t\t\t\tprefs.setValue(UIPreferences.RESOURCEHISTORY_SHOW_REV_DETAIL, toggleRevDetailAction.isChecked());\n+\t\t\t\tActivator.getDefault().savePluginPreferences();\n+\t\t\t}\n+\t\t};\n+\t\ttoggleRevDetailAction.setChecked(prefs.getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_REV_DETAIL));\n+\n+\t\ttoggleRevCommentAction = new Action(UIText.ResourceHistory_toggleRevComment) {\n+\t\t\tpublic void run() {\n+\t\t\t\tupdateResourceHistoryComposites();\n+\t\t\t\tprefs.setValue(UIPreferences.RESOURCEHISTORY_SHOW_REV_COMMENT, toggleRevCommentAction.isChecked());\n+\t\t\t\tActivator.getDefault().savePluginPreferences();\n+\t\t\t}\n+\t\t};\n+\t\ttoggleRevCommentAction.setChecked(prefs.getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_REV_COMMENT));\n+\n+\t\ttoggleTooltipsAction = new Action(UIText.ResourceHistory_toggleTooltips) {\n+\t\t\tpublic void run() {\n+\t\t\t\tupdateShowTooltips();\n+\t\t\t\tprefs.setValue(UIPreferences.RESOURCEHISTORY_SHOW_TOOLTIPS, toggleTooltipsAction.isChecked());\n+\t\t\t\tActivator.getDefault().savePluginPreferences();\n+\t\t\t}\n+\t\t};\n+\t\ttoggleTooltipsAction.setChecked(prefs.getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_TOOLTIPS));\n+\n+\t\tIActionBars actionBars = getSite().getActionBars();\n+\t\tIMenuManager menuManager = actionBars.getMenuManager();\n+\t\tif (menuManager != null) {\n+\t\t\tmenuManager.add(toggleCommentWrapAction);\n+\t\t\tmenuManager.add(new Separator());\n+\t\t\tmenuManager.add(toggleRevDetailAction);\n+\t\t\tmenuManager.add(toggleRevCommentAction);\n+\t\t\tmenuManager.add(toggleTooltipsAction);\n+\t\t\tmenuManager.add(new Separator());\n+\t\t}\n+\t\tactionBars.updateActionBars();\n+\t\tupdateResourceHistoryComposites();\n+\t\tupdateShowTooltips();\n+\n+\t\tlocalComposite.setWeights(new int[] {65, 35});\n+\t\trevisionInfoComposite.setWeights(new int[] {40, 60});\n+\t}\n+\n+\t/* private */void updateResourceHistoryComposites() {\n+\t\tboolean commentWrap = toggleCommentWrapAction.isChecked();\n+\t\tboolean showRevDetail = toggleRevDetailAction.isChecked();\n+\t\tboolean showRevComment = toggleRevCommentAction.isChecked();\n+\n+\t\trevCommentTextViewer.getTextWidget().setWordWrap(commentWrap);\n+\n+\t\tif(showRevDetail && showRevComment) {\n+\t\t\tlocalComposite.setMaximizedControl(null);\n+\t\t\trevisionInfoComposite.setMaximizedControl(null);\n+\t\t} else {\n+\t\t\tif(!(showRevDetail || showRevComment)) {\n+\t\t\t\tlocalComposite.setMaximizedControl(table);\n+\t\t\t} else if(showRevDetail) {\n+\t\t\t\tlocalComposite.setMaximizedControl(null);\n+\t\t\t\trevisionInfoComposite.setMaximizedControl(revDetailTextViewer.getControl());\n+\t\t\t} else {\n+\t\t\t\tlocalComposite.setMaximizedControl(null);\n+\t\t\t\trevisionInfoComposite.setMaximizedControl(revCommentTextViewer.getControl());\n+\t\t\t}\n+\t\t}\n \t}\n \n-\tprivate boolean isShowAllRepoVersions() {\n+\t/* private */void updateShowTooltips() {\n+\t\tboolean showTooltip = toggleTooltipsAction.isChecked();\n+\n+\t\tif(showTooltip) {\n+\t\t\ttable.addMouseMoveListener(tableMouseMoveListener);\n+\t\t} else {\n+\t\t\ttable.removeMouseMoveListener(tableMouseMoveListener);\n+\t\t\t// TODO: workaround for setToolTipText(null), it doesn't work on eclipse gtk.\n+\t\t\t// Robin suggested a javadoc F2 style tooltip to replace the current one,\n+\t\t\t// so if we move to the javadoc style tooltip, this problem may be irrelevant.\n+\t\t\ttable.setToolTipText(null);\n+\t\t}\n+\t}\n+\n+\t/* private */boolean isShowAllRepoVersions() {\n \t\treturn showAllRepoVersions;\n \t}\n \n@@ -298,7 +428,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\tPREF_SHOWALLREPOVERSIONS, showAllRepoVersions);\n \t}\n \n-\tprivate boolean isShowAllProjectVersions() {\n+\t/* private */boolean isShowAllProjectVersions() {\n \t\treturn showAllProjectVersions;\n \t}\n \n@@ -308,7 +438,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\tPREF_SHOWALLPROJECTVERSIONS, showAllProjectVersions);\n \t}\n \n-\tprivate boolean isShowAllFolderVersions() {\n+\t/* private */boolean isShowAllFolderVersions() {\n \t\treturn showAllFolderVersions;\n \t}\n \n@@ -398,7 +528,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\tDate d = new Date(element.getTimestamp());\n \t\t\t\tif (d.getTime() == -1)\n \t\t\t\t\treturn \"\";\n-\t\t\t\treturn d.toString();\n+\t\t\t\treturn DATETIME_FORMAT.format(d);\n \t\t\t}\n \t\t\tif (columnIndex == 4)\n \t\t\t\treturn element.getAuthor();\n@@ -417,6 +547,166 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t}\n \t}\n \n+\tprivate void createRevDetailTextViewer(SashForm composite) {\n+\t\trevDetailTextViewer = new TextViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);\n+\t}\n+\n+\tprivate void createRevCommentTextViewer(SashForm composite) {\n+\t\trevCommentTextViewer = new TextViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);\n+\t}\n+\n+\t/* private */void setRevisionInfoTextViewers(IFileRevision rev) {\n+\t\tStringBuilder revisionInfo = new StringBuilder();\n+\t\tif (appliedPatches != null) {\n+\t\t\tString id = rev.getContentIdentifier();\n+\t\t\tif (!id.equals(\"Workspace\") && !id.equals(\"Index\")) {\n+\t\t\t\tStGitPatch patch = (StGitPatch) appliedPatches\n+\t\t\t\t\t\t.get(new ObjectId(id));\n+\t\t\t\tif (patch != null) {\n+\t\t\t\t\trevisionInfo.append(\"Patch: \");\n+\t\t\t\t\trevisionInfo.append(patch.getName());\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\trevisionInfo.append(id.toString());\n+\t\t\t}\n+\t\t}\n+\t\tif (revisionInfo.length() == 0) {\n+\t\t\trevisionInfo.append(\"Commit: \");\n+\t\t\trevisionInfo.append(rev.getContentIdentifier());\n+\t\t}\n+\n+\t\t// Gets the tags for this revision.\n+\t\t// TODO: Understand this better and see if there's a simpler/shared way to do it.\n+\t\tIProject project = ((IResource) getInput()).getProject();\n+\t\tRepositoryMapping repositoryMapping = RepositoryMapping.getMapping(project);\n+\t\tMap<ObjectId,Tag[]> newtags = new HashMap<ObjectId,Tag[]>();\n+\t\ttry {\n+\t\t\tfor (String name : repositoryMapping.getRepository().getTags()) {\n+\t\t\t\tTag t = repositoryMapping.getRepository().mapTag(name);\n+\t\t\t\tTag[] samecommit = newtags.get(t.getObjId());\n+\t\t\t\tif (samecommit==null) { \n+\t\t\t\t\tsamecommit = new Tag[] { t };\n+\t\t\t\t} else {\n+\t\t\t\t\tTag[] n=new Tag[samecommit.length+1];\n+\t\t\t\t\tfor (int j=0; j<samecommit.length; ++j)\n+\t\t\t\t\t\tn[j] = samecommit[j];\n+\t\t\t\t\tn[n.length-1] = t;\n+\t\t\t\t\tsamecommit = n;\n+\t\t\t\t}\n+\t\t\t\tnewtags.put(t.getObjId(), samecommit);\n+\t\t\t}\n+\n+\t\t\tString id = rev.getContentIdentifier();\n+\t\t\tif (!id.equals(\"Workspace\") && !id.equals(\"Index\")) {\n+\t\t\t\tObjectId oid = new ObjectId(id);\n+\t\t\t\tStringBuilder b=new StringBuilder();\n+\t\t\t\tif (tags != null) {\n+\t\t\t\t\tTag[] matching = tags.get(oid);\n+\t\t\t\t\tif (matching != null) {\n+\t\t\t\t\t\tfor (Tag t : matching) {\n+\t\t\t\t\t\t\tif (b.length() > 0)\n+\t\t\t\t\t\t\t\tb.append(\", \");\n+\t\t\t\t\t\t\tString tag = t.getTag();\n+\t\t\t\t\t\t\tb.append(tag);\n+\t\t\t\t\t\t}\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tif(b.length() > 0) {\n+\t\t\t\t\trevisionInfo.append(\"\\nTags: \");\n+\t\t\t\t\trevisionInfo.append(b);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t} catch (IOException e) {\n+\t\t\te.printStackTrace();\n+\t\t}\n+\n+\t\t// Gets the branches for this revision.\n+\t\t// TODO: Branches should always show all the branches from a commit.\n+\t\tMap<ObjectId, String[]> newBranches = new HashMap<ObjectId, String[]>();\n+\t\ttry {\n+\t\t\tfor (String branch : repositoryMapping.getRepository().getBranches()) {\n+\t\t\t\tObjectId id = repositoryMapping.getRepository().resolve(branch);\n+\t\t\t\tString[] samecommit = newBranches.get(id);\n+\t\t\t\tif (samecommit == null) {\n+\t\t\t\t\tsamecommit = new String[] { branch };\n+\t\t\t\t} else {\n+\t\t\t\t\tString[] n=new String[samecommit.length + 1];\n+\t\t\t\t\tfor (int j=0; j<samecommit.length; ++j)\n+\t\t\t\t\t\tn[j] = samecommit[j];\n+\t\t\t\t\tn[n.length-1] = branch;\n+\t\t\t\t\tsamecommit = n;\n+\t\t\t\t}\n+\t\t\t\tnewBranches.put(id, samecommit);\n+\t\t\t}\n+\t\t\tString[] samecommit = newBranches.get(currentHead);\n+\t\t\tif (samecommit == null) {\n+\t\t\t\tsamecommit = new String[] { \"HEAD\" };\n+\t\t\t} else {\n+\t\t\t\tString[] n=new String[samecommit.length + 1];\n+\t\t\t\tfor (int j=0; j<samecommit.length; ++j)\n+\t\t\t\t\tn[j] = samecommit[j];\n+\t\t\t\tn[n.length-1] = \"HEAD\";\n+\t\t\t\tsamecommit = n;\n+\t\t\t}\n+\t\t\tnewBranches.put(currentHead, samecommit);\n+\t\t\tbranches = newBranches;\n+\n+\t\t\tString id = rev.getContentIdentifier();\n+\t\t\tif (branches != null) {\n+\t\t\t\tStringBuilder b=new StringBuilder();\n+\t\t\t\tObjectId oid = new ObjectId(id);\n+\t\t\t\tString[] matching = branches.get(oid);\n+\t\t\t\tif (matching != null) {\n+\t\t\t\t\tfor (String t : matching) {\n+\t\t\t\t\t\tif (b.length() > 0)\n+\t\t\t\t\t\t\tb.append(\", \");\n+\t\t\t\t\t\tif (t.startsWith(\"refs/heads/\"))\n+\t\t\t\t\t\t\tt = t.substring(11);\n+\t\t\t\t\t\tb.append(t);\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tif(b.length() > 0) {\n+\t\t\t\t\trevisionInfo.append(\"\\nBranches: \");\n+\t\t\t\t\trevisionInfo.append(b);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t} catch (IOException e) {\n+\t\t\te.printStackTrace();\n+\t\t}\n+\n+\t\trevisionInfo.append(\"\\nAuthor: \");\n+\t\trevisionInfo.append(rev.getAuthor());\n+\t\trevisionInfo.append(\"\\nDate: \");\n+\t\trevisionInfo.append(DATETIMETZ_FORMAT.format(new Date(rev.getTimestamp())));\n+\n+\t\tString comment = rev.getComment();\n+\t\trevDetailTextViewer.setDocument(new Document(revisionInfo.toString()));\n+\t\trevCommentTextViewer.setDocument(new Document(comment));\n+\n+\t\t// Adds the first comment line in the status line.\n+\t\tint enterIndex = comment.indexOf(\"\\n\");\n+\t\tif(enterIndex > 0) {\n+\t\t\tcomment = comment.substring(0, enterIndex);\n+\t\t}\n+\t\tIPageSite workbenchPageSite = getHistoryPageSite().getWorkbenchPageSite();\n+\t\tif (workbenchPageSite != null) {\n+\t\t\tworkbenchPageSite.getActionBars().getStatusLineManager().setMessage(comment);\n+\t\t}\n+\t}\n+\n+\t/* private */void cleanRevisionInfoTextViewers() {\n+\t\tif(revDetailTextViewer != null && revCommentTextViewer != null) {\n+\t\t\trevDetailTextViewer.setDocument(new Document(\"\"));\n+\t\t\trevCommentTextViewer.setDocument(new Document(\"\"));\n+\n+\t\t\t// Cleans the status line\n+\t\t\tIPageSite workbenchPageSite = getHistoryPageSite().getWorkbenchPageSite();\n+\t\t\tif (workbenchPageSite != null) {\n+\t\t\t\tworkbenchPageSite.getActionBars().getStatusLineManager().setMessage(null);\n+\t\t\t}\n+\t\t}\n+\t}\n+\n \tprivate void createTable(Composite composite) {\n \t\ttable = new Table(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI\n \t\t\t\t| SWT.FULL_SELECTION | SWT.VIRTUAL);\n@@ -562,10 +852,10 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\tviewer.setInput(getInput());\n \t}\n \n-\tprivate Map appliedPatches;\n+\t/* private */Map appliedPatches;\n \tObjectId currentHead;\n-\tprivate Map<ObjectId,Tag[]> tags;\n-\tprivate Map<ObjectId, String[]> branches;\n+\t/* private */Map<ObjectId,Tag[]> tags;\n+\t/* private */Map<ObjectId, String[]> branches;\n \tGitHistoryLabelProvider lp = new GitHistoryLabelProvider();\n \n \tclass HistoryRefreshJob extends Job {\n@@ -668,6 +958,8 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\ttable.getDisplay().asyncExec(new Runnable() {\n \t\t\t\t\n \t\t\t\t\tpublic void run() {\n+\t\t\t\t\t\tcleanRevisionInfoTextViewers();\n+\n \t\t\t\t\t\ttable.removeAll();\n \t\t\t\t\t\ttable.setItemCount(fileRevisions.size());\n \t\t\t\t\t\ttable.setData(\"X\");\n@@ -726,6 +1018,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t}\n \n \t\tpublic void dispose() {\n+\t\t\treturn;\n \t\t}\n \n \t\tpublic void updateElement(int index) {\n@@ -763,7 +1056,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\tcol.setResizable(true);\n \t\tcol.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime);\n \t\t// X col.addSelectionListener(headerListener);\n-\t\t((TableLayout) table.getLayout()).addColumnData(new ColumnWeightData(30,\n+\t\t((TableLayout) table.getLayout()).addColumnData(new ColumnWeightData(20,\n \t\t\t\ttrue));\n \n \t\t// author\n@@ -779,7 +1072,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\tcol.setResizable(true);\n \t\tcol.setText(TeamUIMessages.GenericHistoryTableProvider_Comment);\n \t\t// X col.addSelectionListener(headerListener);\n-\t\t((TableLayout) table.getLayout()).addColumnData(new ColumnWeightData(35,\n+\t\t((TableLayout) table.getLayout()).addColumnData(new ColumnWeightData(45,\n \t\t\t\ttrue));\n \t}\n \n@@ -859,7 +1152,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t// example\n \t\tString niceComment = unwrapComment(rev.getComment());\n \t\tString toolTipText = commitStr + \"\\nAuthor: \" + rev.getAuthor()\n-\t\t\t\t+ \"\\nDate: \" + new Date(rev.getTimestamp()) + \"\\n\\n\"\n+\t\t\t\t+ \"\\nDate: \" + DATETIMETZ_FORMAT.format(new Date(rev.getTimestamp())) + \"\\n\\n\"\n \t\t\t\t+ niceComment;\n \t\treturn toolTipText;\n \t}\ndiff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java\nnew file mode 100644\nindex 0000000..ab89bec\n--- /dev/null\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java\n@@ -0,0 +1,46 @@\n+/*\n+ *  Copyright (C) 2008  Roger C. Soares <rogersoares@intelinet.com.br>\n+ *\n+ *  This library is free software; you can redistribute it and/or\n+ *  modify it under the terms of the GNU Lesser General Public\n+ *  License, version 2.1, as published by the Free Software Foundation.\n+ *\n+ *  This library is distributed in the hope that it will be useful,\n+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+ *  Lesser General Public License for more details.\n+ *\n+ *  You should have received a copy of the GNU Lesser General Public\n+ *  License along with this library; if not, write to the Free Software\n+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301\n+ */\n+package org.spearce.egit.ui;\n+\n+import org.eclipse.core.runtime.Preferences;\n+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;\n+\n+/**\n+ * Plugin extension point to initialize the plugin runtime preferences.\n+ */\n+public class PluginPreferenceInitializer extends AbstractPreferenceInitializer {\n+\n+\t/**\n+\t * Calls super constructor.\n+\t */\n+\tpublic PluginPreferenceInitializer() {\n+\t\tsuper();\n+\t}\n+\n+\t/**\n+\t * This method initializes the plugin preferences with default values.\n+\t */\n+\tpublic void initializeDefaultPreferences() {\n+\t\tPreferences prefs = Activator.getDefault().getPluginPreferences();\n+\n+\t\tprefs.setDefault(UIPreferences.RESOURCEHISTORY_SHOW_COMMENT_WRAP, true);\n+\t\tprefs.setDefault(UIPreferences.RESOURCEHISTORY_SHOW_REV_DETAIL, true);\n+\t\tprefs.setDefault(UIPreferences.RESOURCEHISTORY_SHOW_REV_COMMENT, true);\n+\t\tprefs.setDefault(UIPreferences.RESOURCEHISTORY_SHOW_TOOLTIPS, false);\n+\t}\n+\n+}\ndiff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIPreferences.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIPreferences.java\nnew file mode 100644\nindex 0000000..900023a\n--- /dev/null\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIPreferences.java\n@@ -0,0 +1,32 @@\n+/*\n+ *  Copyright (C) 2008  Roger C. Soares <rogersoares@intelinet.com.br>\n+ *\n+ *  This library is free software; you can redistribute it and/or\n+ *  modify it under the terms of the GNU Lesser General Public\n+ *  License, version 2.1, as published by the Free Software Foundation.\n+ *\n+ *  This library is distributed in the hope that it will be useful,\n+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+ *  Lesser General Public License for more details.\n+ *\n+ *  You should have received a copy of the GNU Lesser General Public\n+ *  License along with this library; if not, write to the Free Software\n+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301\n+ */\n+package org.spearce.egit.ui;\n+\n+/**\n+ * Preferences used by the plugin.\n+ * All plugin preferences shall be referenced by a constant in this class.\n+ */\n+public class UIPreferences {\n+\t/** */\n+\tpublic final static String RESOURCEHISTORY_SHOW_COMMENT_WRAP = \"resourcehistory_show_comment_wrap\";\n+\t/** */\n+\tpublic final static String RESOURCEHISTORY_SHOW_REV_DETAIL = \"resourcehistory_show_rev_detail\";\n+\t/** */\n+\tpublic final static String RESOURCEHISTORY_SHOW_REV_COMMENT = \"resourcehistory_show_rev_comment\";\n+\t/** */\n+\tpublic final static String RESOURCEHISTORY_SHOW_TOOLTIPS = \"resourcehistory_show_tooltips\";\n+}\ndiff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java\nindex b6c7a28..1454124 100644\n--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java\n@@ -53,6 +53,15 @@ public class UIText extends NLS {\n \t/** */\n \tpublic static String QuickDiff_failedLoading;\n \n+\t/** */\n+\tpublic static String ResourceHistory_toggleCommentWrap;\n+\t/** */\n+\tpublic static String ResourceHistory_toggleRevDetail;\n+\t/** */\n+\tpublic static String ResourceHistory_toggleRevComment;\n+\t/** */\n+\tpublic static String ResourceHistory_toggleTooltips;\n+\n \tstatic {\n \t\tinitializeMessages(UIText.class.getPackage().getName() + \".uitext\",\n \t\t\t\tUIText.class);\ndiff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties\nindex 75e975b..be02978 100644\n--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties\n@@ -28,3 +28,8 @@ ExistingOrNewPage_createNew=Create a new Git repository for this project\n \n Decorator_failedLazyLoading=Resource decorator failed to load tree contents on demand.\n QuickDiff_failedLoading=Quick diff failed to obtain file data.\n+\n+ResourceHistory_toggleCommentWrap=Wrap Comments\n+ResourceHistory_toggleRevDetail=Show Revision Details\n+ResourceHistory_toggleRevComment=Show Revision Comment\n+ResourceHistory_toggleTooltips=Show Revision Tooltip\n-- \n1.5.3.7\n"},{"id":"65280","messageId":"200801140006.35763.robin.rosenberg@dewire.com","threadId":"11611","inReplyTo":"1200258510-15235-1-git-send-email-rogersoares@intelinet.com.br","subject":"Re: [EGIT PATCH] Showing commit info similar to the CVS plugin.","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2008-01-13T23:06:35Z","receivedAt":"2008-01-13T23:06:35Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\nThanks. I pushed this code. I changed the comment sligtly and fixed a trailing whitespace.\n\n-- robin\n"}]}