Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> --- .../src/org/spearce/egit/core/GitBlobStorage.java | 99 -------------------- 1 files changed, 0 insertions(+), 99 deletions(-) delete mode 100644 org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java deleted file mode 100644 index f7a062c..0000000 --- a/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2006 Robin Rosenberg - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License, version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - */ -package org.spearce.egit.core; - -import java.io.ByteArrayInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - -import org.eclipse.core.internal.resources.ResourceException; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.spearce.egit.core.project.RepositoryMapping; -import org.spearce.jgit.lib.ObjectId; -import org.spearce.jgit.lib.ObjectLoader; -import org.spearce.jgit.lib.Tree; -import org.spearce.jgit.lib.TreeEntry; - -public class GitBlobStorage implements IStorage { - - private final IResource resource; - - private TreeEntry entry; - - public GitBlobStorage(ObjectId treeId, IResource resource, String relativeResourceName) { - this.resource = resource; - if (treeId == null) - return; - - RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(resource); - Tree tree; - try { - tree = repositoryMapping.getRepository().mapTree(treeId); - String name = repositoryMapping.getRepoRelativePath(resource); - entry = tree.findBlobMember(name); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public InputStream getContents() throws CoreException { - try { - if (entry == null) { - return ((IFile) resource).getContents(); - } else { - ObjectId id = entry.getId(); - ObjectLoader reader = entry.getRepository().openBlob(id); - byte[] bytes = reader.getBytes(); - return new ByteArrayInputStream(bytes); - } - } catch (FileNotFoundException e) { - throw new ResourceException(IResourceStatus.FAILED_READ_LOCAL, - resource.getFullPath(), "Could not read file", e); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - throw new ResourceException(33, resource.getFullPath(), e - .getMessage(), e); - } - } - - public IPath getFullPath() { - return resource.getFullPath(); - } - - public String getName() { - return resource.getName(); - } - - public boolean isReadOnly() { - // TODO Auto-generated method stub - return false; - } - - public Object getAdapter(Class adapter) { - System.out.println("GitStorage("+adapter.getName()+")"); - return null; - } - -} -- 1.5.4.rc4.25.g81cc - 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