git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[EGIT PATCH] Remove directory entries from Structure Compare view.

From
RSRoger C. Soares <rogersoares@intelinet.com.br>
Date
Jan 4, 2008, 02:11 UTC
Message-ID
<200801040011.17934.rogersoares@intelinet.com.br>
Date: Wed, 2 Jan 2008 22:51:33 -0200
Signed-off-by: Roger C. Soares <rogersoares@intelinet.com.br>
---
Please evaluate.
 .../GitCompareFileRevisionEditorInput.java         |   25 +++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitCompareFileRevisionEditorInput.java 
b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitCompareFileRevisionEditorInput.java
index 82cd205..eaba1fa 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitCompareFileRevisionEditorInput.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitCompareFileRevisionEditorInput.java
@@ -21,6 +21,7 @@ import org.eclipse.compare.ITypedElement;
 import org.eclipse.compare.structuremergeviewer.DiffNode;
 import org.eclipse.compare.structuremergeviewer.Differencer;
 import org.eclipse.compare.structuremergeviewer.ICompareInput;
+import org.eclipse.compare.structuremergeviewer.IDiffElement;
 import org.eclipse.compare.structuremergeviewer.IStructureComparator;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFileState;
@@ -299,7 +300,29 @@ public class GitCompareFileRevisionEditorInput extends CompareEditorInput {
 		ensureContentsCached(getLeftRevision(), getRightRevision(), monitor);
 		initLabels(input);
 		setTitle(NLS.bind(TeamUIMessages.SyncInfoCompareInput_title, new String[] { input.getName() }));
-		return input;
+
+		// The compare editor (Structure Compare) will show the diff filenames
+		// with their project relative path. So, no need to also show directory entries.
+		DiffNode flatDiffNode = new DiffNode(null,Differencer.CHANGE,null,left,right);
+		flatDiffView(flatDiffNode, (DiffNode) input);
+
+		return flatDiffNode;
+	}
+
+	private void flatDiffView(DiffNode rootNode, DiffNode currentNode) {
+		if(currentNode != null) {
+			IDiffElement[] dElems = currentNode.getChildren();
+			if(dElems != null) {
+				for(IDiffElement dElem : dElems) {
+					DiffNode dNode = (DiffNode) dElem;
+					if(dNode.getChildren() != null && dNode.getChildren().length > 0) {
+						flatDiffView(rootNode, dNode);
+					} else {
+						rootNode.add(dNode);
+					}
+				}
+			}
+		}
 	}
 
 }
-- 
1.5.3.7
Next: Robin Rosenberg
Message 1 of 2 in “Remove directory entries from Structure Compare view.”
  1. Remove directory entries from Structure Compare view.Roger C. Soares, Jan 4, 2008
  2. Robin RosenbergJan 5, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.