aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-03 19:57:41 (EDT)
committerKevin Sawicki2011-04-03 19:57:41 (EDT)
commit4f6763d01e936fa9af51eb57d2e3ba6d17cf403b (patch)
treef9cab4c3120f7db433a27b6fa420764dac6f53f8
parent7c7a00edc264b70fca18254351568ce34bfe2bc1 (diff)
downloadegit-4f6763d01e936fa9af51eb57d2e3ba6d17cf403b.zip
egit-4f6763d01e936fa9af51eb57d2e3ba6d17cf403b.tar.gz
egit-4f6763d01e936fa9af51eb57d2e3ba6d17cf403b.tar.bz2
Make FileDiff, FileDiffContentProvider, and FileDiffLabelProviderrefs/changes/00/3000/1
public. These classes are currently package protected. Bug: 341734 Change-Id: If4306d600f5369043dc3e55f035358bbff325208 Signed-off-by: Kevin Sawicki <kevin@github.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java53
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffContentProvider.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java5
3 files changed, 58 insertions, 5 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java
index 777f7ef..607b9d7 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java
@@ -40,7 +40,11 @@ import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.treewalk.EmptyTreeIterator;
import org.eclipse.jgit.treewalk.TreeWalk;
-class FileDiff {
+/**
+ * A class with information about the changes to a file introduced in a
+ * commit.
+ */
+public class FileDiff {
private final RevCommit commit;
@@ -54,7 +58,18 @@ class FileDiff {
return r;
}
- static FileDiff[] compute(final TreeWalk walk, final RevCommit commit)
+ /**
+ * Computer file diffs for specified tree walk and commit
+ *
+ * @param walk
+ * @param commit
+ * @return non-null but possibly empty array of file diffs
+ * @throws MissingObjectException
+ * @throws IncorrectObjectTypeException
+ * @throws CorruptObjectException
+ * @throws IOException
+ */
+ public static FileDiff[] compute(final TreeWalk walk, final RevCommit commit)
throws MissingObjectException, IncorrectObjectTypeException,
CorruptObjectException, IOException {
final ArrayList<FileDiff> r = new ArrayList<FileDiff>();
@@ -215,20 +230,40 @@ class FileDiff {
return new RawText(ldr.getCachedBytes(Integer.MAX_VALUE));
}
+ /**
+ * Get commit
+ *
+ * @return commit
+ */
public RevCommit getCommit() {
return commit;
}
+ /**
+ * Get path
+ *
+ * @return path
+ */
public String getPath() {
if (ChangeType.DELETE.equals(diffEntry.getChangeType()))
return diffEntry.getOldPath();
return diffEntry.getNewPath();
}
+ /**
+ * Get change type
+ *
+ * @return type
+ */
public ChangeType getChange() {
return diffEntry.getChangeType();
}
+ /**
+ * Get blob object ids
+ *
+ * @return non-null but possibly empty array of object ids
+ */
public ObjectId[] getBlobs() {
List<ObjectId> objectIds = new ArrayList<ObjectId>();
if (diffEntry.getOldId() != null)
@@ -238,6 +273,11 @@ class FileDiff {
return objectIds.toArray(new ObjectId[]{});
}
+ /**
+ * Get file modes
+ *
+ * @return non-null but possibly empty array of file modes
+ */
public FileMode[] getModes() {
List<FileMode> modes = new ArrayList<FileMode>();
if (diffEntry.getOldMode() != null)
@@ -247,7 +287,14 @@ class FileDiff {
return modes.toArray(new FileMode[]{});
}
- FileDiff(final RevCommit c, final DiffEntry entry) {
+ /**
+ * Create a file diff for a specified {@link RevCommit} and
+ * {@link DiffEntry}
+ *
+ * @param c
+ * @param entry
+ */
+ public FileDiff(final RevCommit c, final DiffEntry entry) {
diffEntry = entry;
commit = c;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffContentProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffContentProvider.java
index fe569a7..8711c71 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffContentProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffContentProvider.java
@@ -18,7 +18,10 @@ import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.osgi.util.NLS;
-class FileDiffContentProvider implements IStructuredContentProvider {
+/**
+ * Content provider for {@link FileDiff} objects
+ */
+public class FileDiffContentProvider implements IStructuredContentProvider {
private TreeWalk walk;
private RevCommit commit;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java
index 6ad8499..3568e11 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java
@@ -22,7 +22,10 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-class FileDiffLabelProvider extends BaseLabelProvider implements
+/**
+ * Label provider for {@link FileDiff} objects
+ */
+public class FileDiffLabelProvider extends BaseLabelProvider implements
ITableLabelProvider {
private Image DEFAULT = PlatformUI.getWorkbench().getSharedImages()