{"thread":{"id":"7844","subject":"[EGIT PATCH] Fix layout problems in history view","startedAt":"2007-04-25T19:54:58Z","lastAt":"2007-04-25T19:54:58Z","messageCount":1,"participants":["Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"40431","messageId":"20070425195458.19846.74255.stgit@lathund.dewire.com","threadId":"7844","inReplyTo":null,"subject":"[EGIT PATCH] Fix layout problems in history view","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2007-04-25T19:54:58Z","receivedAt":"2007-04-25T19:54:58Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"Before this fix the rows in the history view sometimes (often)\ngot the wrong line height, leaving only half lines visible.\nAlso adjust column widths a little and add \"Tags\" header and\ndo not display time for workspace files.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n\n .../src/org/spearce/egit/ui/GitHistoryPage.java    |   40 ++++++++++++-----------\n 1 files changed, 21 insertions(+), 19 deletions(-)\n\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 c72e1f1..7bc947b 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@@ -100,7 +100,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\tlayout.marginHeight = 0;\n \t\tlayout.marginWidth = 0;\n \t\tlocalComposite.setLayout(layout);\n-\t\tGridData data = new GridData(GridData.FILL_BOTH);\n+\t\tGridData data = new GridData(SWT.FILL, SWT.FILL, true, true);\n \t\tdata.grabExcessVerticalSpace = true;\n \t\tlocalComposite.setLayoutData(data);\n \n@@ -201,9 +201,11 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\tString rs = rss.substring(rss.length()-10);\n \t\t\t\tString id = ((IFileRevision) element).getContentIdentifier();\n \t\t\t\tif (appliedPatches!=null) {\n-\t\t\t\t\tStGitPatch patch = (StGitPatch) appliedPatches.get(new ObjectId(id));\n-\t\t\t\t\tif (patch!=null)\n-\t\t\t\t\t\treturn patch.getName();\n+\t\t\t\t\tif (!id.equals(\"Workspace\")) {\n+\t\t\t\t\t\tStGitPatch patch = (StGitPatch) appliedPatches.get(new ObjectId(id));\n+\t\t\t\t\t\tif (patch!=null)\n+\t\t\t\t\t\t\treturn patch.getName();\n+\t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\tif (id != null)\n \t\t\t\t\tif (id.length() > 9) // make sure \"Workspace\" is spelled out\n@@ -217,10 +219,12 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\tif (columnIndex == 2)\n \t\t\t\treturn \"\"; // TAGS\n \n-\t\t\tif (columnIndex == 3)\n-\t\t\t\treturn new Date(((IFileRevision) element).getTimestamp())\n-\t\t\t\t\t\t.toString();\n-\n+\t\t\tif (columnIndex == 3) {\n+\t\t\t\tDate d = new Date(((IFileRevision) 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}\n \t\t\tif (columnIndex == 4)\n \t\t\t\treturn ((IFileRevision) element).getAuthor();\n \n@@ -243,8 +247,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\t| SWT.FULL_SELECTION | SWT.VIRTUAL);\n \t\ttree.setHeaderVisible(true);\n \t\ttree.setLinesVisible(true);\n-\n-\t\tGridData data = new GridData(GridData.FILL_BOTH);\n+\t\tGridData data = new GridData(SWT.FILL, SWT.FILL, true, true);\n \t\ttree.setLayoutData(data);\n \t\ttree.setData(\"HEAD\");\n \t\ttree.addListener(SWT.SetData, new Listener() {\n@@ -314,13 +317,12 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\t\t\t\t.getFileHistoryFor((IResource) getInput(),\n \t\t\t\t\t\t\tIFileHistoryProvider.SINGLE_LINE_OF_DESCENT, null/* monitor */);\n \t\t\tfileRevisions = fileHistoryFor.getFileRevisions();\n-\t\t\ttree.clearAll(true);\n+\t\t\ttree.removeAll();\n \t\t\ttree.setItemCount(fileRevisions.length);\n \t\t\ttree.setData(fileRevisions);\n+\t\t\ttree.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));\n \t\t\tSystem.out.println(\"inputchanged, invoking refresh\");\n \t\t\tviewer.refresh();\n-\t\t\ttree.getParent().layout();\n-\t\t\ttree.getParent().getParent().layout();\n \t\t}\n \n \t\tpublic void dispose() {\n@@ -363,7 +365,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\tcol.setResizable(true);\n \t\tcol.setText(\"^\");\n \t\t// X col.addSelectionListener(headerListener);\n-\t\t((TableLayout) tree.getLayout()).addColumnData(new ColumnWeightData(10,\n+\t\t((TableLayout) tree.getLayout()).addColumnData(new ColumnWeightData(15,\n \t\t\t\ttrue));\n \n \t\t// revision\n@@ -371,22 +373,22 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,\n \t\tcol.setResizable(true);\n \t\tcol.setText(TeamUIMessages.GenericHistoryTableProvider_Revision);\n \t\t// X col.addSelectionListener(headerListener);\n-\t\t((TableLayout) tree.getLayout()).addColumnData(new ColumnWeightData(10,\n+\t\t((TableLayout) tree.getLayout()).addColumnData(new ColumnWeightData(15,\n \t\t\t\ttrue));\n \n \t\t// tags\n \t\tcol = new TreeColumn(tree, SWT.NONE);\n \t\tcol.setResizable(true);\n-\t\t// X col.setText(CVSUIMessages.HistoryView_tags);\n+\t\tcol.setText(\"Tags\");\n \t\t// X col.addSelectionListener(headerListener);\n-\t\t((TableLayout) tree.getLayout()).addColumnData(new ColumnWeightData(20,\n+\t\t((TableLayout) tree.getLayout()).addColumnData(new ColumnWeightData(15,\n \t\t\t\ttrue));\n \t\t// creation date\n \t\tcol = new TreeColumn(tree, SWT.NONE);\n \t\tcol.setResizable(true);\n \t\tcol.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime);\n \t\t// X col.addSelectionListener(headerListener);\n-\t\t((TableLayout) tree.getLayout()).addColumnData(new ColumnWeightData(20,\n+\t\t((TableLayout) tree.getLayout()).addColumnData(new ColumnWeightData(30,\n \t\t\t\ttrue));\n \n \t\t// author\n@@ -402,7 +404,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) tree.getLayout()).addColumnData(new ColumnWeightData(50,\n+\t\t((TableLayout) tree.getLayout()).addColumnData(new ColumnWeightData(35,\n \t\t\t\ttrue));\n \t}\n \n"}]}