1 11 package org.eclipse.compare.internal.patch; 12 13 import java.util.*; 14 15 import org.eclipse.core.resources.IFile; 16 import org.eclipse.core.resources.IProject; 17 import org.eclipse.core.runtime.IPath; 18 import org.eclipse.jface.resource.ImageDescriptor; 19 import org.eclipse.ui.model.IWorkbenchAdapter; 20 21 26 public class DiffProject { 27 28 private IProject fProject; 29 private Set fDiffs= new HashSet(); 30 31 35 public DiffProject(IProject project) { 36 this.fProject= project; 37 } 38 39 43 void add(FileDiff diff) { 44 fDiffs.add(diff); 45 if (diff.getProject() != this) 46 diff.setProject(this); 47 } 48 49 50 54 public IProject getProject() { 55 return this.fProject; 56 } 57 58 62 public String getName() { 63 return fProject.getName(); 64 } 65 66 71 public IFile getFile(IPath path) { 72 return fProject.getFile(path); 73 } 74 75 public ImageDescriptor getImageDescriptor() { 76 Object o= fProject.getAdapter(IWorkbenchAdapter.class); 77 if (o instanceof IWorkbenchAdapter) { 78 ImageDescriptor id= ((IWorkbenchAdapter) o).getImageDescriptor(fProject); 79 return id; 80 } 81 return null; 82 } 83 84 88 public void remove(FileDiff diff) { 89 fDiffs.remove(diff); 90 } 91 92 97 public boolean contains(FileDiff diff) { 98 return fDiffs.contains(diff); 99 } 100 101 105 public FileDiff[] getFileDiffs() { 106 return (FileDiff[]) fDiffs.toArray(new FileDiff[fDiffs.size()]); 107 } 108 } 109 | Popular Tags |