1 11 package org.eclipse.compare.internal.patch; 12 13 import java.util.List ; 14 15 import org.eclipse.compare.patch.PatchConfiguration; 16 import org.eclipse.core.resources.*; 17 18 public class WorkspaceFileDiffResult extends FileDiffResult { 19 20 public WorkspaceFileDiffResult(FileDiff diff, 21 PatchConfiguration configuration) { 22 super(diff, configuration); 23 } 24 25 protected boolean canCreateTarget(IStorage storage) { 26 IProject project = getPatcher().getTargetProject(getDiff()); 27 return project != null && project.isAccessible(); 28 } 29 30 protected boolean targetExists(IStorage storage) { 31 IFile file= (IFile)storage; 32 return file != null && file.isAccessible(); 33 } 34 35 protected List getLines(IStorage storage, boolean create) { 36 IFile file= getTargetFile(); 37 List lines = Patcher.load(file, create); 38 return lines; 39 } 40 41 protected Patcher getPatcher() { 42 return Patcher.getPatcher(getConfiguration()); 43 } 44 45 protected IFile getTargetFile() { 46 return getPatcher().getTargetFile(getDiff()); 47 } 48 49 public void refresh() { 50 refresh(getTargetFile(), null); 51 } 52 53 } 54 | Popular Tags |