1 11 package org.eclipse.team.core.variants; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.core.resources.IWorkspaceRunnable; 15 import org.eclipse.core.runtime.*; 16 import org.eclipse.team.core.TeamException; 17 18 34 public abstract class ResourceVariantByteStore { 35 36 39 public abstract void dispose(); 40 41 51 public abstract byte[] getBytes(IResource resource) throws TeamException; 52 53 64 public abstract boolean setBytes(IResource resource, byte[] bytes) throws TeamException; 65 66 77 public abstract boolean flushBytes(IResource resource, int depth) throws TeamException; 78 79 87 public abstract boolean deleteBytes(IResource resource) throws TeamException; 88 89 94 public abstract IResource[] members(IResource resource) throws TeamException; 95 96 102 protected boolean equals(byte[] syncBytes1, byte[] syncBytes2) { 103 if (syncBytes1 == null) { 104 return syncBytes2 == null; 105 } else if (syncBytes2 == null) { 106 return false; 107 } 108 if (syncBytes1.length != syncBytes2.length) return false; 109 for (int i = 0; i < syncBytes1.length; i++) { 110 if (syncBytes1[i] != syncBytes2[i]) return false; 111 } 112 return true; 113 } 114 115 126 public void run(IResource root, IWorkspaceRunnable runnable, IProgressMonitor monitor) throws TeamException { 127 try { 128 runnable.run(monitor); 129 } catch (CoreException e) { 130 throw TeamException.asTeamException(e); 131 } 132 } 133 } 134 | Popular Tags |